| version 1.4, 2001/10/11 13:27:34 |
version 1.5, 2001/10/16 18:22:16 |
|
|
| static char *default_cmdline_stop_str[2] = { "--", NULL }; |
static char *default_cmdline_stop_str[2] = { "--", NULL }; |
| static char *default_cfgfile_stop_str[2] = { "[", NULL }; |
static char *default_cfgfile_stop_str[2] = { "[", NULL }; |
| static char *default_cfgfile_comment_str[3] = { "#", ";", NULL }; |
static char *default_cfgfile_comment_str[3] = { "#", ";", NULL }; |
| |
static char *default_short_option_prefix[2] = { "-", NULL }; |
| |
static char *default_long_option_prefix[2] = { "--", NULL }; |
| |
static char *default_line_option_arg_separator[2] = { "=", NULL }; |
| |
static char *default_file_option_arg_separator[2] = { "=", NULL }; |
| |
|
| |
|
| CFG_CONTEXT cfg_get_context( |
CFG_CONTEXT cfg_get_context( |
| Line 22 CFG_CONTEXT cfg_get_context( |
|
| Line 26 CFG_CONTEXT cfg_get_context( |
|
| |
|
| memset(con, '\0', sizeof(*con)); |
memset(con, '\0', sizeof(*con)); |
| |
|
| con->line_stop_str = |
con->line_stop_str = |
| strdyn_add_ar(con->line_stop_str, default_cmdline_stop_str); |
strdyn_add_ar(con->line_stop_str, default_cmdline_stop_str); |
| con->file_stop_str = |
con->file_stop_str = |
| strdyn_add_ar(con->file_stop_str, default_cfgfile_stop_str); |
strdyn_add_ar(con->file_stop_str, default_cfgfile_stop_str); |
| con->comment_str = |
con->comment_str = |
| strdyn_add_ar(con->comment_str, default_cfgfile_comment_str); |
strdyn_add_ar(con->comment_str, default_cfgfile_comment_str); |
| |
con->short_option_prefix = |
| if (con->line_stop_str == NULL |
strdyn_add_ar(con->short_option_prefix, default_short_option_prefix); |
| || con->file_stop_str == NULL |
con->long_option_prefix = |
| || con->comment_str == NULL) |
strdyn_add_ar(con->long_option_prefix, default_long_option_prefix); |
| |
con->line_option_arg_separator = |
| |
strdyn_add_ar(con->line_option_arg_separator, |
| |
default_line_option_arg_separator); |
| |
con->file_option_arg_separator = |
| |
strdyn_add_ar(con->file_option_arg_separator, |
| |
default_file_option_arg_separator); |
| |
|
| |
if (con->line_stop_str == NULL |
| |
|| con->file_stop_str == NULL |
| |
|| con->comment_str == NULL |
| |
|| con->short_option_prefix == NULL |
| |
|| con->long_option_prefix == NULL |
| |
|| con->line_option_arg_separator == NULL |
| |
|| con->file_option_arg_separator == NULL |
| |
) |
| return NULL; |
return NULL; |
| |
|
| return con; |
return con; |
| Line 106 void cfg_free_context( |
|
| Line 125 void cfg_free_context( |
|
| cfg_clear_cmdline_stop_str(con); |
cfg_clear_cmdline_stop_str(con); |
| cfg_clear_cfgfile_stop_str(con); |
cfg_clear_cfgfile_stop_str(con); |
| cfg_clear_cfgfile_comment_str(con); |
cfg_clear_cfgfile_comment_str(con); |
| |
cfg_clear_cmdline_short_option_prefix(con); |
| |
cfg_clear_cmdline_long_option_prefix(con); |
| |
cfg_clear_cmdline_option_arg_separator(con); |
| |
cfg_clear_cfgfile_option_arg_separator(con); |
| |
|
| free((void *) con); |
free((void *) con); |
| } |
} |