From a command processor

One can run stedi from a command processor by typing its name followed by a number of file names. Stedi can read up to eight files during startup. There is also the possibility to tell stedi where to find its default file, its help file and the user defined macro's. If the first parameter given to stedi is -d (or -D), then the next parameter is interpreted as the name of a directory. Stedi will make this directory its default directory and look there for its default file, its help file and macro's when the user wants to execute them. Hence the command

    ~\bin\stedi -d ~\bin foo.c bar.c
will start a copy of stedi which is found in the directory ~\bin, and the -d parameter along with the following path name informs stedi that it can also find its default file, its help file and the macro's there. Finally the command instructs stedi to read the files foo.c and bar.c for editing. The file foo.c will be put in buffer 1 and the file bar.c will be put in buffer 2. In most shells this can be done simply by defining the alias
    alias e "~\bin\stedi -d ~\bin"
After this, one may call stedi via the command
    e foo.c bar.c
This command accomplishes exactly the same task as the command above that was fully written out. On MS-DOS one would include the directory ~\bin\ in the path variable in the file autoexec.bat, after which one would accomplish the above with:
    stedi -d ~\bin foo.c bar.c
UNIX-like systems would have a similar statement in a `login' or `resource' file. The above is still not very handy. Therefore stedi will also recognize several variables in the environment. They are:
STEDIDFT
This variable indicates the path of the directory where the default file can be found.
STEDIHLP
This variable indicates the path of the directory where the help file can be found.
STEDIMAC
This variable indicates the path of the directory where the macro's can be found.
On MS-DOS these environment variables can be set in the file autoexec.bat with the statements:
    set STEDIDFT=C:\BIN\
    set STEDIHLP=C:\BIN\
    set STEDIMAC=C:\BIN\
For UNIX-like systems or shells one specifies such variables usually in a login script or a resource script (.cshrc for the c-shell). One should use the setenv command for this.

The complete set of command line options is:

-d
This option must be the first parameter. The next parameter is then interpreted as a path name. In this path stedi will look for the default file stedi.dft and -if needed- for the help file stedi.hlp. Also macro's are taken from this directory when needed. See also the more extensive description above.
-i or -x
The parameter after the -i parameter is interpreted as the name of a macro. This macro is read and all parameters after the name of the macro are passed as arguments to the macro. The macro will be automatically executed and after the execution buffer 1 is saved and execution is halted. This is called stream editing. It is used to modify a file according to a fixed set of predetermined rules. See also the chapters on stream editing p. [*] and macro's p. [*].
-r
The file following this parameter is read in the `raw' mode. In this mode there is no interpretation of linefeeds or tabs. See also the part on write modes p. [*]
-v
The file following this parameter is read in the `view only' mode. This prevents the accidental change of an output file that is read into stedi for viewing.
-#
When # is a number the file following this option is read and its current line will become the line indicated by the given number. When the number is greater than the number of lines in the file the cursor is placed in the last line of the text.
+#
The file following this option is read from the byte position indicated by the number. The first indicated number of bytes is skipped.

All above parameters can be given either in upper case or in lower case. The r, v and line number options can be combined. Each option must still be preceded by its own minus sign, but several of such parameters may be given before the actual file name is given. Example:

stedi -d ~/bin foo.c -v -800 bar.c -i action
This command starts stedi, stedi will look in /bin for its default file, put the file foo.c in buffer 1, the file bar.c is put in buffer 2 and buffer 2 is put in the `view only' mode while the cursor is put at line 800. The file action.mac is looked for and if found it is executed as a regular macro.

It is allowed to use so called wildcard characters in the names of the files that should be read by stedi. The full pattern is given to the local file system and each successive match is read into a separate buffer until either there are no more matches, or all 8 buffers have been filled. If there were options specified they apply to all files that are read in with this pattern. If a pattern is used for the name of a macro it will not be interpreted and the results can be unpredictable. The order in which the files match the pattern depends on the file system. Some systems give a purely lexicographic order, while MS-DOS and GEMDOS like to use the order in which the files appear in the directory on the disk which is at first the order in which they were written to disk, but after the directory has been used intensively the order can be quasi random.

When using the environment to define default directories there is no need to have the three variables to point at the same directory. If both the environment has been set and the -d option is used, the -d option takes precedence (most likely it has been typed by hand so it should override the defaults). In all cases stedi will first look in the current directory for any of the files it needs, whatever the default settings. The rationale behind this is that a local file is usually project bound and should be preferred. This can avoid very nasty surprises.

Finally something more about the environment. When variables are used (for instance in macro's) and the user specifies a variable that was neither defined before, nor a predefined variable stedi will search the environment for this variable. This search is done case insensitive. If the variable is found in the environment its contents are returned. If the variable doesn't occur in the environment the message variable is undefined is given. See also the chapter on macro's p. [*].