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