xref: /dflybsd-src/usr.bin/getopt/README (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
186d7f5d3SJohn Marino/***** unido:mod.std.unix / ut-sally!jsq /  8:54 pm  Jul  4, 1985*/
286d7f5d3SJohn MarinoFrom: John Quarterman (moderator) <ut-sally!std-unix>
386d7f5d3SJohn Marino
486d7f5d3SJohn MarinoTopic: yet more on getopt (command line arguments)
586d7f5d3SJohn Marino
686d7f5d3SJohn MarinoTwo more messages, the first a followup to a previous posting, and
786d7f5d3SJohn Marinothe second public domain sources and man pages for getopt(3) and getopt(1).
886d7f5d3SJohn Marino	-mod
986d7f5d3SJohn Marino
1086d7f5d3SJohn Marino----------------------------------------------------------------------
1186d7f5d3SJohn Marino
1286d7f5d3SJohn MarinoFrom: ihnp4!utzoo!henry
1386d7f5d3SJohn MarinoDate: 3 Jul 85 18:34:41 CDT (Wed)
1486d7f5d3SJohn MarinoTo: ihnp4!ut-sally!std-unix
1586d7f5d3SJohn MarinoSubject: Re: command line arguments
1686d7f5d3SJohn Marino
1786d7f5d3SJohn Marino> > A group of bundled options may end with an option that has an argument.
1886d7f5d3SJohn Marino>
1986d7f5d3SJohn Marino> This creates confusion in using C-Kermit when you want to send an image
2086d7f5d3SJohn Marino> file.  For example:
2186d7f5d3SJohn Marino>
2286d7f5d3SJohn Marino> 	send -is filename     < ---  works fine
2386d7f5d3SJohn Marino>         send -si filename     < ---  bombs the program
2486d7f5d3SJohn Marino
2586d7f5d3SJohn MarinoThe AT&T syntax standard (which getopt does not completely enforce)
2686d7f5d3SJohn Marinoactually forbids both of these usages.  Options with arguments are not
2786d7f5d3SJohn Marinoallowed to be bundled, and they must be separated from their arguments
2886d7f5d3SJohn Marinoby a space.
2986d7f5d3SJohn Marino
3086d7f5d3SJohn Marino> I would *much* prefer to bundle the flags, then
3186d7f5d3SJohn Marino> have those with arguments pick them up in the same order as the flags are
3286d7f5d3SJohn Marino> listed.
3386d7f5d3SJohn Marino
3486d7f5d3SJohn MarinoThe few existing commands that use such a convention, notably tar(1), are
3586d7f5d3SJohn Marino(in my experience) the worse for it.  It's seriously error-prone.  I think
3686d7f5d3SJohn Marinothe AT&T people did the right thing.
3786d7f5d3SJohn Marino
3886d7f5d3SJohn Marino------------------------------
3986d7f5d3SJohn Marino
4086d7f5d3SJohn MarinoDate: Tue, 2 Jul 85 13:07:09 edt
4186d7f5d3SJohn MarinoFrom: ihnp4!utcs!ian (Ian F. Darwin)
4286d7f5d3SJohn MarinoTo: ihnp4!ut-sally!jsq@tzec.UTEXAS.ARPA
4386d7f5d3SJohn MarinoSubject: here is getopt
4486d7f5d3SJohn Marino
4586d7f5d3SJohn MarinoHere is the source for getopt(3), the function that should be in
4686d7f5d3SJohn Marinoeverybody's C program, and getopt(1), a program that uses it to
4786d7f5d3SJohn Marinomake shell programs comprehensible and consistent. There are man
4886d7f5d3SJohn Marinopages for both. Please send these on to the mod. group. Thanks.
4986d7f5d3SJohn Marino
5086d7f5d3SJohn Marino[ I have hacked the following shell script slightly so that
5186d7f5d3SJohn Marinoit doesn't extract directly into system source directories,
5286d7f5d3SJohn Marinorather into the current directory.  It should be assumed that
5386d7f5d3SJohn Marinothis code comes with no warranty from me, Ian Darwin, or anyone
5486d7f5d3SJohn Marinoelse as to whether it accurately represents getopt as distributed
5586d7f5d3SJohn Marinowith System V, or any command line standard, or that it works
5686d7f5d3SJohn Marinoat all, or that it will cause no damage when extracted or used. -mod]
5786d7f5d3SJohn Marino
58