diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-05-10 15:03:43 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-05-10 17:21:54 +0300 |
commit | 8b04169265fb9762b2c1dfca3f43068f5b8233be (patch) | |
tree | 43049c1809b2b70b21ed9300ebdd286d18833c8b /src/config.c | |
parent | bb242e454d5cf8b0c6bb1ca5d009ec18e86c0c2b (diff) | |
download | wydawca-8b04169265fb9762b2c1dfca3f43068f5b8233be.tar.gz wydawca-8b04169265fb9762b2c1dfca3f43068f5b8233be.tar.bz2 |
Update grecs.
* Makefile.am (ChangeLog): Use git2chg.awk.
* bootstrap.conf (gnulib_modules): Don't access grecs/gnulib.modules.
* configure.ac (GRECS_SETUP): Add options.
* gnulib.modules (getopt,gitlog-to-changelog)
(hash,error,version-etc): Remove.
* src/Makefile.am: Remove getopt.m4, use one from grecs.
* src/getopt.m4: Remove.
* src/cmdline.opt: Rewrite.
* src/config.c: Update.
* src/wydawca.h (spool) <aliases>: Change data type.
(all_spool_aliases): Change data type.
(config_finish): New proto.
* src/wydawca.c: Use grecs functions.
* src/dictionary.c: Likewise.
* src/net.c: Likewise.
* src/process.c: Likewise.
* src/mail.c: Use grecs_symtab.
* src/timer.c: Likewise.
* src/triplet.c: Likewise.
Diffstat (limited to 'src/config.c')
-rw-r--r-- | src/config.c | 73 |
1 files changed, 37 insertions, 36 deletions
diff --git a/src/config.c b/src/config.c index 9c75df6..7353f29 100644 --- a/src/config.c +++ b/src/config.c @@ -248,7 +248,7 @@ get_arg (grecs_locus_t *locus, grecs_value_t *value, unsigned n, int type) grecs_error (locus, 0, _("not enough arguments")); return NULL; } - value = value->v.arg.v + n; + value = value->v.arg.v[n]; if (value->type != type) { grecs_error (locus, 0, _("argument %d has wrong type"), n); @@ -300,12 +300,11 @@ cb_email_address (enum grecs_callback_command cmd, case GRECS_TYPE_LIST: { - const void *p; - gl_list_iterator_t itr = gl_list_iterator (value->v.list); - - while (gl_list_iterator_next (&itr, &p, NULL)) + struct grecs_list_entry *ep; + + for (ep = value->v.list->head; ep; ep = ep->next) { - const grecs_value_t *vp = p; + const grecs_value_t *vp = ep->data; mu_address_t a; if (assert_string_arg (locus, cmd, vp)) return 1; @@ -500,7 +499,7 @@ parse_statmask (grecs_locus_t *loc, grecs_value_t *val, unsigned long *pmask) for (i = 0; i < val->v.arg.c; i++) { unsigned long x; - if (parse_single_statmask (loc, &val->v.arg.v[i], &x, &invert)) + if (parse_single_statmask (loc, val->v.arg.v[i], &x, &invert)) err = 1; else if (invert) mask &= ~x; @@ -512,12 +511,11 @@ parse_statmask (grecs_locus_t *loc, grecs_value_t *val, unsigned long *pmask) case GRECS_TYPE_LIST: { - const void *p; - gl_list_iterator_t itr = gl_list_iterator (val->v.list); + struct grecs_list_entry *ep; - while (gl_list_iterator_next (&itr, &p, NULL)) + for (ep = val->v.list->head; ep; ep = ep->next) { - const grecs_value_t *vp = p; + const grecs_value_t *vp = ep->data; unsigned long x; if (parse_single_statmask (loc, vp, &x, &invert)) @@ -686,20 +684,20 @@ cb_define_message (enum grecs_callback_command cmd, return 1; } - if (value->v.arg.v[0].type != GRECS_TYPE_STRING) + if (value->v.arg.v[0]->type != GRECS_TYPE_STRING) { grecs_error (locus, 0, _("first argument not a string")); return 1; } - ident = value->v.arg.v[0].v.string; + ident = value->v.arg.v[0]->v.string; - if (value->v.arg.v[1].type != GRECS_TYPE_STRING) + if (value->v.arg.v[1]->type != GRECS_TYPE_STRING) { grecs_error (locus, 0, _("second argument not a string")); return 1; } - register_message_template (ident, value->v.arg.v[1].v.string); + register_message_template (ident, value->v.arg.v[1]->v.string); return 0; } @@ -992,10 +990,10 @@ cb_dictionary_type (enum grecs_callback_command cmd, static int cb_dictionary_params (enum grecs_callback_command cmd, - grecs_locus_t *locus, - void *varptr, - grecs_value_t *value, - void *cb_data) + grecs_locus_t *locus, + void *varptr, + grecs_value_t *value, + void *cb_data) { struct dictionary *meth = varptr; size_t size; @@ -1011,7 +1009,7 @@ cb_dictionary_params (enum grecs_callback_command cmd, return 1; } - size = gl_list_size (value->v.list); + size = grecs_list_size (value->v.list); if (size == 0) { meth->parmc = 0; @@ -1020,22 +1018,20 @@ cb_dictionary_params (enum grecs_callback_command cmd, else { int i; - const void *p; - gl_list_iterator_t itr = gl_list_iterator (value->v.list); + struct grecs_list_entry *ep; meth->parmc = size; meth->parmv = xcalloc (size + 1, sizeof (meth->parmv[0])); - for (i = 0; gl_list_iterator_next (&itr, &p, NULL); i++) + for (i = 0, ep = value->v.list->head; ep; ep = ep->next, i++) { - const grecs_value_t *vp = p; + const grecs_value_t *vp = ep->data; if (assert_string_arg (locus, cmd, vp)) break; meth->parmv[i] = xstrdup (vp->v.string); } - gl_list_iterator_free (&itr); meth->parmv[i] = NULL; } return 0; @@ -1314,21 +1310,20 @@ cb_supp_groups (enum grecs_callback_command cmd, return 1; } - wydawca_supp_groupc = gl_list_size (value->v.list); + wydawca_supp_groupc = grecs_list_size (value->v.list); if (wydawca_supp_groupc == 0) wydawca_supp_groups = NULL; else { int i; - gl_list_iterator_t itr; - const void *p; + struct grecs_list_entry *ep; wydawca_supp_groups = xcalloc (wydawca_supp_groupc, sizeof (wydawca_supp_groups[0])); - itr = gl_list_iterator (value->v.list); - for (i = 0; gl_list_iterator_next (&itr, &p, NULL); i++) + + for (i = 0, ep = value->v.list->head; ep; ep = ep->next, i++) { - const grecs_value_t *vp = p; + const grecs_value_t *vp = ep->data; struct group *grp; if (assert_string_arg (locus, cmd, vp)) @@ -1341,7 +1336,6 @@ cb_supp_groups (enum grecs_callback_command cmd, } wydawca_supp_groups[i] = grp->gr_gid; } - gl_list_iterator_free (&itr); } return 0; } @@ -1480,8 +1474,8 @@ config_help () static char docstring[] = N_("Configuration file structure for wydawca.\n" "For more information, use `info wydawca configuration'."); - grecs_format_docstring (stdout, docstring, 0); - grecs_format_statement_array (stdout, wydawca_kw, 1, 0); + grecs_format_docstring (docstring, 0, stdout); + grecs_format_statement_array (wydawca_kw, 1, 0, stdout); } void @@ -1490,11 +1484,10 @@ config_init() int i; struct servent *serv; - grecs_set_keywords (wydawca_kw); grecs_include_path_setup (DEFAULT_VERSION_INCLUDE_DIR, DEFAULT_INCLUDE_DIR, NULL); grecs_preprocessor = DEFAULT_PREPROCESSOR; - grecs_log_to_stderr = true; + grecs_log_to_stderr = 1; serv = getservbyname (PACKAGE, "tcp"); if (serv != NULL) @@ -1503,3 +1496,11 @@ config_init() for (i = 0; i < dictionary_count; i++) default_dictionary[i] = dictionary_new (i, dictionary_builtin); } + +void +config_finish (struct grecs_node *tree) +{ + if (grecs_tree_process (tree, wydawca_kw)) + exit (EX_CONFIG); +} + |