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: Tim Post
Subject: Re: [help-gengetopt] override and multiple options
Date: Sat, 13 Dec 2008 08:12:42 +0800

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).


Cheers,
--Tim





reply via email to

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