kjb_getopts - Gets the next command option in GNU getopt style


#include "l/l_arg.h"

Example compile flags (system dependent):
   -L/home/kobus/misc/load/linux_x86_64_opteron -L/usr/lib/x86_64-linux-gnu
  -lKJB                               -lfftw3  -lgsl -lgslcblas -ljpeg  -lSVM -lstdc++                    -lpthread -lSLATEC -lg2c    -lacml -lacml_mv -lblas -lg2c      -lncursesw 

int kjb_getopts
	int argc,
	char **argv,
	const char *opt_str,
	const struct Option *long_options,
	char *value_buff,
	size_t value_buff_size


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 from:
     man -S 3 getopt_long_only

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


Kobus Barnard


Kobus Barnard