| version 1.10, 2001/11/28 20:46:51 |
version 1.11, 2001/11/30 02:10:27 |
|
|
| CFG_APPEND, |
CFG_APPEND, |
| CFG_OVERWRITE, |
CFG_OVERWRITE, |
| CFG_APPEND_MULTI_ONLY |
CFG_APPEND_MULTI_ONLY |
| */ |
*/ |
| }; |
}; |
| |
|
| enum cfg_option_type { |
enum cfg_option_type { |
| Line 117 enum cfg_option_type { |
|
| Line 117 enum cfg_option_type { |
|
| /* End (to mark last item in list). */ |
/* End (to mark last item in list). */ |
| CFG_END = 0, |
CFG_END = 0, |
| |
|
| |
/* Data type mask. */ |
| |
CFG_DATA_TYPE_MASK = 31, |
| |
|
| /* Single, multi or multi separated. Single by default. */ |
/* Single, multi or multi separated. Single by default. */ |
| /* Tells if option can be repeated. */ |
/* Tells if option can be repeated. */ |
| /* In multi case value is array of poiters to type ended with NULL. */ |
/* In multi case value is array of poiters to type ended with NULL. */ |
| CFG_SINGLE = 0, |
CFG_SINGLE = 0, |
| CFG_MULTI = 32, |
CFG_MULTI = 32, |
| CFG_MULTI_ARRAY = 32, |
CFG_MULTI_ARRAY = 32, |
| CFG_MULTI_SEPARATED = 64, |
CFG_MULTI_SEPARATED = 64 + 32, |
| |
|
| /* Leftover arguments specification. */ |
/* Leftover arguments specification. */ |
| /* Mark option which will contain leftover arguments. */ |
/* Mark option which will contain leftover arguments. */ |
| Line 202 struct cfg_context { |
|
| Line 205 struct cfg_context { |
|
| |
|
| int cur_idx; |
int cur_idx; |
| int cur_idx_tmp; |
int cur_idx_tmp; |
| |
int *used_opt_idx; |
| |
|
| int cur_opt_type; |
int cur_opt_type; |
| char *cur_opt; |
char *cur_opt; |
| Line 248 typedef struct cfg_context* CFG_CONTEXT; |
|
| Line 252 typedef struct cfg_context* CFG_CONTEXT; |
|
| extern "C" { |
extern "C" { |
| #endif |
#endif |
| |
|
| /* Getting & modifying context functions. */ |
/* Getting & modifying context functions. */ |
| |
|
| |
CFG_CONTEXT cfg_get_context(struct cfg_option *options); |
| |
|
| |
CFG_CONTEXT cfg_get_cmdline_context( |
| |
int argc, |
| |
char **argv, |
| |
struct cfg_option *options); |
| |
|
| |
CFG_CONTEXT cfg_get_cfgfile_context( |
| |
int begin_pos, |
| |
int end_pos, |
| |
char *filename, |
| |
struct cfg_option *options); |
| |
|
| |
void cfg_set_cmdline_context( |
| |
const CFG_CONTEXT con, |
| |
int argc, |
| |
char **argv); |
| |
|
| |
void cfg_set_cfgfile_context( |
| |
const CFG_CONTEXT con, |
| |
int begin_pos, |
| |
int end_pos, |
| |
char *filename); |
| |
|
| |
/* Context flags & special properties manipulation. */ |
| |
|
| |
void cfg_set_context_flags(const CFG_CONTEXT con, int flags); |
| |
|
| |
void cfg_clear_cmdline_stop_str(const CFG_CONTEXT con); |
| |
void cfg_add_cmdline_stop_str(const CFG_CONTEXT con, char *str); |
| |
|
| |
void cfg_clear_cfgfile_stop_str(const CFG_CONTEXT con); |
| |
void cfg_add_cfgfile_stop_str(const CFG_CONTEXT con, char *str); |
| |
|
| |
void cfg_clear_cfgfile_comment_str(const CFG_CONTEXT con); |
| |
void cfg_add_cfgfile_comment_str(const CFG_CONTEXT con, char *str); |
| |
|
| |
void cfg_clear_cmdline_short_option_prefix(const CFG_CONTEXT con); |
| |
void cfg_add_cmdline_short_option_prefix(const CFG_CONTEXT con, char *str); |
| |
|
| |
void cfg_clear_cmdline_long_option_prefix(const CFG_CONTEXT con); |
| |
void cfg_add_cmdline_long_option_prefix(const CFG_CONTEXT con, char *str); |
| |
|
| |
void cfg_clear_cmdline_multi_separator(const CFG_CONTEXT con); |
| |
void cfg_add_cmdline_multi_separator(const CFG_CONTEXT con, char *str); |
| |
|
| |
void cfg_clear_cmdline_option_arg_separator(const CFG_CONTEXT con); |
| |
void cfg_add_cmdline_option_arg_separator(const CFG_CONTEXT con, char *str); |
| |
|
| |
void cfg_clear_cfgfile_option_arg_separator(const CFG_CONTEXT con); |
| |
void cfg_add_cfgfile_option_arg_separator(const CFG_CONTEXT con, char *str); |
| |
|
| CFG_CONTEXT cfg_get_context( |
/* Processing context options. */ |
| struct cfg_option *options); |
|
| |
|
| CFG_CONTEXT cfg_get_cmdline_context( |
int cfg_parse(const CFG_CONTEXT con); |
| int argc, |
int cfg_get_next_opt(const CFG_CONTEXT con); |
| char **argv, |
int cfg_get_opt_arg(const CFG_CONTEXT con); |
| struct cfg_option *options); |
char *cfg_get_cur_opt(const CFG_CONTEXT con); |
| |
char *cfg_get_cur_arg(const CFG_CONTEXT con); |
| CFG_CONTEXT cfg_get_cfgfile_context( |
int cfg_get_cur_idx(const CFG_CONTEXT con); |
| int begin_pos, |
|
| int end_pos, |
|
| char *filename, |
|
| struct cfg_option *options); |
|
| |
|
| void cfg_set_cmdline_context( |
|
| const CFG_CONTEXT con, |
|
| int argc, |
|
| char **argv); |
|
| |
|
| void cfg_set_cfgfile_context( |
|
| const CFG_CONTEXT con, |
|
| int begin_pos, |
|
| int end_pos, |
|
| char *filename); |
|
| |
|
| /* Context flags & special properties manipulation. */ |
|
| |
|
| void cfg_set_context_flags(const CFG_CONTEXT con, int flags); |
|
| void cfg_clear_cmdline_stop_str(const CFG_CONTEXT con); |
|
| void cfg_add_cmdline_stop_str(const CFG_CONTEXT con, char *str); |
|
| void cfg_clear_cfgfile_stop_str(const CFG_CONTEXT con); |
|
| void cfg_add_cfgfile_stop_str(const CFG_CONTEXT con, char *str); |
|
| void cfg_clear_cfgfile_comment_str(const CFG_CONTEXT con); |
|
| void cfg_add_cfgfile_comment_str(const CFG_CONTEXT con, char *str); |
|
| void cfg_clear_cmdline_short_option_prefix(const CFG_CONTEXT con); |
|
| void cfg_add_cmdline_short_option_prefix(const CFG_CONTEXT con, char *str); |
|
| void cfg_clear_cmdline_long_option_prefix(const CFG_CONTEXT con); |
|
| void cfg_add_cmdline_long_option_prefix( const CFG_CONTEXT con, char *str); |
|
| void cfg_clear_cmdline_option_arg_separator(const CFG_CONTEXT con); |
|
| void cfg_add_cmdline_option_arg_separator(const CFG_CONTEXT con, char *str); |
|
| void cfg_clear_cfgfile_option_arg_separator(const CFG_CONTEXT con); |
|
| void cfg_add_cfgfile_option_arg_separator(const CFG_CONTEXT con, char *str); |
|
| |
|
| |
|
| /* Processing context options. */ |
|
| |
|
| int cfg_parse(const CFG_CONTEXT con); |
|
| int cfg_get_next_opt(const CFG_CONTEXT con); |
|
| int cfg_get_opt_arg(const CFG_CONTEXT con); |
|
| char *cfg_get_cur_opt(const CFG_CONTEXT con); |
|
| char *cfg_get_cur_arg(const CFG_CONTEXT con); |
|
| int cfg_get_cur_idx(const CFG_CONTEXT con); |
|
| |
|
| /* Reseting context. */ |
/* Reseting context. */ |
| |
|
| void cfg_reset_context(const CFG_CONTEXT con); |
void cfg_reset_context(const CFG_CONTEXT con); |
| |
|
| /* Freeing context. */ |
/* Freeing context. */ |
| |
|
| void cfg_free_context(const CFG_CONTEXT con); |
void cfg_free_context(const CFG_CONTEXT con); |
| |
|
| |
|
| #ifdef __cplusplus |
#ifdef __cplusplus |