Subject: Re: Switching from old-style getopt to new-style one
To: Thomas Klausner <wiz@danbala.ifoer.tuwien.ac.at>
From: Todd Vierling <tv@wasabisystems.com>
List: tech-userlevel
Date: 11/01/2000 22:31:27
On Thu, 2 Nov 2000, Thomas Klausner wrote:
: One of the major improvements this would bring is that in the
: old-style getopt, with an option string of "a:b", a call like
: program -a file file2 -b file3
: would not handle '-b' as an option; the program would get
: file2 -b file3
: as options it has to parse itself. The new-style getopt by default
: handles this command line like
: program -a file -b file2 file3
: and modifies the argv pointers so that the program gets
: file2 file3
: as remaining arguments.
This is incorrect behavior for getopt(3). The first non-option *terminates*
option parsing, and must stay that way when invoked as getopt().
A getopt(3) replacement MUST function IDENTICALLY to getopt(3) as it has
been in libc with option strings that already exist. No exceptions; this is
ABI compatibility.
--
-- Todd Vierling <tv@wasabisystems.com> * http://www.wasabisystems.com/
-- Speed, stability, security, and support. Wasabi NetBSD: Run with it.