Execute an external command

Programs may be executed from within the editor. Likewise, if the editor is being run from a shell, it is possible to execute a shell command from within the editor provided the shell is equipped for such action.

Programs or commands are executed from the command line, using the exclamation mark (!) command. The syntax is:

!progname [command tail]

With this command the editor will execute the program in the file 'progname'. A possible command tail is passed to the program in the same way as is done from a regular command shell. The environment string passed to this new program is a copy of the string that was passed to the editor when it was started up.

This command can be particularly useful when running from a floppy disk. In the cycle (1) entering the editor, (2) reading a file, (3) writing the file after editing, (4) compiling, (5) make a test run, one can save the first two steps if the steps 4 and 5 are done from the editor.

When the external program is finished, the editor will produce a bell sound (which of course cannot be heard if the sound level is set to be very low) and wait for further action. No attempt is made to give a visual prompt, as that may overwrite an error message or other precious output. After completion of the program, the editor flushes its input buffer before waiting for further action. Thus, it is quite safe to accidentally press a key while your program runs. This will not cause an immediate return to the editor upon completion of the program. It is also possible that one doesn't know whether the program has finished. Also in that case one may freely press any key without the risk of loosing a later error message.

When the program ends, hitting any key (with the exception of the status keys) will cause a return to the editor at the point where one was when the program began. A message in the message line will tell how long the execution of the program took from the moment that the control was given to either the operating system or the shell to load the program up to the moment the editor got the control back and started waiting for a key. A possible return code will also be displayed. Often compilers give a negative return code when an error was detected, but if the error messages were also written to the screen this is superfluous information. The more important messages are the ones from the operating system that may indicate problems such as lack of memory or that the file was not found. These errors are presented in text format while all other errors - mostly user defined - are given by number.

Sometimes the user may not like it that stedi waits for the pressing of a key upon completion of a program. In that case he can use a variation of the ! command in which the ! is followed by a - sign. The minus sign indicates that there will be no waiting. It is also possible to set a flag that indicates to stedi that there should never be any waiting. This is done with the command

    set waitflag = off
When the wait flag is off one may issue a command that waits anyhow by putting a + sign after the !. The wait flag can be turned on again with the command
    set waitflag = on
To see what the contents of the wait flag are one may use the command

show waitflag



Subsections