A-Shell CGI Command Line

The main action of the shell script or BAT file is to launch A-Shell with a specific set of command line arguments. (The main reason we couldn’t do this directly from the HTML page is that the FORM ACTION statement doesn’t permit command line arguments.) The –cgi switch tells A-Shell to operate in "CGI mode". The –e switch tells A-Shell to exit as soon as it returns to the dot prompt after executing the command. (This would not be necessary if we make sure to execute HOST.LIT after completing the CGI process.) In the Windows version of the command line, we also need the –z switch to prevent A-Shell from displaying a window on the web-server (where no one could see it, and where it might cause the process to abort with an error). After the switches we pass the startup command cgicmd which in this case refers to a CMD file (cmd:cgicmd.cmd).

The windows version of the command requires the @ in front to prevent the BAT file processor from echoing the command line to stdout, which would cause it to appear in the web page (or cause the web page to be rejected).

Under UNIX, we recommend redirecting stderr (built-in file descriptor 2) to a file, which is accomplished via the 2>/tmp/cgi.err Since the –cgi switch causes ordinary PRINT statements to be sent to stderr instead of stdout, this will not only allow for easy debugging but also prevent inadvertent PRINT statements from corrupting the web page that the CGI process is supposed to create on the stdout stream.

Under Windows, the redirection of stderr to a file is harmless, but also useless and unnecessary, since in Windows, PRINT statements do not generate stream output. Instead, they get rendered graphically in the window, which was made invisible by the –z switch. If you want to output debugging messages, you'll have to explicitly write them to a file.