1*86d7f5d3SJohn Marino/***** unido:mod.std.unix / ut-sally!jsq / 8:54 pm Jul 4, 1985*/ 2*86d7f5d3SJohn MarinoFrom: John Quarterman (moderator) <ut-sally!std-unix> 3*86d7f5d3SJohn Marino 4*86d7f5d3SJohn MarinoTopic: yet more on getopt (command line arguments) 5*86d7f5d3SJohn Marino 6*86d7f5d3SJohn MarinoTwo more messages, the first a followup to a previous posting, and 7*86d7f5d3SJohn Marinothe second public domain sources and man pages for getopt(3) and getopt(1). 8*86d7f5d3SJohn Marino -mod 9*86d7f5d3SJohn Marino 10*86d7f5d3SJohn Marino---------------------------------------------------------------------- 11*86d7f5d3SJohn Marino 12*86d7f5d3SJohn MarinoFrom: ihnp4!utzoo!henry 13*86d7f5d3SJohn MarinoDate: 3 Jul 85 18:34:41 CDT (Wed) 14*86d7f5d3SJohn MarinoTo: ihnp4!ut-sally!std-unix 15*86d7f5d3SJohn MarinoSubject: Re: command line arguments 16*86d7f5d3SJohn Marino 17*86d7f5d3SJohn Marino> > A group of bundled options may end with an option that has an argument. 18*86d7f5d3SJohn Marino> 19*86d7f5d3SJohn Marino> This creates confusion in using C-Kermit when you want to send an image 20*86d7f5d3SJohn Marino> file. For example: 21*86d7f5d3SJohn Marino> 22*86d7f5d3SJohn Marino> send -is filename < --- works fine 23*86d7f5d3SJohn Marino> send -si filename < --- bombs the program 24*86d7f5d3SJohn Marino 25*86d7f5d3SJohn MarinoThe AT&T syntax standard (which getopt does not completely enforce) 26*86d7f5d3SJohn Marinoactually forbids both of these usages. Options with arguments are not 27*86d7f5d3SJohn Marinoallowed to be bundled, and they must be separated from their arguments 28*86d7f5d3SJohn Marinoby a space. 29*86d7f5d3SJohn Marino 30*86d7f5d3SJohn Marino> I would *much* prefer to bundle the flags, then 31*86d7f5d3SJohn Marino> have those with arguments pick them up in the same order as the flags are 32*86d7f5d3SJohn Marino> listed. 33*86d7f5d3SJohn Marino 34*86d7f5d3SJohn MarinoThe few existing commands that use such a convention, notably tar(1), are 35*86d7f5d3SJohn Marino(in my experience) the worse for it. It's seriously error-prone. I think 36*86d7f5d3SJohn Marinothe AT&T people did the right thing. 37*86d7f5d3SJohn Marino 38*86d7f5d3SJohn Marino------------------------------ 39*86d7f5d3SJohn Marino 40*86d7f5d3SJohn MarinoDate: Tue, 2 Jul 85 13:07:09 edt 41*86d7f5d3SJohn MarinoFrom: ihnp4!utcs!ian (Ian F. Darwin) 42*86d7f5d3SJohn MarinoTo: ihnp4!ut-sally!jsq@tzec.UTEXAS.ARPA 43*86d7f5d3SJohn MarinoSubject: here is getopt 44*86d7f5d3SJohn Marino 45*86d7f5d3SJohn MarinoHere is the source for getopt(3), the function that should be in 46*86d7f5d3SJohn Marinoeverybody's C program, and getopt(1), a program that uses it to 47*86d7f5d3SJohn Marinomake shell programs comprehensible and consistent. There are man 48*86d7f5d3SJohn Marinopages for both. Please send these on to the mod. group. Thanks. 49*86d7f5d3SJohn Marino 50*86d7f5d3SJohn Marino[ I have hacked the following shell script slightly so that 51*86d7f5d3SJohn Marinoit doesn't extract directly into system source directories, 52*86d7f5d3SJohn Marinorather into the current directory. It should be assumed that 53*86d7f5d3SJohn Marinothis code comes with no warranty from me, Ian Darwin, or anyone 54*86d7f5d3SJohn Marinoelse as to whether it accurately represents getopt as distributed 55*86d7f5d3SJohn Marinowith System V, or any command line standard, or that it works 56*86d7f5d3SJohn Marinoat all, or that it will cause no damage when extracted or used. -mod] 57*86d7f5d3SJohn Marino 58