kjb_getopts - Gets the next command option in GNU getopt style
Example compile flags (system dependent):
-DLINUX_X86_64 -DLINUX_X86_64_OPTERON -DGNU_COMPILER
-lKJB -lfftw3 -lgsl -lgslcblas -ljpeg -lSVM -lstdc++ -lpthread -lSLATEC -lg2c -lacml -lacml_mv -lblas -lg2c -lncursesw
const char *opt_str,
const struct Option *long_options,
This routine is an interface to copy of GNU getopt_long_only. Because we copy
the code, the option handling is consistent even on systems that do not have
getopt(3), or a different style of it. More bout this style can be found
man -S 3 getopt_long_only
Each call to kjb_getopts() parses some of argv. When all are dealt with,
then EOF is returned. On error, this routine returns ERROR, with an error
message being set. On success it returns the short option as a char, 0
for a long option, and if the options string begins with "-", then
NON_OPTION_ARG for items argv that are not options.
Important style note:
For many programs written by the vision lab, we do not use command line
options, at least for options that specify different experimental
parameters. For the later it recommended to implement a "set" command, and
use the input file option handling support. But if you do that, typically
it is then simpler to use "set" for all options.
However, command line options are often the way to go for simple programs
that do one thing such as filters.
See kjb_image_program_driver() in i/i_driver.c for an example that uses
many of the option reading features.
This software is not adequatedly tested. It is recomended that
results are checked independantly where appropriate.