| verzia 1.21, 2002/08/04 18:07:44 |
verzia 1.22, 2002/08/16 20:31:43 |
|
|
| /* $Id$ */ |
/* $Id$ */ |
| |
|
| /* Includes {{{ */ |
/* Includes {{{ */ |
| #include "config.h" |
#ifdef HAVE_CONFIG_H |
| |
# include "config.h" |
| |
#endif |
| |
|
| #if STDC_HEADERS |
#if STDC_HEADERS |
| # include <stdlib.h> |
# include <stdlib.h> |
| Riadok 210 __cfg_process_currents(con, ret_val, arg |
|
| Riadok 212 __cfg_process_currents(con, ret_val, arg |
|
| quote_prefix_ar, quote_postfix_ar, separator_ar); |
quote_prefix_ar, quote_postfix_ar, separator_ar); |
| |
|
| if (ret != CFG_OK) { |
if (ret != CFG_OK) { |
| strdyn_safe_free(add); |
FUNCTION(strdyn_safe_free)(add); |
| return ret; |
return ret; |
| } |
} |
| } |
} |
| Riadok 224 __cfg_process_currents(con, ret_val, arg |
|
| Riadok 226 __cfg_process_currents(con, ret_val, arg |
|
| con->options[opt_idx].value); |
con->options[opt_idx].value); |
| |
|
| if (add != static_add) |
if (add != static_add) |
| strdyn_free((char **) add); |
FUNCTION(strdyn_free)((char **) add); |
| } |
} |
| else { |
else { |
| ret = unquote_single_arg(con->cur_arg, |
ret = unquote_single_arg(con->cur_arg, |
| Riadok 263 __cfg_process_currents(con, ret_val, arg |
|
| Riadok 265 __cfg_process_currents(con, ret_val, arg |
|
| separator_ar); |
separator_ar); |
| |
|
| if (ret != CFG_OK) { |
if (ret != CFG_OK) { |
| strdyn_safe_free(ar); |
FUNCTION(strdyn_safe_free)(ar); |
| return ret; |
return ret; |
| } |
} |
| |
|
| if ((*p = strdyn_add_ar(*p, ar)) == NULL) |
if ((*p = FUNCTION(strdyn_add_ar)(*p, ar)) == NULL) |
| return CFG_ERROR_NOMEM; |
return CFG_ERROR_NOMEM; |
| |
|
| strdyn_free(ar); |
FUNCTION(strdyn_free)(ar); |
| } |
} |
| else { |
else { |
| ret = unquote_single_arg(con->cur_arg, |
ret = unquote_single_arg(con->cur_arg, |
| Riadok 279 __cfg_process_currents(con, ret_val, arg |
|
| Riadok 281 __cfg_process_currents(con, ret_val, arg |
|
| if (ret != CFG_OK) |
if (ret != CFG_OK) |
| return ret; |
return ret; |
| |
|
| if ((*p = strdyn_add(*p, con->cur_arg)) == NULL) |
if ((*p = FUNCTION(strdyn_add)(*p, con->cur_arg)) == NULL) |
| return CFG_ERROR_NOMEM; |
return CFG_ERROR_NOMEM; |
| } |
} |
| } |
} |
| Riadok 444 __cfg_cfgfile_set_currents(con, buf) |
|
| Riadok 446 __cfg_cfgfile_set_currents(con, buf) |
|
| if ((con->cur_arg = strdup(s_sep + size)) == NULL) |
if ((con->cur_arg = strdup(s_sep + size)) == NULL) |
| return 0; |
return 0; |
| |
|
| str_right_trim(con->cur_opt); |
FUNCTION(str_right_trim)(con->cur_opt); |
| str_left_trim(con->cur_arg); |
FUNCTION(str_left_trim)(con->cur_arg); |
| } |
} |
| |
|
| return 1; |
return 1; |
| Riadok 494 search_cur_opt_idx(con) |
|
| Riadok 496 search_cur_opt_idx(con) |
|
| |
|
| if (con->cur_opt != NULL |
if (con->cur_opt != NULL |
| && con->options[i].cfgfile_name != NULL |
&& con->options[i].cfgfile_name != NULL |
| && con->cur_opt == str_white_str(con->cur_opt, |
&& con->cur_opt == FUNCTION(str_white_str)(con->cur_opt, |
| (char *)(con->options[i].cfgfile_name), &len) |
(char *)(con->options[i].cfgfile_name), &len) |
| && len == strlen(con->cur_opt)) |
&& len == strlen(con->cur_opt)) |
| |
|
| Riadok 804 split_multi_arg(arg, ar, quote_prefix_ar |
|
| Riadok 806 split_multi_arg(arg, ar, quote_prefix_ar |
|
| char *p_quote, *p_sep, *tmp_s; |
char *p_quote, *p_sep, *tmp_s; |
| char *arg_base = arg; |
char *arg_base = arg; |
| |
|
| if ((*ar = strdyn_create()) == NULL) |
if ((*ar = FUNCTION(strdyn_create)()) == NULL) |
| return CFG_ERROR_NOMEM; |
return CFG_ERROR_NOMEM; |
| |
|
| 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, quote_prefix_ar, "e_idx); |
p_quote = FUNCTION(strdyn_str2)(arg, quote_prefix_ar, "e_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 */ |
| |
|
| /* Searching first separator string (p_sep) */ |
/* Searching first separator string (p_sep) */ |
| for (i = 0; separator_ar[i] != NULL; i++) { |
for (i = 0; separator_ar[i] != NULL; i++) { |
| if ((tmp_s = str_white_str(arg, separator_ar[i], &tmp_sep_size)) |
if ((tmp_s = FUNCTION(str_white_str)(arg, separator_ar[i], &tmp_sep_size)) |
| != NULL && (p_sep == NULL || tmp_s < p_sep)) { |
!= NULL && (p_sep == NULL || tmp_s < p_sep)) { |
| p_sep = tmp_s; |
p_sep = tmp_s; |
| sep_ar_idx = i; |
sep_ar_idx = i; |
| Riadok 835 split_multi_arg(arg, ar, quote_prefix_ar |
|
| Riadok 837 split_multi_arg(arg, ar, quote_prefix_ar |
|
| register int prefix_len, postfix_len; |
register int prefix_len, postfix_len; |
| |
|
| if (quote_idx < 0 /* not optimized */ |
if (quote_idx < 0 /* not optimized */ |
| || quote_idx > strdyn_get_size(quote_prefix_ar) - 1 |
|| quote_idx > FUNCTION(strdyn_get_size)(quote_prefix_ar) - 1 |
| || quote_idx > strdyn_get_size(quote_postfix_ar) - 1 |
|| quote_idx > FUNCTION(strdyn_get_size)(quote_postfix_ar) - 1 |
| || (prefix = quote_prefix_ar[quote_idx]) == NULL |
|| (prefix = quote_prefix_ar[quote_idx]) == NULL |
| || (postfix = quote_postfix_ar[quote_idx]) == NULL) |
|| (postfix = quote_postfix_ar[quote_idx]) == NULL) |
| return CFG_ERROR_INTERNAL; |
return CFG_ERROR_INTERNAL; |
| Riadok 865 split_multi_arg(arg, ar, quote_prefix_ar |
|
| Riadok 867 split_multi_arg(arg, ar, quote_prefix_ar |
|
| |
|
| c = *p_sep; |
c = *p_sep; |
| *p_sep = '\0'; |
*p_sep = '\0'; |
| *ar = strdyn_add_va(*ar, arg_base, NULL); |
*ar = FUNCTION(strdyn_add_va)(*ar, arg_base, NULL); |
| *p_sep = c; |
*p_sep = c; |
| arg = arg_base = p_sep + sep_size; |
arg = arg_base = p_sep + sep_size; |
| |
|
| Riadok 875 split_multi_arg(arg, ar, quote_prefix_ar |
|
| Riadok 877 split_multi_arg(arg, ar, quote_prefix_ar |
|
| |
|
| } while (p_quote != NULL || p_sep != NULL); |
} while (p_quote != NULL || p_sep != NULL); |
| |
|
| if ((*ar = strdyn_add_va(*ar, arg_base, NULL)) == NULL) |
if ((*ar = FUNCTION(strdyn_add_va)(*ar, arg_base, NULL)) == NULL) |
| return CFG_ERROR_NOMEM; |
return CFG_ERROR_NOMEM; |
| |
|
| return CFG_OK; |
return CFG_OK; |
| Riadok 898 unquote_single_arg(arg, quote_prefix_ar, |
|
| Riadok 900 unquote_single_arg(arg, quote_prefix_ar, |
|
| int quote_idx; |
int quote_idx; |
| |
|
| do { |
do { |
| p_quote = strdyn_str2(arg, quote_prefix_ar, "e_idx); |
p_quote = FUNCTION(strdyn_str2)(arg, quote_prefix_ar, "e_idx); |
| |
|
| /* If beginning of quotation was found */ |
/* If beginning of quotation was found */ |
| if (p_quote != NULL) { |
if (p_quote != NULL) { |
| Riadok 906 unquote_single_arg(arg, quote_prefix_ar, |
|
| Riadok 908 unquote_single_arg(arg, quote_prefix_ar, |
|
| register int prefix_len, postfix_len; |
register int prefix_len, postfix_len; |
| |
|
| if (quote_idx < 0 /* not optimized */ |
if (quote_idx < 0 /* not optimized */ |
| || quote_idx > strdyn_get_size(quote_prefix_ar) - 1 |
|| quote_idx > FUNCTION(strdyn_get_size)(quote_prefix_ar) - 1 |
| || quote_idx > strdyn_get_size(quote_postfix_ar) - 1 |
|| quote_idx > FUNCTION(strdyn_get_size)(quote_postfix_ar) - 1 |
| || (prefix = quote_prefix_ar[quote_idx]) == NULL |
|| (prefix = quote_prefix_ar[quote_idx]) == NULL |
| || (postfix = quote_postfix_ar[quote_idx]) == NULL) |
|| (postfix = quote_postfix_ar[quote_idx]) == NULL) |
| return CFG_ERROR_INTERNAL; |
return CFG_ERROR_INTERNAL; |