From owner-freebsd-stable Fri Apr 24 07:33:30 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id HAA08977 for freebsd-stable-outgoing; Fri, 24 Apr 1998 07:33:30 -0700 (PDT) (envelope-from owner-freebsd-stable@FreeBSD.ORG) Received: from spinner.netplex.com.au (spinner.netplex.com.au [202.12.86.3]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id HAA08970; Fri, 24 Apr 1998 07:33:18 -0700 (PDT) (envelope-from peter@netplex.com.au) Received: from spinner.netplex.com.au (localhost [127.0.0.1]) by spinner.netplex.com.au (8.8.8/8.8.8/Spinner) with ESMTP id WAA14634; Fri, 24 Apr 1998 22:32:49 +0800 (WST) (envelope-from peter@spinner.netplex.com.au) Message-Id: <199804241432.WAA14634@spinner.netplex.com.au> X-Mailer: exmh version 2.0.2 2/24/98 To: dag-erli@ifi.uio.no (Dag-Erling Coidan =?iso-8859-1?Q?Sm=F8rgrav?= ) cc: current@FreeBSD.ORG, stable@FreeBSD.ORG Subject: Re: ls In-reply-to: Your message of "24 Apr 1998 12:44:11 +0200." Date: Fri, 24 Apr 1998 22:32:47 +0800 From: Peter Wemm Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk Dag-Erling Coidan =?iso-8859-1?Q?Sm=F8rgrav?= wrote: > current's ls now accepts three new options: > > -? Display a short list of options (this was already in the code, but > was left out from the call to getopt) Umm.. getopt() cannot have a ? option. It's what it returns if it doesn't recognize the given arg. while ((c = getopt("abc")) != 1) { switch (c) { case 'a': .. case 'b': .. case 'c': .. case '?': warnx("unknown option '%c' supplied", optopt); usage(); default: warnx("unknown return from getopt()"); ... } } So, "default" is normally a programming error - ie: a character is supplied in the optstring but not handled in the switch statement. "?" is what getopt returns when the user supplies an arg that is not known to getopt at all. I'd suggest removing the '?' from the optstring again.. 'some_cmd -?' will always return '?' from getopt() (by definition), regardless of whether it is listed or not. Cheers, -Peter -- Peter Wemm Netplex Consulting To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message