The main duty of FreeCOM is to prompt the user to enter commands, which are interpreted, processed directly by FreeCOM or executed as executable files.
Those commands processed by FreeCOM directly are called Internal Commands.
Non-internal commands, which cannot be processed by FreeCOM directly, are called External Commands, because FreeCOM will search for files equally named as typed-in.
Besides to implement certain commands FreeCOM offers some features.
If present, the first non-option argument specifies the location in which
FreeCOM resides. This location is later stored in the environment variable
COMSPEC. Since DOS3+ this option is no longer necessary to find the shell
invoked during the boot process, but it may be used to let the system boot
a primary shell from one location, but use a shell of the same version from
a different location later on.
One shallt not point to a RAMdisk at this time, because FreeCOM needs to reload
certain information relatively early during execution, before AUTOEXEC.BAT had
been executed, in which, normally, FreeCOM is copied into the RAMdisk.
For convinience FreeCOM checks, if at the given location a FreeCOM exists
and is accessable, if not, the given location is ignored.
Also, the standard requires to specify a path only, but FreeCOM accepts
an absolute filename, so accepting that FreeCOM is not necessarily named
COMMAND.COM.
The second non-option argument, if present, specifies the console FreeCOM shall enable. This setting is system-wide and is not limited to FreeCOM or just this particular process tree. In its result, this argument is identical to the CTTY command.
FreeCOM knows the following options:
FreeCOM uses a number of environment variables for its own purpose.
There are a number of automatic variables that do not follow the above mentioned syntax and which contents is automatically generated. Unlike the normal variables these automatic variables are constructed of exactly two characters, the first one is a single percent sign and the second one the variable identifier:
Because automatic variables have one percent sign only, it sometimes lead to
confusion within the FOR command, e.g. in:
CMD: SET adam=eva
CMD: FOR %a in (*.*) DO echo %adam% %a
The synopsises of the internal commands are described in a style derived from EBNF.
In interactive mode FreeCOM prompts the user to enter a command, the line is interpreted, parsed and, finally, either rejected because of an error or executed.
The first optional
The colon marks the line as label, which causes to let FreeCOM ignore the line completely as no interpretation is tried on this line, neiter are any redirections created.
The
The optional
If commands are chained with the
CMD: cmd1 | cmd2 | cmd3
forms a pipe consisting of the three individual commands
CMD: cmd1 >%TEMP%\cmd###1.tmp
CMD: cmd2 <%TEMP%\cmd###1.tmp >%TEMP%\cmd###2.tmp
CMD: cmd3 <%TEMP%\cmd###2.tmp
The files are temporary ones and will be removed as soon as they are
no longer required, meaning the tempfile #1 is removed after
Redirections tie the standard input or output stream to a file or device,
for instance: If the echo state is enabled, the user is prompted with the
PROMPT string; otherwise no visible or audible prompt is issued to
indicate an user activity request.
In either mode the ENTER key terminates the editing and
lets FreeCOM start to interprete the entered line.
The standard input mode does neither support command line
history, except the last command line in some circumstances, nor file completion.
The following keys have a special meaning:
The enhanced input mode does support command line history and
file completion. The following keys have a special meaning:
However, CVS allows branch the development of a module at some point from the
main trunk into side trees. On these branches the module can be developed further,
new features can be added etc., without disturbing the main trunk (and therefore the
primary release) of the module. When the side development proved its worthiness, the
changes are merged into the main trunk and, hence, becomes part of the primary release.
Branches are marked by tags, though, unlike normal tags branch tags automatically
evolve with the file, what means that when a file from a specific branch is updated,
the branch tag automatically move from the current version of the file to the new one.
The FreeCOM module has the following active branches:
The FreeCOM module has the following obsoleted branches:
Unless modified by above mentioned operators a sequence of tokens specifies
that each token must be present exactly one time in exactly that order.
Copyright 2000-2001 © Steffen Kaiser - current maintainer of FreeCOM
CMD: cmd arg
redirects the standard input stream of Command Line Editing
FreeCOM offers two methods to interactively enter command lines:
The first one just calls a DOS function, whereas the second one processes each
key for its own. Which method FreeCOM uses is defined at compile time.
Key
Meaning
F1
Get next character from last line, if available
F3
Get last line, if available
F5
Place current line in last-line buffer and restart editing on a blank line
F6
Insert the pseudo-character End-of-file
backspace
delete character to the left
cursor left
delete character to the left
cursor right
Get next character from last line, if available
Key
Meaning
F1
Get next character from last line, if available
F3
Get last line, if available
F5
Place current line in last-line buffer and restart editing on a blank line
backspace
delete character to the left
cursor down
Replace the current input line with the previous line from the history
cursor left
move cursor one character one position to the left
cursor right
Move cursor one position to the right; at the end of the line
get next character from last line, if available
cursor up
Replace the current input line with the next line from the history
delete
Deletes the character on the cursor
end
Moves the cursor to the end of the line
ESC
Clear current line
home
moves the cursor to the beginning of the line
insert
Switch between insert and overwrite mode
TAB
Take the current word for a file and try to complete it
^C
Clear current line and enable echo state. The echo state is
enabled to ensure the user gets to know he is on the command line of
FreeCOM rather than stuck in a non-interruptable program.
Appendix
CVS Resources
On SourceForge
a short description of how to access the CVS reository is located. Following those
instructions will download the main trunk of the specified module of the repository,
e.g.: cvs -z6 co freecom
downloads the MAIN trunk, also
called HEAD, of FreeCOM.
To check out a branch, create a new directory, change within it and execute:
cvs -z6 co -r tag freecom
, where tag is the name of the branch you
want to download. Note: It is not advisable to use the same directory to
manage files for two different branches.
Tag
Meaning
expSpawn
Module based FreeCOM, bases on expRes branch
Tag
Meaning
expRes
Resource management implementation.
Finally merged into trunk as of 2001/03/10
EBNF
Documents encode the synopsis of the commands with operators derived from
EBNF (Extended Backus-Naur Formula).
Type setting
Depending on different meanings characters are set into various shapes:
Name
Meaning
Example
terminal
characters to be enterred on command line or displayed by
the computer;EBNF: "terminal symbols"
ECHO
'string'
The quotes remove the metafunction of the enclosed characters
in order to specify EBNF operators as terminal symbols.
EBNF: "terminal symbols"
'|'
bold
operators that constructs portions together;
EBNF: "operators"
|
italian
placeholders for arguments, which are explained in the description;
EBNF: "non-terminal symbols"
varname
Operators
The EBNF uses the following operators:
Symbol
Meaning
|
alternative; use either left or right token
()
parenthizes enclose tokens limiting the range of |
[]
brackets enclose optional tokens, thus, they may appear zero or
one time; they also limit the range of |
{}
curly brackets enclose repitive tokens, which may appear one or
more times; they also limit the range of |
{ : }
as the normal curly brackets, but any repitive tokens are delimited
by the token(s) right of the colon; for instance:
{ file : '+' }
is the same as:
file [{ '+' file }]
and applies to:
« »
is a placeholder for an arbitary string of terminal symbols, which
further syntax is described by the enclosed text in English
natural language.
::=
assigns a meaning (right side) to a non-terminal symbol (left side);
for instance
DIR [ { option | filespec } ]
option ::= / ( A | B | C )
Any occurance -- only one here -- of option on the right
side of an ::= or where no ::= is present at all is
to be replaced by the right side of option::=.
Note: For the sake of clearness, spaces are inserted between tokens. These
spaces do not mean that a space is allowed at this place!
Also, the fact that no _ is present does not mean that
at this place is none allowed. It is assumed that the reader will find
the places where optional spaces are valid either by "doing" or by reading the
examples.