Infrasctucture Opt Function Reference

Opt
The Opt layer of libUt allows programmers to easily access command line options.

opIsDebug     opRegOpt     opInit     opReg     OPT_BGN     OPT_INT    
OPT_STR     OPT_FUN     OPT_FLG     OPT_END     OPT_REG    

int  opIsDebug( )
Returns true if there was a command line option of '-d' (debug mode) else FALSE.

int  opRegOpt( int opt, pfi_t func, void* val )
Register a single command line option. "opt" is the option character, "func" is the call-back function, and "val" is passed to the function as context.

int  opInit( int argc, char* argv[] )
Initialize opt layer (called from infInit).

int  opReg( optTbl_t* tp )
Register an option table. This is what is called by OPT_REG;.

void  OPT_BGN( )
Initialize the OptTbl array for adding options.

void  OPT_INT( char* key, int var )
Specify an integer value to be loaded into variable "var" when "key" is found on the command line.

void  OPT_STR( char* key, int str )
Specify a string to be loaded into variable "str" when "key" is found on the command line.

void  OPT_FUN( char* key, int func, void* arg )
Specify a function to be called when "key" is found on the command line.    Argument "arg" and the word following the "key" on the command line will be passed to the call-back function.    Prototype for command line option call-back:
callBack( char *context, char *cmdLine )
"cmdLine" is the character string from the command line, context is from the table's "arg" entry.    If the call-back uses up the next command line arguement, it must return a value of one (1) else it must return zero.

void  OPT_FLG( char* key, char flagVar, int arg )
When "key" is found on the command line, value "arg" will be loaded into character flag variable "flagVar".

void  OPT_END( )
End of OptTbl build.

void  OPT_REG( )
Register OptTbl as build by OPT_ macros.