If I understand the situation correctly, you had some old programs that, although being launched in CGI mode by the web server, were not using the
-cgi command line flag, and instead were just using ordinary PRINT statements to create the new web page output. (Just to restate what might be obvious here: in A-Shell/UNIX, unlike A-Shell/Windows, ordinary output sent to the screen, i.e. PRINT statements, is in fact stdout.)
The problem which you encountered is that in addition to your explicit PRINT statements, A-Shell also outputs some initial "junk" (such as echoing the startup command line, and maybe some terminal emulation-related ESC sequences). That junk was certainly not respecting the specifications for how the output of CGI process is supposed to begin. Some older web servers weren't really that persnickety about enforcing such rules, but newer ones almost certainly are.
I'm not sure if it should be considered an Ashell issue or not. On the one hand, what might appear as "junk" to the CGI server may be otherwise quite reasonable to a "normal" terminal client. On the other hand, it could be argued that there should be a way to stifle such extraneous initial output, allowing your program to have 100% control over the entirety of the stdout stream. The -cgi switch already provides one method of accomplishing that, but at the cost of forcing you to change all your PRINT statements to CGIUTL calls. And that would seem especially circuitous if the objective, rather than being CGI, was to use an AShell command in a piped series of commands (where any such junk might cause other problems).
After a bit more investigation, I think I've confirmed that you can create a "clean" stdout session by explicitly specifying the "dumb" terminal driver, i.e.
-td dumb . (The
-q switch will also stifle the initial output, allowing it to be turned back on again by the CMD/DO file :R or :T commands, although you might still have terminal emulation ESC sequences to deal with.)
To create an AShell command that generates "clean" stdout, you would probably have to create a CMD file wrapper for it, mainly to make sure the command gets logged in. So for example:
.TYPE CMD:FOO.CMD
;test "clean" output
:S
LOG BAS:
:R
VER
.
(In the above example, I'm using VER.LIT to output a simple one-line message; in your case it would have been RUN SOMEPROG.)
$ ashell -n -e -td dumb foo > foo.lst
$ cat foo.lst
-- A-Shell Version 6.4.1556.3 Up and Running --
$
Warning: when using the above technique for unattended commands, make sure that AShell is going to exit on its own, i.e. by specifying the -e switch or perhaps we should have added an explicit HOST to the CMD file. Otherwise the session may end up in a sort of limbo, without you being able to see what the problem is.As you can hopefully see, the ashell command didn't output anything to the screen (the stdout being redirected), and the foo.lst is "clean", i.e. devoid of any initial startup command or other AShell administrative output junk.
So it might have been that you could have worked around the problem by just adding
-td dumb, or maybe even just
-q to the command line.
But it was probably a good exercise to modernize those old programs anyway!
Thanks for the interesting post.