Question on getopt()

guy at sun.UUCP guy at sun.UUCP
Sun Jul 27 08:20:15 AEST 1986


> >      GETOPT(3C)		       UNIX System V		    GETOPT(3C)
> ...
> > 	  included in optstring.  This error message may be disabled
> >                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > 	  by setting opterr to a non-zero value.
> >           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> Not that the man page we have here (seems to be BSB 4.3) does not have the
> sentence marked with ^^^^s for a very good reason:  its not true.  Under
> 4.3 you can't suppress the messages except by rewriting getopt.

It's not true in ANY version of UNIX, System V *or* 4.3BSD.  In BOTH
versions, if you set "opterr" to *zero*, it will suppress the error messages.
Read the code, not the manual page!  The S5 page lies because it says
setting "opterr" to a non-zero value turns off error messages; the 4.3 page
doesn't indicate that setting "opterr" to zero turns off error messages.
-- 
	Guy Harris
	{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
	guy at sun.com (or guy at sun.arpa)



More information about the Comp.lang.c mailing list