[Nagiosplug-devel] nagios-plugins.ini & argument parsing

Thomas Guyot-Sionnest dermoth at aei.ca
Sat Mar 15 01:01:16 CET 2008

Hash: SHA1


This morning I was looking at the work needed to add ini parsing to the
C Nagios plugins. While looking at the C and Perl code I was stumbled to
see that is can pass the argument list back to the argument parser as a
straight space-separated list (I believe the perl module pass it as an
array with the arguments already cleaned-up in case the caller wants a
string, while the C library always returns a string).

It wasn't hard to write arguments that showed differently depending on
whenever they were specified in the ini file or in the command line and
I personally believe trying to fix that will be a never-ending fight. Is
there any reason not to always use an array?

So my suggestion is:

1. Make Nagios::Plugin::Getopt::_cmdline always return an array and stop
cleaning up the arguments (maybe renaming that internal function for
clarity would be good too).

2. Do something similar for parse_ini.c. I'm not an expert, but I guess
 the best way would be to pass a linked list from the ini parser to the
argument parser (not yet written), and then the argument parser can
build a replacement array that can be processed by process_arguments.

Ideally the C plugins should have a library that do all the work behind
the scenes like Nagios::Plugins, but in the mean time it would be nice
to have ini file support.

Any objection / suggestion / comment?

Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


More information about the Devel mailing list