Your Standards for Command-Line Swit - (nf)

rcj at burl.UUCP rcj at burl.UUCP
Thu May 26 20:30:31 AEST 1983

One very big problem with 'getopt', however, is its inability
to handle switches with optional arguments -- I wrote an assembler
that will create a 'parameter' (microcode debugging) file on request
from the command line.  I wanted to parse '-p' as a request for
a parameter file entitled au.<infile>.p, where <infile> represents
the name of the file being assembled.  Then, I wanted to interpret
'-p filename' as a request for a parameter file entitled 'filename'.
There were about 3 other files that I wanted to do the same thing
with -- default a name based on the name of the file being assembled
unless the user specified his own name; in which case I would use his
instead.  'getopt', however, will accept only "p" or "p:" (switch without
argument or switch with argument) for parsing purposes.  So I ended up
using capital letter switches for those having arguments and lower case
for stand-alone switches.  This seems to be a reasonable standard, but
now my getopt string looks like this:


and the user is faced with a lot more crap when he tries to figure out
how to use the thing.

Does anyone ever think about human engineering anymore?  Sigh,

The MAD Programmer -- 919-228-3814 (Cornet 291)
alias: Curtis Jackson	...![ floyd sb1 mhuxv ]!burl!rcj

More information about the Comp.lang.c mailing list