ROSS
Functions | Variables
tw-opts.c File Reference
#include <ctype.h>
#include <ross.h>

Go to the source code of this file.

Functions

static void need_argument (const tw_optdef *def)
 
static int is_empty (const tw_optdef *def)
 
void tw_opt_add (const tw_optdef *options)
 
static void show_help (void)
 
void tw_opt_settings (FILE *outfile)
 
void tw_opt_print (void)
 
static void apply_opt (const tw_optdef *def, const char *value)
 
static void match_opt (const char *arg)
 
void tw_opt_parse (int *argc_p, char ***argv_p)
 

Variables

static const char * program
 
static const tw_optdefall_groups [10]
 
static const tw_optdefopt_groups [10]
 
static unsigned int opt_index = 0
 
static const tw_optdef basic []
 

Function Documentation

static void apply_opt ( const tw_optdef def,
const char *  value 
)
static

Definition at line 287 of file tw-opts.c.

References need_argument(), show_help(), tw_error(), tw_ismaster(), TW_LOC, tw_net_stop(), tw_warning(), TWOPTTYPE_CHAR, TWOPTTYPE_DOUBLE, TWOPTTYPE_FLAG, TWOPTTYPE_SHOWHELP, TWOPTTYPE_STIME, TWOPTTYPE_UINT, TWOPTTYPE_ULONG, TWOPTTYPE_ULONGLONG, tw_optdef::type, and tw_optdef::value.

Referenced by match_opt().

Here is the call graph for this function:

Here is the caller graph for this function:

static int is_empty ( const tw_optdef def)
static

Definition at line 416 of file tw-opts.c.

References TWOPTTYPE_GROUP, and tw_optdef::type.

Referenced by tw_opt_add(), and tw_opt_parse().

Here is the caller graph for this function:

static void match_opt ( const char *  arg)
static

Definition at line 378 of file tw-opts.c.

References all_groups, apply_opt(), tw_optdef::name, program, tw_ismaster(), tw_net_stop(), TWOPTTYPE_GROUP, and tw_optdef::type.

Referenced by tw_opt_parse().

Here is the call graph for this function:

Here is the caller graph for this function:

static void need_argument ( const tw_optdef def)
static

Definition at line 276 of file tw-opts.c.

References tw_optdef::name, program, tw_ismaster(), and tw_net_stop().

Referenced by apply_opt().

Here is the call graph for this function:

Here is the caller graph for this function:

static void show_help ( void  )
static
void tw_opt_add ( const tw_optdef options)

Add an opt group

Definition at line 14 of file tw-opts.c.

References is_empty(), opt_index, and tw_optdef::type.

Referenced by main(), and tw_init().

Here is the call graph for this function:

Here is the caller graph for this function:

void tw_opt_parse ( int *  argc,
char ***  argv 
)

Remove options from the command line arguments.

Definition at line 427 of file tw-opts.c.

References ARRAY_SIZE, basic, is_empty(), match_opt(), program, tw_error(), and TW_LOC.

Referenced by tw_init().

Here is the call graph for this function:

Here is the caller graph for this function:

void tw_opt_print ( void  )

Pretty-print the option descriptions (for –help)

Definition at line 215 of file tw-opts.c.

References all_groups, g_tw_csv, tw_optdef::name, tw_ismaster(), TWOPTTYPE_CHAR, TWOPTTYPE_DOUBLE, TWOPTTYPE_FLAG, TWOPTTYPE_GROUP, TWOPTTYPE_STIME, TWOPTTYPE_UINT, TWOPTTYPE_ULONG, TWOPTTYPE_ULONGLONG, tw_optdef::type, and tw_optdef::value.

Here is the call graph for this function:

void tw_opt_settings ( FILE *  f)

Pretty-print the option descriptions and current values

Definition at line 138 of file tw-opts.c.

References all_groups, tw_optdef::help, tw_optdef::name, TWOPTTYPE_CHAR, TWOPTTYPE_DOUBLE, TWOPTTYPE_FLAG, TWOPTTYPE_GROUP, TWOPTTYPE_STIME, TWOPTTYPE_UINT, TWOPTTYPE_ULONG, TWOPTTYPE_ULONGLONG, tw_optdef::type, and tw_optdef::value.

Referenced by io_store_checkpoint().

Here is the caller graph for this function:

Variable Documentation

const tw_optdef* all_groups[10]
static

Definition at line 5 of file tw-opts.c.

Referenced by match_opt(), show_help(), tw_opt_print(), and tw_opt_settings().

const tw_optdef basic[]
static
Initial value:
= {
{ TWOPTTYPE_SHOWHELP, "help", "show this message", NULL },
{ (tw_opttype)0, NULL, NULL, NULL }
}
tw_opttype
Definition: tw-opts.h:4

Definition at line 411 of file tw-opts.c.

Referenced by tw_opt_parse().

const tw_optdef* opt_groups[10]
static

Definition at line 10 of file tw-opts.c.

unsigned int opt_index = 0
static

Definition at line 11 of file tw-opts.c.

Referenced by tw_opt_add().

const char* program
static

Definition at line 4 of file tw-opts.c.

Referenced by match_opt(), need_argument(), show_help(), and tw_opt_parse().