Command Line Processing


When a processor is invoked it will be from an interactive or batch
shell of some kind. A command line
will be used to specify the name of the processor and any inputs that it
needs. A few typical Unix command lines are:
cc -o fred.exe fred.c
vi fred.c
rlogin prep.ai.mit.edu -l rms
Note that a pipe command such as:
format doc.troff | lpr -Plaser
consists of two command lines because two programs are invoked.
In these examples various options are given to some of the tools via the
command line. For example, -o fred.exe specifies that the output
file of the C compilation should be called fred.exe rather than
the default a.out . A major part of the job of a command line
interface is to provide mechanisms for specifying which options are
legal and allowing the processor to find out which ones the user
actually supplied.
Other information can be provided on the command line in the form of
positional parameters.
For example, fred.c in the first two examples and
prep.ai.mit.edu in the last are positional parameters. A
command line interface is also responsible for providing access to
positional parameters.
Unix provides access to the components of the command line for C
programs via the argc and argv
parameters to the main function. The facility described in this
manual uses those parameters to provide higher-level access.


|