Subject: Re: Switching from old-style getopt to new-style one
To: Thomas Klausner <wiz@danbala.ifoer.tuwien.ac.at>
From: Chris G. Demetriou <cgd@sibyte.com>
List: tech-userlevel
Date: 11/01/2000 18:58:59
wiz@danbala.ifoer.tuwien.ac.at (Thomas Klausner) writes:
> 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.

Uh, as far as I know and am concerned, that is _not_ the correct
behaviour for most programs.

for instance, the syntax for 'cat' is:

     cat [-benstuv] [-] [file ...]

and that's as it has historically been (modulo additional options,
etc.)

If you specify a file name, that is the end of option parsing, period.

I don't think the new behaviour you describe should be the default for
_any_ existing program in our source tree, unless you can provide some
documentation (e.g. a standard like POSIX.2 or one of the X/Open ones)
that mandates it.


cgd