Question on getopt()

levy at ttrdc.UUCP levy at ttrdc.UUCP
Tue Jul 22 08:36:23 AEST 1986


In article <14935 at ucbvax.BERKELEY.EDU>, kos at ernie.Berkeley.EDU (Joshua Kosman) writes:
>Anybody know an easy way to intercept, suppress or otherwise get rid of the
>error message that getopt() issues when user supplies an illegal flag?
>It seems uncharacteristically presumptuous -- I'll write my own "Usage:"
>messages myself, thanks.
>	Joshua Kosman

     GETOPT(3C)		       UNIX System V		    GETOPT(3C)
     ...
	  extern int optind, opterr;
     ...
     DIAGNOSTICS
	  Getopt prints	an error message on stderr and returns a
	  question mark	(?) when it encounters an option letter	not
	  included in optstring.  This error message may be disabled
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	  by setting opterr to a non-zero value.
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     ...
Please, read the man page.  (Note too that getopt(3) NEVER generates Usage:
messages.)  This message would have been mailed except I am not sure
how to send mail to kos at ernie.Berkeley.EDU.
-- 
 -------------------------------    Disclaimer:  The views contained herein are
|       dan levy | yvel nad      |  my own and are not at all those of my em-
|         an engihacker @        |  ployer or the administrator of any computer
| at&t computer systems division |  upon which I may hack.
|        skokie, illinois        |
 --------------------------------   Path: ..!{akgua,homxb,ihnp4,ltuxa,mvuxa,
	   go for it!  			allegra,ulysses,vax135}!ttrdc!levy



More information about the Comp.lang.c mailing list