Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 May 1996 16:19:07 +0200 (MET DST)
From:      J Wunsch <j@uriah.heep.sax.de>
To:        rnordier@iafrica.com (Robert Nordier)
Cc:        chat@FreeBSD.ORG
Subject:   Re: SYSV, *BSD, and getopt(3)
Message-ID:  <199605171419.QAA06574@uriah.heep.sax.de>
In-Reply-To: <199605162349.BAA00727@eac.iafrica.com> from Robert Nordier at "May 17, 96 01:49:01 am"

next in thread | previous in thread | raw e-mail | index | archive | help
As Robert Nordier wrote:

> The System V (original?) approach has always been to run through all
> the options before calling a halt with a usage() message:
> 
>    SYSV$ grep -az
>    grep: illegal option -- a
>    grep: illegal option -- z
>    usage: grep [...]

>       while ((c = getopt(argc, argv, "abc")) != -1)
>          switch (c) {
>          case 'a':
>             /* ... */
> 	    break;
>          default:
> 	    err++;
>          }
>       if (err)
>          usage();

Except that the variable is called ``errs'' :), this is exactly what
i'm doing in my code as well.

-- 
cheers, J"org

joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199605171419.QAA06574>