Date: Wed, 19 Mar 1997 14:26:16 -0700 (MST) From: Softweyr LLC <softweyr@xmission.com> To: un_x@hotmail.com (steve howe) Cc: questions@freebsd.org Subject: Re: getopts Message-ID: <199703192126.OAA05728@xmission.xmission.com> In-Reply-To: <199703190401.UAA12739@f12.hotmail.com> from "steve howe" at Mar 18, 97 08:01:57 pm
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199703192126.OAA05728>
