command line options

Brandon Allbery allbery at ncoast.UUCP
Mon Apr 18 05:26:31 AEST 1988


As quoted from <143 at gsg.UUCP> by lew at gsg.UUCP (Paul Lew):
+---------------
| In article <7628 at brl-smoke.ARPA>, gwyn at brl-smoke.ARPA (Doug Gwyn ) writes:
| > Under the existing getopts scheme, typing
| > 	command -?
| > is guaranteed to get the usage message.
| 
| Why use '?' character?  I especially hate to type: command '-?' to avoid
| '?' to be expanded by shell.  In Bourne shell, if you dont have any file
+---------------

(1) To the person who couldn't find "getopts" in the manual:  it's "getopt",
without the "s".  Try "man 3 getopt" -- if Berkeley got around to putting it
into libc, that is.

(2) The point is not that "-?" is magic, it's that any unknown option will
elicit a usage message.  I personally use "-." to get the usage message, since
I have yet to see a program which uses "-." as an option.  Whereas some programs
*do* use -H (System V /bin/who, for instance).
-- 
	      Brandon S. Allbery, moderator of comp.sources.misc
	{well!hoptoad,uunet!marque,cbosgd,sun!mandrill}!ncoast!allbery
Delphi: ALLBERY						     MCI Mail: BALLBERY



More information about the Comp.lang.c mailing list