| version 1.4, 2001/10/23 00:05:18 |
version 1.5, 2001/11/30 02:10:27 |
|
|
| #include "str/strdyn.h" |
#include "str/strdyn.h" |
| #include "cfg.h" |
#include "cfg.h" |
| |
|
| void cfg_set_context_flags( |
void cfg_set_context_flags(const CFG_CONTEXT con, int flags) |
| const CFG_CONTEXT con, |
|
| int flags |
|
| ) |
|
| { |
{ |
| con->flags = flags; |
con->flags = flags; |
| |
|
| con->cur_idx = con->flags & CFG_PROCESS_FIRST ? 0 : 1; |
con->cur_idx = con->flags & CFG_PROCESS_FIRST ? 0 : 1; |
| } |
} |
| |
|
| void cfg_clear_cmdline_stop_str( |
void cfg_clear_cmdline_stop_str(const CFG_CONTEXT con) |
| const CFG_CONTEXT con |
|
| ) |
|
| { |
{ |
| if (con->line_stop_str != NULL) |
if (con->line_stop_str != NULL) |
| strdyn_free(con->line_stop_str); |
strdyn_free(con->line_stop_str); |
| Line 23 void cfg_clear_cmdline_stop_str( |
|
| Line 18 void cfg_clear_cmdline_stop_str( |
|
| con->line_stop_str = NULL; |
con->line_stop_str = NULL; |
| } |
} |
| |
|
| void cfg_add_cmdline_stop_str( |
void cfg_add_cmdline_stop_str(const CFG_CONTEXT con, char *str) |
| const CFG_CONTEXT con, |
|
| char *str |
|
| ) |
|
| { |
{ |
| if (con->line_stop_str == NULL) |
if (con->line_stop_str == NULL) |
| con->line_stop_str = strdyn_create(); |
con->line_stop_str = strdyn_create(); |
| Line 34 void cfg_add_cmdline_stop_str( |
|
| Line 26 void cfg_add_cmdline_stop_str( |
|
| con->line_stop_str = strdyn_add(con->line_stop_str, str); |
con->line_stop_str = strdyn_add(con->line_stop_str, str); |
| } |
} |
| |
|
| void cfg_clear_cfgfile_stop_str( |
void cfg_clear_cfgfile_stop_str(const CFG_CONTEXT con) |
| const CFG_CONTEXT con |
|
| ) |
|
| { |
{ |
| if (con->file_stop_str != NULL) |
if (con->file_stop_str != NULL) |
| strdyn_free(con->file_stop_str); |
strdyn_free(con->file_stop_str); |
| Line 44 void cfg_clear_cfgfile_stop_str( |
|
| Line 34 void cfg_clear_cfgfile_stop_str( |
|
| con->file_stop_str = NULL; |
con->file_stop_str = NULL; |
| } |
} |
| |
|
| void cfg_add_cfgfile_stop_str( |
void cfg_add_cfgfile_stop_str(const CFG_CONTEXT con, char *str) |
| const CFG_CONTEXT con, |
|
| char *str |
|
| ) |
|
| { |
{ |
| if (con->file_stop_str == NULL) |
if (con->file_stop_str == NULL) |
| con->file_stop_str = strdyn_create(); |
con->file_stop_str = strdyn_create(); |
| Line 55 void cfg_add_cfgfile_stop_str( |
|
| Line 42 void cfg_add_cfgfile_stop_str( |
|
| con->file_stop_str = strdyn_add(con->file_stop_str, str); |
con->file_stop_str = strdyn_add(con->file_stop_str, str); |
| } |
} |
| |
|
| void cfg_clear_cfgfile_comment_str( |
void cfg_clear_cfgfile_comment_str(const CFG_CONTEXT con) |
| const CFG_CONTEXT con |
|
| ) |
|
| { |
{ |
| if (con->comment_str != NULL) |
if (con->comment_str != NULL) |
| strdyn_free(con->comment_str); |
strdyn_free(con->comment_str); |
| Line 65 void cfg_clear_cfgfile_comment_str( |
|
| Line 50 void cfg_clear_cfgfile_comment_str( |
|
| con->comment_str = NULL; |
con->comment_str = NULL; |
| } |
} |
| |
|
| void cfg_add_cfgfile_comment_str( |
void cfg_add_cfgfile_comment_str(const CFG_CONTEXT con, char *str) |
| const CFG_CONTEXT con, |
|
| char *str |
|
| ) |
|
| { |
{ |
| if (con->comment_str == NULL) |
if (con->comment_str == NULL) |
| con->comment_str = strdyn_create(); |
con->comment_str = strdyn_create(); |
| Line 76 void cfg_add_cfgfile_comment_str( |
|
| Line 58 void cfg_add_cfgfile_comment_str( |
|
| con->comment_str = strdyn_add(con->comment_str, str); |
con->comment_str = strdyn_add(con->comment_str, str); |
| } |
} |
| |
|
| void cfg_clear_cmdline_short_option_prefix( |
void cfg_clear_cmdline_short_option_prefix(const CFG_CONTEXT con) |
| const CFG_CONTEXT con |
|
| ) |
|
| { |
{ |
| if (con->short_option_prefix != NULL) |
if (con->short_option_prefix != NULL) |
| strdyn_free(con->short_option_prefix); |
strdyn_free(con->short_option_prefix); |
| Line 86 void cfg_clear_cmdline_short_option_pref |
|
| Line 66 void cfg_clear_cmdline_short_option_pref |
|
| con->short_option_prefix = NULL; |
con->short_option_prefix = NULL; |
| } |
} |
| |
|
| void cfg_add_cmdline_short_option_prefix( |
void cfg_add_cmdline_short_option_prefix(const CFG_CONTEXT con, char *str) |
| const CFG_CONTEXT con, |
|
| char *str |
|
| ) |
|
| { |
{ |
| if (con->short_option_prefix == NULL) |
if (con->short_option_prefix == NULL) |
| con->short_option_prefix = strdyn_create(); |
con->short_option_prefix = strdyn_create(); |
| Line 97 void cfg_add_cmdline_short_option_prefix |
|
| Line 74 void cfg_add_cmdline_short_option_prefix |
|
| con->short_option_prefix = strdyn_add(con->short_option_prefix, str); |
con->short_option_prefix = strdyn_add(con->short_option_prefix, str); |
| } |
} |
| |
|
| void cfg_clear_cmdline_long_option_prefix( |
void cfg_clear_cmdline_long_option_prefix(const CFG_CONTEXT con) |
| const CFG_CONTEXT con |
|
| ) |
|
| { |
{ |
| if (con->long_option_prefix != NULL) |
if (con->long_option_prefix != NULL) |
| strdyn_free(con->long_option_prefix); |
strdyn_free(con->long_option_prefix); |
| Line 107 void cfg_clear_cmdline_long_option_prefi |
|
| Line 82 void cfg_clear_cmdline_long_option_prefi |
|
| con->long_option_prefix = NULL; |
con->long_option_prefix = NULL; |
| } |
} |
| |
|
| void cfg_add_cmdline_long_option_prefix( |
void cfg_add_cmdline_long_option_prefix(const CFG_CONTEXT con, char *str) |
| const CFG_CONTEXT con, |
|
| char *str |
|
| ) |
|
| { |
{ |
| if (con->long_option_prefix == NULL) |
if (con->long_option_prefix == NULL) |
| con->long_option_prefix = strdyn_create(); |
con->long_option_prefix = strdyn_create(); |
| Line 118 void cfg_add_cmdline_long_option_prefix( |
|
| Line 90 void cfg_add_cmdline_long_option_prefix( |
|
| con->long_option_prefix = strdyn_add(con->long_option_prefix, str); |
con->long_option_prefix = strdyn_add(con->long_option_prefix, str); |
| } |
} |
| |
|
| void cfg_clear_cmdline_option_arg_separator( |
void cfg_clear_cmdline_multi_separator(const CFG_CONTEXT con) |
| const CFG_CONTEXT con |
{ |
| ) |
if (con->multi_separator != NULL) |
| |
strdyn_free(con->multi_separator); |
| |
|
| |
con->multi_separator = NULL; |
| |
} |
| |
|
| |
void cfg_add_cmdline_multi_separator(const CFG_CONTEXT con, char *str) |
| |
{ |
| |
if (con->multi_separator == NULL) |
| |
con->multi_separator = strdyn_create(); |
| |
|
| |
con->multi_separator = strdyn_add(con->multi_separator, str); |
| |
} |
| |
|
| |
void cfg_clear_cmdline_option_arg_separator(const CFG_CONTEXT con) |
| { |
{ |
| if (con->line_option_arg_separator != NULL) |
if (con->line_option_arg_separator != NULL) |
| strdyn_free(con->line_option_arg_separator); |
strdyn_free(con->line_option_arg_separator); |
| Line 128 void cfg_clear_cmdline_option_arg_separa |
|
| Line 114 void cfg_clear_cmdline_option_arg_separa |
|
| con->line_option_arg_separator = NULL; |
con->line_option_arg_separator = NULL; |
| } |
} |
| |
|
| void cfg_add_cmdline_option_arg_separator( |
void cfg_add_cmdline_option_arg_separator(const CFG_CONTEXT con, char *str) |
| const CFG_CONTEXT con, |
|
| char *str |
|
| ) |
|
| { |
{ |
| if (con->line_option_arg_separator == NULL) |
if (con->line_option_arg_separator == NULL) |
| con->line_option_arg_separator = strdyn_create(); |
con->line_option_arg_separator = strdyn_create(); |
| Line 140 void cfg_add_cmdline_option_arg_separato |
|
| Line 123 void cfg_add_cmdline_option_arg_separato |
|
| strdyn_add(con->line_option_arg_separator, str); |
strdyn_add(con->line_option_arg_separator, str); |
| } |
} |
| |
|
| void cfg_clear_cfgfile_option_arg_separator( |
void cfg_clear_cfgfile_option_arg_separator(const CFG_CONTEXT con) |
| const CFG_CONTEXT con |
|
| ) |
|
| { |
{ |
| if (con->file_option_arg_separator != NULL) |
if (con->file_option_arg_separator != NULL) |
| strdyn_free(con->file_option_arg_separator); |
strdyn_free(con->file_option_arg_separator); |
| Line 150 void cfg_clear_cfgfile_option_arg_separa |
|
| Line 131 void cfg_clear_cfgfile_option_arg_separa |
|
| con->file_option_arg_separator = NULL; |
con->file_option_arg_separator = NULL; |
| } |
} |
| |
|
| void cfg_add_cfgfile_option_arg_separator( |
void cfg_add_cfgfile_option_arg_separator(const CFG_CONTEXT con, char *str) |
| const CFG_CONTEXT con, |
|
| char *str |
|
| ) |
|
| { |
{ |
| if (con->file_option_arg_separator == NULL) |
if (con->file_option_arg_separator == NULL) |
| con->file_option_arg_separator = strdyn_create(); |
con->file_option_arg_separator = strdyn_create(); |