| version 1.25, 2002/05/27 20:04:20 |
version 1.26, 2002/05/29 15:12:55 |
| Line 76 static struct cfg_option process_options |
|
| Line 76 static struct cfg_option process_options |
|
| |
|
| /* Static function declarations {{{ */ |
/* Static function declarations {{{ */ |
| static void print_cfg_error(const CFG_CONTEXT con); |
static void print_cfg_error(const CFG_CONTEXT con); |
| |
static int test_process_cfg_argv(const char *config_filename); |
| static char *get_user_config_filename(void); |
static char *get_user_config_filename(void); |
| static void clear_global_cfg(void); |
static void clear_global_cfg(void); |
| static void clear_process_cfg(void); |
static void clear_process_cfg(void); |
| Line 392 conf_cfgfile_parse(filename, global, pro |
|
| Line 393 conf_cfgfile_parse(filename, global, pro |
|
| |
|
| if (section_no > 0) { |
if (section_no > 0) { |
| if (cur_context == process_context) { |
if (cur_context == process_context) { |
| |
if (! test_process_cfg_argv(filename)) { |
| |
ret = CFG_ERROR_STOP_STR; |
| |
cur_context = NULL; |
| |
break; |
| |
} |
| |
/* Adding to processes array */ |
| if (! add_process_cfg_to_processes(processes, |
if (! add_process_cfg_to_processes(processes, |
| &processes_size)) |
&processes_size)) |
| return CFG_ERR_NOMEM; |
return CFG_ERR_NOMEM; |
| Line 414 conf_cfgfile_parse(filename, global, pro |
|
| Line 421 conf_cfgfile_parse(filename, global, pro |
|
| msg_error_print("unknown section '%s' in config file '%s'\n", |
msg_error_print("unknown section '%s' in config file '%s'\n", |
| section_str, filename); |
section_str, filename); |
| ret = CFG_ERROR_STOP_STR; /* CFG_ERROR_UNKNOWN */ |
ret = CFG_ERROR_STOP_STR; /* CFG_ERROR_UNKNOWN */ |
| |
cur_context = NULL; |
| break; |
break; |
| } |
} |
| } |
} |
| } |
} |
| |
|
| /* Set returning parameters. */ |
/* Set returning parameters. */ |
| if (cur_context == process_context && |
if (cur_context == process_context) { |
| ! add_process_cfg_to_processes(processes, &processes_size)) |
if (! test_process_cfg_argv(filename)) |
| return CFG_ERR_NOMEM; |
ret = CFG_ERROR_STOP_STR; |
| |
else if (! add_process_cfg_to_processes(processes, &processes_size)) |
| |
return CFG_ERR_NOMEM; |
| |
} |
| |
|
| if (! add_global_cfg_to_global(global)) |
if (! add_global_cfg_to_global(global)) |
| return CFG_ERR_NOMEM; |
return CFG_ERR_NOMEM; |
| Line 497 conf_cmdline_parse(argc, argv, global, p |
|
| Line 508 conf_cmdline_parse(argc, argv, global, p |
|
| } |
} |
| |
|
| if (cur_context == process_context) { |
if (cur_context == process_context) { |
| |
if (! test_process_cfg_argv(NULL)) { |
| |
ret = CFG_ERROR_STOP_STR; |
| |
break; |
| |
} |
| |
/* Adding to processes array */ |
| if (! add_process_cfg_to_processes(processes, &processes_size)) |
if (! add_process_cfg_to_processes(processes, &processes_size)) |
| return CFG_ERR_NOMEM; |
return CFG_ERR_NOMEM; |
| |
|
| Line 515 conf_cmdline_parse(argc, argv, global, p |
|
| Line 531 conf_cmdline_parse(argc, argv, global, p |
|
| /* Set returning parameters. */ |
/* Set returning parameters. */ |
| if (cur_context == process_context |
if (cur_context == process_context |
| && ret == CFG_OK |
&& ret == CFG_OK |
| && cfg_get_cur_idx(cur_context) > 0 |
&& cfg_get_cur_idx(cur_context) > 0) { |
| && ! add_process_cfg_to_processes(processes, &processes_size)) |
if (! test_process_cfg_argv(NULL)) |
| return CFG_ERR_NOMEM; |
ret = CFG_ERROR_STOP_STR; |
| |
else if (! add_process_cfg_to_processes(processes, &processes_size)) |
| |
return CFG_ERR_NOMEM; |
| |
} |
| |
|
| if (! add_global_cfg_to_global(global)) |
if (! add_global_cfg_to_global(global)) |
| return CFG_ERR_NOMEM; |
return CFG_ERR_NOMEM; |
| Line 556 print_cfg_error(con) |
|
| Line 575 print_cfg_error(con) |
|
| return; |
return; |
| } /* }}} */ |
} /* }}} */ |
| |
|
| |
/* Test if argv was specified */ |
| |
static int |
| |
test_process_cfg_argv(config_filename) |
| |
const char *config_filename; |
| |
{ /* {{{ */ |
| |
/* TODO: print ->name[0] if specified, "some process" otherwise */ |
| |
if (process_cfg.argv == NULL) { |
| |
#if 0 |
| |
char *name0 = process_cfg.name == NULL |
| |
|| process_cfg.name[0] == NULL |
| |
|| strlen(process_cfg.name[0]) <= 0 |
| |
? process_cfg.name[0] : NULL; |
| |
#endif |
| |
if (config_filename != NULL) { |
| |
msg_error_print("some process doesn't have specified" |
| |
" what to run in config file '%s'\n", |
| |
config_filename); |
| |
} |
| |
else { |
| |
msg_error_print("some process doesn't have specified" |
| |
" what to run on command line\n"); |
| |
} |
| |
|
| |
return 0; |
| |
} |
| |
|
| |
return 1; |
| |
} /* }}} */ |
| |
|
| static char * |
static char * |
| get_user_config_filename(void) |
get_user_config_filename(void) |
| { /* {{{ */ |
{ /* {{{ */ |
| Line 606 check_context(context, options) |
|
| Line 654 check_context(context, options) |
|
| cfg_clear_cmdline_multi_vals_separator(*context); |
cfg_clear_cmdline_multi_vals_separator(*context); |
| cfg_clear_cfgfile_stop_prefix(*context); |
cfg_clear_cfgfile_stop_prefix(*context); |
| |
|
| if (! cfg_add_cmdline_stop_string(*context, "--") |
if (! cfg_add_cmdline_stop_string(*context, "^^") |
| || ! cfg_add_cmdline_multi_vals_separator(*context, ",") |
|| ! cfg_add_cmdline_multi_vals_separator(*context, ",") |
| || ! cfg_add_cfgfile_stop_prefix(*context, |
|| ! cfg_add_cfgfile_stop_prefix(*context, |
| section_boundaries[0])) |
section_boundaries[0])) |