From owner-freebsd-chat Fri May 17 07:51:57 1996 Return-Path: owner-chat Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id HAA22112 for chat-outgoing; Fri, 17 May 1996 07:51:57 -0700 (PDT) Received: from irz301.inf.tu-dresden.de (irz301.inf.tu-dresden.de [141.76.1.11]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id HAA22056 for ; Fri, 17 May 1996 07:51:38 -0700 (PDT) Received: from sax.sax.de by irz301.inf.tu-dresden.de (8.6.12/8.6.12-s1) with ESMTP id QAA28346; Fri, 17 May 1996 16:51:28 +0200 Received: by sax.sax.de (8.6.12/8.6.12-s1) with UUCP id QAA00474; Fri, 17 May 1996 16:51:15 +0200 Received: (from j@localhost) by uriah.heep.sax.de (8.7.5/8.6.9) id QAA06574; Fri, 17 May 1996 16:19:07 +0200 (MET DST) From: J Wunsch Message-Id: <199605171419.QAA06574@uriah.heep.sax.de> Subject: Re: SYSV, *BSD, and getopt(3) To: rnordier@iafrica.com (Robert Nordier) Date: Fri, 17 May 1996 16:19:07 +0200 (MET DST) Cc: chat@FreeBSD.ORG In-Reply-To: <199605162349.BAA00727@eac.iafrica.com> from Robert Nordier at "May 17, 96 01:49:01 am" X-Phone: +49-351-2012 669 X-PGP-Fingerprint: DC 47 E6 E4 FF A6 E9 8F 93 21 E0 7D F9 12 D6 4E X-Mailer: ELM [version 2.4ME+ PL17 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-chat@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk 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. ;-)