From owner-freebsd-questions Wed Mar 19 13:26:37 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id NAA23502 for questions-outgoing; Wed, 19 Mar 1997 13:26:37 -0800 (PST) Received: from xmission.xmission.com (softweyr@xmission.xmission.com [198.60.22.2]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id NAA23496 for ; Wed, 19 Mar 1997 13:26:34 -0800 (PST) Received: (from softweyr@localhost) by xmission.xmission.com (8.8.5/8.7.5) id OAA05728; Wed, 19 Mar 1997 14:26:24 -0700 (MST) From: Softweyr LLC Message-Id: <199703192126.OAA05728@xmission.xmission.com> Subject: Re: getopts To: un_x@hotmail.com (steve howe) Date: Wed, 19 Mar 1997 14:26:16 -0700 (MST) Cc: questions@freebsd.org In-Reply-To: <199703190401.UAA12739@f12.hotmail.com> from "steve howe" at Mar 18, 97 08:01:57 pm X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk steve howe recently stated: > (2.1.5 - sh) > - > i notice that "getopt" allows multiples of the same options. > - ie, "set `getopt -abc $*`" will allow multiple a's, b'a, or c's > forcing a script or C program to error check those conditions, > additionally eliminating valid options. > - > for example "script -abbc" will get "-a -b -b" and -c will get > trashed in the "getopt" example above. imho - getopt should bypass > and multiple options and continue with the parsing ... Huh? You've miseed something. Multiple instances of a flag are often used by programs; debugging flags are often done this way. For instance, each -d raises the debugging level by one. Fixing getopt in the manner you suggest would break these programs. Your script command above should be exactly the same as running "script -a -b -b -c"; your program is just going to have to handle this. -- "Where am I, and what am I doing in this handbasket?" Wes Peters Softweyr LLC http://www.xmission.com/~softweyr softweyr@xmission.com