command line options

Guy Harris guy at gorodish.Sun.COM
Sat Apr 9 08:37:19 AEST 1988


> You miss the point; -? already has the desired property; it does not
> have to be explicitly added to every application.

That's news to me; if you're talking about the "getopt()" subroutine, you must
be talking about an implementation other than the System V Release 3.1
implementation, because that one sure doesn't cons up a usage message for you
if you provide the '-?' option.

In fact, I can't see how it *can* cons up a complete usage message; the best it
can do is tell you what options it expects - it can't tell you that it expects
two file names, a number from 1 to 10, and the air speed of a laden swallow.
While the code to *recognize* '-?' doesn't have to be explicitly added to every
application using "getopt()", the code to respond to it and print a usage
message does.

> I'm sorry if you choose to use a shell that makes this too difficult to type.

Relying on the Bourne/Korn shell not expanding some string containing a
pattern-matching metacharacter because you "know" there are no files that match
that string is dangerous (although I do it anyway...).  You may someday find
that there *is* such a file.



More information about the Comp.lang.c mailing list