[getopt-sig] ANNOUNCE: Optik 1.3 released

Matthias Urlichs smurf@noris.de
Sun, 14 Apr 2002 03:35:39 +0200


Hi,

David Goodger:
> If optional option arguments were allowed, this case would be ambiguous.  To
> resolve it you'd have to specify that the "optional option argument options"
> are "greedy" (they try to take an argument first), or "non-greedy" (try to
> match options first).  But what if you then want to pass an option argument
> which begins with a hyphen, like a file named "-dash.txt"?  Doesn't work.
> 
The usual way to resolve this problem is to require that optional option
arguments follow their option letter directly:

-ffilename  or --file=filename   ## option with argument
-f -g       or --file -g         ## two options without argument
-f filename or --file filename   ## one option and one unrelated
                                 ##    non-option argument

So, no ambiguity there: whether the argument's named "filename" or "-foobar"
doesn't matter (except in the third example, of course, but that's hardly
news).
-- 
Matthias Urlichs     |     noris network AG     |     http://smurf.noris.de/