Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!decvax!microsof!uw-beaver!cornell!vax135!ariel!houti!hogpc!houxm!hocda!spanky!burl!rcj
From: rcj@burl.UUCP
Newsgroups: net.lang.c
Subject: Re: Your Standards for Command-Line Swit - (nf)
Message-ID: <165@burl.UUCP>
Date: Thu, 26-May-83 06:30:31 EDT
Article-I.D.: burl.165
Posted: Thu May 26 06:30:31 1983
Date-Received: Sat, 28-May-83 16:38:44 EDT
References: <502@rlgvax.UUCP>
Lines: 26
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..p, where 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:
"bB:delL:mM:pP:"
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