|
|
*
|
|
parsing command line arguments is a common part of
Unix programs, and its a rather boring programming
task
we would like to have an automatic way of parsing
command lines, a single procedure that we could call
that would handle this for us
as a design exercise we will produce a command line
parsing module, this module isn't complete, but is
usable as it is, and can easily be expanded
we start by examining the basic problem of command
line arguments, this problem is complicated by the
fact that several different syntax's have been used for
Unix programs
Most arguments consist of a flag that identifies the
argument and a value for the argument
the flag usually consists of a prefix character, such as
a + or -, that separates flags from file names, and
then one or more characters that form the flag itself
At this point we need to make a decision, if we
restrict flags to one character, then we can string
several flags together behind one prefix character,
this only works if the corresponding arguments are
Boolean, and thus don't need a value
|
|