| version 1.19, 2002/04/21 10:08:40 |
version 1.20, 2002/04/24 22:03:54 |
|
|
| cfg_cmdline_get_next_opt(con) |
cfg_cmdline_get_next_opt(con) |
| const CFG_CONTEXT con; |
const CFG_CONTEXT con; |
| { |
{ |
| /* register int opt_idx; */ |
|
| register int ret; |
|
| int arg_used, ret_val; |
int arg_used, ret_val; |
| |
|
| /* register int opt_data_type, opt_f_multi, opt_f_multi_sep; */ |
/* register int opt_data_type, opt_f_multi, opt_f_multi_sep; */ |
| |
|
| |
con->error_code = CFG_OK; |
| |
|
| while (1) { |
while (1) { |
| |
|
| arg_used = 0; |
arg_used = 0; |
| Line 94 cfg_cmdline_get_next_opt(con) |
|
| Line 93 cfg_cmdline_get_next_opt(con) |
|
| |
|
| __cfg_free_currents(con); |
__cfg_free_currents(con); |
| |
|
| if (! strdyn_compare(con->line_stop_str, con->argv[con->cur_idx])) |
if (! strdyn_compare(con->line_stop_str, con->argv[con->cur_idx])) { |
| return CFG_ERROR_STOP_STR_FOUND; |
con->error_code = CFG_ERROR_STOP_STR_FOUND; |
| |
return con->error_code; |
| |
} |
| |
|
| /* Skip option analyze in cmdline_set_currents(), |
/* Skip option analyze in cmdline_set_currents(), |
| count it as leftover. */ |
count it as leftover. */ |
| if (leftover_init) { |
if (leftover_init) { |
| con->cur_opt_type = CFG_NONE_OPTION; |
con->cur_opt_type = CFG_NONE_OPTION; |
| con->cur_opt = NULL; |
con->cur_opt = NULL; |
| if ((con->cur_arg = strdup(con->argv[con->cur_idx])) == NULL) |
if ((con->cur_arg = strdup(con->argv[con->cur_idx])) == NULL) { |
| return CFG_ERROR_NOMEM; |
con->error_code = CFG_ERROR_NOMEM; |
| |
return con->error_code; |
| |
} |
| } |
} |
| else { |
else { |
| if (__cfg_cmdline_set_currents(con) == 0) |
if (__cfg_cmdline_set_currents(con) == 0) { |
| return CFG_ERROR_NOMEM; |
con->error_code = CFG_ERROR_NOMEM; |
| |
return con->error_code; |
| |
} |
| } |
} |
| } |
} |
| |
|
| ret = __cfg_process_currents(con, &ret_val, &arg_used); |
con->error_code = __cfg_process_currents(con, &ret_val, &arg_used); |
| |
if (con->error_code != CFG_OK) |
| if (ret != CFG_OK) |
return con->error_code; |
| return ret; |
|
| |
|
| if (arg_used) { |
if (arg_used) { |
| if (! (con->cur_opt_type & CFG_LONG_SEPINIT) |
if (! (con->cur_opt_type & CFG_LONG_SEPINIT) |
| Line 134 cfg_cmdline_get_next_opt(con) |
|
| Line 138 cfg_cmdline_get_next_opt(con) |
|
| |
|
| } |
} |
| |
|
| return CFG_OK; |
return con->error_code; /* CFG_OK */ |
| } |
} |
| |
|