command line arguments
John Quarterman
jsq at ut-sally.UUCP
Tue Jul 2 02:16:37 AEST 1985
From: John Quarterman (moderator) <ut-sally!std-unix>
Topic: getopt (command line arguments)
The previous posting about standardization of command line options
produced several comments about getopt, one of which I have already
posted. I've picked out new information from the others and included
them here, after an excerpt from the original posting.
If your mail isn't excerpted here, it's not that I'm ignoring you: it's
merely that either yours duplicated what earlier mail had already said,
or it was mailed to ut-sally!jsq rather than ut-sally!std-unix
and I haven't gotten confirmation, or it never got to me.
----------------------------------------------------------------------
Date: Thu, 27 Jun 85 18:08:26 bst
From: Douglas Spencer <seismo!mcvax!daisy!maugg>
Subject: Re: mod.std.unix created
To: ut-sally!jsq
> some commands take arguments as
>
> command -abcdefg filename
>
> and some as
>
> command -a -b -c -d -e -f -g filename
>
> It would be great if this was standardised.
------------------------------
Date: Sat, 29 Jun 85 08:42:41 edt
From: Marty Shannon <seismo!allegra!eagle!mjs>
Subject: Re: command line arguments
To: ut-sally!jsq
Perhaps this should really be a followup rather than a reply, but there is a
fairly strong move to standardize command argument parsing by using the getopt
routine. It deals quite well with the problem, as well as providing a great
deal of flexibility.
Marty Shannon
UUCP: ihnp4!eagle!mjs
Phone: +1 201 522 6063
[ Someone else notes in mail that the AT&T command line argument standard
is included in the System V Interface Definition, page 343 of the Spring
1985 edition, and getopt conforms to this standard. -mod]
------------------------------
Date: 29 Jun 85 23:49:35 CDT (Sat)
From: Henry Spencer <ihnp4!utzoo!henry>
Subject: Re: command line arguments
To: ihnp4!ut-sally!std-unix
There is an AT&T standard for command argument syntax, and the getopt(3)
parser which encourages its use. (Incidentally, the standard says that
both (for example) "ls -al" and "ls -a -l" are legit.) AT&T has published
its own getopt() sources to encourage use of getopt, and there is also
an explicitly public-domain implementation that was published on the net
some time ago (by me).
[ I find the following articles in net.sources about getopt:
>From: henry at utzoo.UUCP (Henry Spencer)
Subject: public-domain getopt
Message-ID: <3745 at utzoo.UUCP>
Date: Thu, 12-Apr-84 16:41:58 CST
>From: hansen at pegasus.UUCP (Tony L. Hansen)
Subject: Re: public domain getopt
Message-ID: <1253 at pegasus.UUCP>
Date: Tue, 1-May-84 09:54:16 CDT
>From: henry at utzoo.UUCP (Henry Spencer)
Subject: minor bug in public-domain getopt
Message-ID: <4188 at utzoo.UUCP>
Date: Tue, 7-Aug-84 15:31:16 CDT
>From: keith at seismo.UUCP (Keith Bostic)
Subject: public domain getopt(3)
Message-ID: <3360 at seismo.UUCP>
Date: Fri, 24-Aug-84 07:54:08 CDT
The first one is Henry's code, the next two are bug fixes to that,
and the last one is a reimplementation by Keith Bostic. -mod ]
Here at utzoo, most any time that we do significant work on a Bell program,
we retrofit it with getopt unless its established syntax is seriously
incompatible with this. And of course all our own code uses it. Getopt
and its syntax have some defects, but uniformity is such a huge win that
it's overwhelmingly worth it.
Henry Spencer @ U of Toronto Zoology
{allegra,ihnp4,linus,decvax}!utzoo!henry
------------------------------
Date: Sun, 30 Jun 85 01:00 EDT
From: George M. Weaver <ihnp4!psuvax1!GMW at PSUVM.BITNET>
Subject: Re: command line arguments
To: ut-sally!std-unix
Frank da Cruz's new C-Kermit adopts a set of command line argument
standards that are worth looking at. He outlines them briefly, and gives
credit to their creators in the Kermit User Manual, part of which I've
included here (without permission -- hope you don't mind, Frank).
===============================================================================
The C-Kermit command line syntax has been changed from that of earlier releases
of Unix Kermit to conform to the "Proposed Syntax Standards for Unix System
Commands" put forth by Kathy Hemenway and Helene Armitage of AT&T Bell
Laboratories in Unix/World, Vol.1, No.3, 1984. The rules that apply are:
- Command names must be between 2 and 9 characters ("kermit" is 6).
- Command names must include lower case letters and digits only.
- An option name is a single character.
- Options are delimited by '-'.
- Options with no arguments may be grouped (bundled) behind one
delimiter.
- Option-arguments cannot be optional.
- Arguments immediately follow options, separated by whitespace.
- The order of options does not matter.
- '-' preceded and followed by whitespace means standard input.
A group of bundled options may end with an option that has an argument.
===============================================================================
George M. Weaver
Penn State Astronomy Dept.
GMW at PSUVM.BITNET
...!allegra!psuvax1!gmw at psuvm.bitnet
------------------------------
The moderated newsgroup mod.std.unix is for discussions of UNIX standards,
in particular the one in progress by the IEEE P1003 "UNIX Standards" Committee.
Please mail submissions to mod.std.unix to ut-sally!std-unix,
and comments about the newsgroup to ut-sally!std-unix-request.
Permission for posting to the newsgroup is assumed for mail
to the former address, but mail to the latter address will
not be posted unless explicit permission is included, or obtained
by later negotiation. Mail to ut-sally!jsq concerning mod.std.unix
will be treated like mail to ut-sally!std-unix-request.
--
John Quarterman, jsq at ut-sally.ARPA, {ihnp4,seismo,ctvax}!ut-sally!jsq
More information about the Mod.std.unix
mailing list