getopt(3) posting FLAME

BALDWIN mike at whuxl.UUCP
Sun Oct 27 04:21:33 AEST 1985


> > Incidentally, I strongly object to both the eventual enforcement
> > of rule 6 in getopt(3c),
> 
> What is rule 6?

Hello Peter, did you read your followups in net.sources.bugs?  AGAIN,
here is Rule 6 of the Proposed Syntax Standard for UNIX System Commands:

	The first option-argument following an option must
	be preceded by white space.

Now, is this clear?  This means that if you have -o with an argument, say
foo, you have to have a space between -o and foo.  Also, Rule 5 says that
options with no arguments can be grouped together, implying that options
*with* arguments have to stand alone.  Now, using this Proposed Syntax,
you'd have to say "sort -bf -t x" instead of "sort -bftx".

But now READ CAREFULLY:  THIS IS THE PROPOSED SYNTAX, NOT THE CURRENT
BEHAVIOUR OF GETOPT(3C).  Getopt(3C) does *NOT* currently enforce Rule 6
or the strict Rule 5, so "sort -bftx" works with getopt(3C).  It has been
threatened that getopt will enforce these eventually, but I strongly
disagree with that action.  It should be left the way it is, but the
documentation needs to be cleaned up (optind and opterr are documented
wrong, and optopt isn't documented [why is it an int and not a char?]).
-- 
						Michael Baldwin
						{at&t}!whuxl!mike



More information about the Comp.unix mailing list