| verzia 1.15, 2002/05/29 20:12:02 |
verzia 1.16, 2002/05/30 22:29:45 |
| Riadok 269 __cfg_cmdline_set_currents(con) |
|
| Riadok 269 __cfg_cmdline_set_currents(con) |
|
| { /* {{{ */ |
{ /* {{{ */ |
| register int i, size; |
register int i, size; |
| register char *s, *s_sep, *s_tmp; |
register char *s, *s_sep, *s_tmp; |
| |
register char *ptr; |
| |
|
| size = 0; |
size = 0; |
| s = con->argv[con->cur_idx]; |
s = con->argv[con->cur_idx]; |
| |
|
| for (i = 0; con->short_option_prefix[i] != NULL; i++) |
for (i = 0; (ptr = con->prop[CFG_LINE_SHORT_OPTION_PREFIX][i]) != NULL; i++) |
| if (strlen(con->short_option_prefix[i]) > size |
if (strlen(ptr) > size && strstr(s, ptr) == s) |
| && strstr(s, con->short_option_prefix[i]) == s) |
size = strlen(ptr); |
| size = strlen(con->short_option_prefix[i]); |
|
| |
|
| size = -size; |
size = -size; |
| |
|
| for (i = 0; con->long_option_prefix[i] != NULL; i++) |
for (i = 0; (ptr = con->prop[CFG_LINE_LONG_OPTION_PREFIX][i]) != NULL; i++) |
| if (strlen(con->long_option_prefix[i]) > (size < 0 ? -size : size) |
if (strlen(ptr) > (size < 0 ? -size : size) && strstr(s, ptr) == s) |
| && strstr(s, con->long_option_prefix[i]) == s) |
size = strlen(ptr); |
| size = strlen(con->long_option_prefix[i]); |
|
| |
|
| s_sep = NULL; |
s_sep = NULL; |
| |
|
| Riadok 318 __cfg_cmdline_set_currents(con) |
|
| Riadok 317 __cfg_cmdline_set_currents(con) |
|
| s += size; |
s += size; |
| size = 0; |
size = 0; |
| |
|
| for (i = 0; con->line_option_arg_separator[i] != NULL; i++) |
for (i = 0; (ptr = con->prop[CFG_LINE_OPTION_ARG_SEPARATOR][i]) |
| if ((s_tmp = strstr(s, con->line_option_arg_separator[i])) != NULL) |
!= NULL; i++) |
| |
if ((s_tmp = strstr(s, ptr)) != NULL) |
| if (s_sep == NULL || s_tmp < s_sep |
if (s_sep == NULL || s_tmp < s_sep |
| || (s_tmp == s_sep && |
|| (s_tmp == s_sep && strlen(ptr) > size)) { |
| strlen(con->line_option_arg_separator[i]) > size)) { |
|
| s_sep = s_tmp; |
s_sep = s_tmp; |
| size = strlen(con->line_option_arg_separator[i]); |
size = strlen(ptr); |
| } |
} |
| |
|
| if (s_sep == NULL) { |
if (s_sep == NULL) { |
| Riadok 372 __cfg_cfgfile_set_currents(con, buf) |
|
| Riadok 371 __cfg_cfgfile_set_currents(con, buf) |
|
| register char *s_sep, *s_tmp; |
register char *s_sep, *s_tmp; |
| register int size; |
register int size; |
| |
|
| for (s_sep = NULL, size = 0, pos = con->file_option_arg_separator; |
s_sep = NULL; |
| pos != NULL && *pos != NULL; |
size = 0; |
| pos++) { |
for (pos = con->prop[CFG_FILE_OPTION_ARG_SEPARATOR]; |
| |
pos != NULL && *pos != NULL; pos++) { |
| |
|
| if ((s_tmp = strstr(buf, *pos)) != NULL) |
if ((s_tmp = strstr(buf, *pos)) != NULL) |
| if (s_sep == NULL || s_tmp < s_sep |
if (s_sep == NULL || s_tmp < s_sep |
| Riadok 760 split_multi_arg(con, arg, ar) |
|
| Riadok 760 split_multi_arg(con, arg, ar) |
|
| return CFG_ERROR_NOMEM; |
return CFG_ERROR_NOMEM; |
| |
|
| arg_base = arg; |
arg_base = arg; |
| sep_ar = con->type == CFG_LINE |
sep_ar = con->prop[con->type == CFG_LINE |
| ? con->line_multi_vals_separator |
? CFG_LINE_MULTI_VALS_SEPARATOR |
| : con->file_multi_vals_separator; |
: CFG_FILE_MULTI_VALS_SEPARATOR]; |
| |
|
| do { |
do { |
| |
|
| /* Searching first quotation string (p_quote) |
/* Searching first quotation string (p_quote) |
| and set quotation variables */ |
and set quotation variables */ |
| p_quote = strdyn_str2(arg, con->quote_prefix, "e_prefix_idx); |
p_quote = strdyn_str2(arg, |
| |
con->prop[CFG_QUOTE_PREFIX], "e_prefix_idx); |
| p_sep = NULL; /* pointer to separator */ |
p_sep = NULL; /* pointer to separator */ |
| sep_ar_idx = -1; /* index of separator */ |
sep_ar_idx = -1; /* index of separator */ |
| sep_size = 0; /* length of separator string */ |
sep_size = 0; /* length of separator string */ |
| Riadok 791 split_multi_arg(con, arg, ar) |
|
| Riadok 792 split_multi_arg(con, arg, ar) |
|
| register char *end_ptr, *prefix, *postfix; |
register char *end_ptr, *prefix, *postfix; |
| register int prefix_len, postfix_len; |
register int prefix_len, postfix_len; |
| |
|
| prefix = con->quote_prefix[quote_prefix_idx]; |
prefix = con->prop[CFG_QUOTE_PREFIX ][quote_prefix_idx]; |
| postfix = con->quote_postfix[quote_prefix_idx]; |
postfix = con->prop[CFG_QUOTE_POSTFIX][quote_prefix_idx]; |
| |
|
| if (prefix == NULL || postfix == NULL) |
if (prefix == NULL || postfix == NULL) |
| return CFG_ERROR_INTERNAL; |
return CFG_ERROR_INTERNAL; |
| Riadok 853 unquote_single_arg(con, arg) |
|
| Riadok 854 unquote_single_arg(con, arg) |
|
| int quote_prefix_idx; |
int quote_prefix_idx; |
| |
|
| do { |
do { |
| p_quote = strdyn_str2(arg, con->quote_prefix, "e_prefix_idx); |
p_quote = strdyn_str2(arg, |
| |
con->prop[CFG_QUOTE_PREFIX], "e_prefix_idx); |
| |
|
| /* If beginning of quotation was found */ |
/* If beginning of quotation was found */ |
| if (p_quote != NULL) { |
if (p_quote != NULL) { |
| register char *end_ptr, *prefix, *postfix; |
register char *end_ptr, *prefix, *postfix; |
| register int prefix_len, postfix_len; |
register int prefix_len, postfix_len; |
| |
|
| prefix = con->quote_prefix[quote_prefix_idx]; |
prefix = con->prop[CFG_QUOTE_PREFIX ][quote_prefix_idx]; |
| postfix = con->quote_postfix[quote_prefix_idx]; |
postfix = con->prop[CFG_QUOTE_POSTFIX][quote_prefix_idx]; |
| |
|
| if (prefix == NULL || postfix == NULL) |
if (prefix == NULL || postfix == NULL) |
| return CFG_ERROR_INTERNAL; |
return CFG_ERROR_INTERNAL; |