help-gengetopt
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [help-gengetopt] override and multiple options


From: Lorenzo Bettini
Subject: Re: [help-gengetopt] override and multiple options
Date: Tue, 16 Dec 2008 14:19:26 +0100
User-agent: Thunderbird 2.0.0.18 (X11/20081125)

Tim Post wrote:
Hi Lorenzo,

On Fri, 2008-12-12 at 11:51 +0100, Lorenzo Bettini wrote:

For instance, the -O option can be given many times to the gcc compiler, and it will decide that only the last one is the one to apply (at least I think it is like that, in fact, in another program, I was struggling with a prebuilt command line option to the compiler that couldn't be changed and this contained -O2 which makes it hard to debug programs: I then appended -O0 and this solved the problem).

I agree with you that this should be stressed in the documentation: I hadn't written that because I gave it for granted, but that's my mistake :-)

any other in the list have opinion about this?

There are very rare times when I've used one modifier that operates on
the current optarg each time.

For instance, a program that splits its logs, taking a -L (--level)
modifier for each:

./foo -f /var/log/foo-panic.log -L3 -f /var/log/foo-normal.log -L1, etc

However, I have not seen/done this in a really long time. But, in this
case the value of the last -L passed modifies only the behavior of the
previous -F option. The kludge needed to make this sane is ugly, I'm not
sure why someone would do it deliberately unless they had to match what
existed.

I would agree with what you wrote as being standard behavior (I think
POSIX has something to say about it too, I'll try to find the
reference).

Again, the current behavior lets the application deal personally with this case; while overriding multiple options would not make it possible, I guess, without using further structures to accumulate options... I think the current behavior is more flexible...

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134     (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com  http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net




reply via email to

[Prev in Thread] Current Thread [Next in Thread]