| version 1.7, 2002/02/13 14:55:26 |
version 1.8, 2002/02/17 15:18:44 |
|
|
| |
|
| static char *name_vs_stream_separator[2] = {".", NULL}; |
static char *name_vs_stream_separator[2] = {".", NULL}; |
| |
|
| /* static */ struct cfglocal_struct_global globalcfg; |
/* static */ struct conf_struct_global globalcfg; |
| static struct cfglocal_struct_process processcfg; |
static struct conf_struct_process processcfg; |
| |
|
| static struct cfg_option options_global[] = { |
static struct cfg_option options_global[] = { |
| {"verbose", 'v', "verbose", |
{"verbose", 'v', "verbose", |
| Line 38 static struct cfg_option options_process |
|
| Line 38 static struct cfg_option options_process |
|
| }; |
}; |
| |
|
| static PROCTABLE proc_ar_to_proctable(int n_proc_ar, |
static PROCTABLE proc_ar_to_proctable(int n_proc_ar, |
| struct cfglocal_struct_process *proc_ar); |
struct conf_struct_process *proc_ar); |
| static int cfglocal_cmdline_parse_process(int argc, char **argv, int silent); |
static int conf_cmdline_parse_process(int argc, char **argv, int silent); |
| static int cfglocal_cmdline_parse_global(int argc, char **argv); |
static int conf_cmdline_parse_global(int argc, char **argv); |
| |
|
| PROCTABLE cfglocal_process(int argc, char **argv) |
PROCTABLE conf_process(int argc, char **argv) |
| { |
{ |
| register int idx; |
register int idx; |
| register int index; |
register int index; |
| register int n_proc_ar; |
register int n_proc_ar; |
| register int first_loop; |
register int first_loop; |
| struct cfglocal_struct_process *proc_ar; |
struct conf_struct_process *proc_ar; |
| PROCTABLE ptbl; |
PROCTABLE ptbl; |
| |
|
| /* |
/* |
| * PARSING SCHEME (do not delete) |
* PARSING SCHEME (do not delete) |
| * ------------------------------ |
* ------------------------------ |
| * |
* |
| * cfglocal_cmdline_parse_process(); |
* conf_cmdline_parse_process(); |
| * if (error) { |
* if (error) { |
| * cfglocal_cmdline_parse_global(); |
* conf_cmdline_parse_global(); |
| * if (err) { |
* if (err) { |
| * fail; |
* fail; |
| * } |
* } |
| * |
* |
| * if (config_file) { |
* if (config_file) { |
| * cfglocal_cfgfile_parse_all(); |
* conf_cfgfile_parse_all(); |
| * } |
* } |
| * } |
* } |
| * |
* |
| * while(1) { |
* while(1) { |
| * |
* |
| * cfglocal_cmdline_parse_process(); |
* conf_cmdline_parse_process(); |
| * |
* |
| * if (error) { |
* if (error) { |
| * fail; |
* fail; |
| * } |
* } |
| * } |
* } |
| */ |
*/ |
| |
|
| idx = 1; |
idx = 1; |
| Line 85 PROCTABLE cfglocal_process(int argc, cha |
|
| Line 85 PROCTABLE cfglocal_process(int argc, cha |
|
| ptbl = NULL; |
ptbl = NULL; |
| |
|
| memset((void *) &globalcfg, '\0', |
memset((void *) &globalcfg, '\0', |
| sizeof(struct cfglocal_struct_global)); |
sizeof(struct conf_struct_global)); |
| |
|
| for (first_loop = 1; idx != 0 && index < argc; first_loop = 0) { |
for (first_loop = 1; idx != 0 && index < argc; first_loop = 0) { |
| |
|
| idx = cfglocal_cmdline_parse_process(argc - index, argv + index, |
idx = conf_cmdline_parse_process(argc - index, argv + index, |
| first_loop ? 1 : 0); |
first_loop ? 1 : 0); |
| |
|
| if (idx < 0) { |
if (idx < 0) { |
| Line 99 PROCTABLE cfglocal_process(int argc, cha |
|
| Line 99 PROCTABLE cfglocal_process(int argc, cha |
|
| continue; |
continue; |
| } |
} |
| #if DEBUG |
#if DEBUG |
| msg_debug_print("cfglocal_process(): global options detected," |
msg_debug_print("conf_process(): global options detected," |
| " idx = %d\n", idx); |
" idx = %d\n", idx); |
| #endif |
#endif |
| /* Global options parsing. */ |
/* Global options parsing. */ |
| idx = cfglocal_cmdline_parse_global(argc - index, argv + index); |
idx = conf_cmdline_parse_global(argc - index, argv + index); |
| if (idx < 0) |
if (idx < 0) |
| return NULL; |
return NULL; |
| |
|
| Line 127 PROCTABLE cfglocal_process(int argc, cha |
|
| Line 127 PROCTABLE cfglocal_process(int argc, cha |
|
| return NULL; |
return NULL; |
| } |
} |
| |
|
| proc_ar = (struct cfglocal_struct_process *) realloc((void *) proc_ar, |
proc_ar = (struct conf_struct_process *) realloc((void *) proc_ar, |
| (n_proc_ar + 1) |
(n_proc_ar + 1) |
| * sizeof(struct cfglocal_struct_process)); |
* sizeof(struct conf_struct_process)); |
| if (proc_ar == NULL) { |
if (proc_ar == NULL) { |
| msg_error_print("not enought memory for command line parsing\n"); |
msg_error_print("not enought memory for command line parsing\n"); |
| return NULL; |
return NULL; |
| Line 160 PROCTABLE cfglocal_process(int argc, cha |
|
| Line 160 PROCTABLE cfglocal_process(int argc, cha |
|
| } |
} |
| |
|
| static PROCTABLE proc_ar_to_proctable(int n_proc_ar, |
static PROCTABLE proc_ar_to_proctable(int n_proc_ar, |
| struct cfglocal_struct_process *proc_ar) |
struct conf_struct_process *proc_ar) |
| { |
{ |
| PROCTABLE ptbl; |
PROCTABLE ptbl; |
| register int i, j, k; |
register int i, j, k; |
| Line 263 static PROCTABLE proc_ar_to_proctable(in |
|
| Line 263 static PROCTABLE proc_ar_to_proctable(in |
|
| return ptbl; |
return ptbl; |
| } |
} |
| |
|
| static int cfglocal_cmdline_parse_process(int argc, char **argv, int silent) |
static int conf_cmdline_parse_process(int argc, char **argv, int silent) |
| { |
{ |
| struct cfg_context *con; |
struct cfg_context *con; |
| register int ret; |
register int ret; |
| Line 271 static int cfglocal_cmdline_parse_proces |
|
| Line 271 static int cfglocal_cmdline_parse_proces |
|
| /* Clearing all properties. Some of them need to be set to NULL, |
/* Clearing all properties. Some of them need to be set to NULL, |
| * because of valid handling of string multi lists. |
* because of valid handling of string multi lists. |
| */ |
*/ |
| memset((void *) &processcfg, '\0', sizeof(struct cfglocal_struct_process)); |
memset((void *) &processcfg, '\0', sizeof(struct conf_struct_process)); |
| |
|
| con = cfg_get_cmdline_context(argc, argv, options_process); |
con = cfg_get_cmdline_context(argc, argv, options_process); |
| if (con == NULL) { |
if (con == NULL) { |
| Line 316 static int cfglocal_cmdline_parse_proces |
|
| Line 316 static int cfglocal_cmdline_parse_proces |
|
| return ret; |
return ret; |
| } |
} |
| |
|
| static int cfglocal_cmdline_parse_global(int argc, char **argv) |
static int conf_cmdline_parse_global(int argc, char **argv) |
| { |
{ |
| struct cfg_context *con; |
struct cfg_context *con; |
| register int ret; |
register int ret; |