bug-gnulib
[Top][All Lists]
Advanced

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

getopt: checking exlusive options?


From: Bernhard Voelker
Subject: getopt: checking exlusive options?
Date: Tue, 23 Jul 2013 17:55:29 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5

Is there already something available in gnulib like
err_exclusive_options() in util-linux [1] to automatically
catch mutual exclusiveness of options inside the getopt loop?

This approach is quite nice for basic checking.
Of course, things can easily become more complicated, when you want
to issue custom messages, or issue a warning instead of an error
(e.g. "warning: '-x' overriding '-y' option"), or when such
exclusiveness depends on an option's value, etc.

Okay, there is the "gengetopt" project [2], but this doesn't
seem to be ideal for simplifying existing code.

[1] 
http://git.kernel.org/?p=utils/util-linux/util-linux.git;a=blob;f=include/optutils.h
[2] http://www.gnu.org/software/gengetopt/

Have a nice day,
Berny



reply via email to

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