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 | |
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')
-rw-r--r-- | src/Makefile.am | 4 | ||||
-rw-r--r-- | src/cmdline.opt | 41 | ||||
-rw-r--r-- | src/config.c | 73 | ||||
-rw-r--r-- | src/dictionary.c | 4 | ||||
-rw-r--r-- | src/diskio.c | 2 | ||||
-rw-r--r-- | src/getopt.m4 | 517 | ||||
-rw-r--r-- | src/mail.c | 78 | ||||
-rw-r--r-- | src/net.c | 2 | ||||
-rw-r--r-- | src/process.c | 2 | ||||
-rw-r--r-- | src/timer.c | 79 | ||||
-rw-r--r-- | src/triplet.c | 84 | ||||
-rw-r--r-- | src/wydawca.c | 13 | ||||
-rw-r--r-- | src/wydawca.h | 10 |
13 files changed, 176 insertions, 733 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index a523a1a..b79e0ec 100644 --- a/src/Makefile.am +++ b/src/Makefile.am | |||
@@ -48,12 +48,12 @@ wydawca_SOURCES=\ | |||
48 | report.c | 48 | report.c |
49 | 49 | ||
50 | BUILT_SOURCES=cmdline.h | 50 | BUILT_SOURCES=cmdline.h |
51 | EXTRA_DIST=cmdline.opt getopt.m4 pp-setup update-2.0.awk | 51 | EXTRA_DIST=cmdline.opt pp-setup update-2.0.awk |
52 | 52 | ||
53 | SUFFIXES=.opt .c .h | 53 | SUFFIXES=.opt .c .h |
54 | 54 | ||
55 | .opt.h: | 55 | .opt.h: |
56 | m4 -s $(srcdir)/getopt.m4 $< | sed '1d' > $@ | 56 | $(AM_V_GEN)m4 -s $(top_srcdir)/@GRECS_SUBDIR@/build-aux/getopt.m4 $< > $@ |
57 | 57 | ||
58 | incdir=$(pkgdatadir)/$(VERSION)/include | 58 | incdir=$(pkgdatadir)/$(VERSION)/include |
59 | inc_DATA = $(PP_SETUP_FILE) | 59 | inc_DATA = $(PP_SETUP_FILE) |
diff --git a/src/cmdline.opt b/src/cmdline.opt index 29eff3a..4c3d22f 100644 --- a/src/cmdline.opt +++ b/src/cmdline.opt | |||
@@ -1,4 +1,4 @@ | |||
1 | /* wydawca - automatic release submission daemon | 1 | /* wydawca - automatic release submission daemon -*- c -*- |
2 | Copyright (C) 2007, 2009, 2010 Sergey Poznyakoff | 2 | Copyright (C) 2007, 2009, 2010 Sergey Poznyakoff |
3 | 3 | ||
4 | Wydawca is free software; you can redistribute it and/or modify it | 4 | Wydawca is free software; you can redistribute it and/or modify it |
@@ -17,13 +17,13 @@ | |||
17 | static struct obstack pp_cmd_stack; | 17 | static struct obstack pp_cmd_stack; |
18 | static int pp_cmd_stack_init; | 18 | static int pp_cmd_stack_init; |
19 | 19 | ||
20 | static gl_list_t source_list; | 20 | static struct grecs_list *source_list; |
21 | static gl_list_t tag_list; | 21 | static struct grecs_list *tag_list; |
22 | 22 | ||
23 | static bool | 23 | static int |
24 | string_eq (const void *elt1, const void *elt2) | 24 | string_cmp (const void *elt1, const void *elt2) |
25 | { | 25 | { |
26 | return strcmp ((const char *)elt1, (const char *)elt2) == 0; | 26 | return strcmp ((const char *)elt1, (const char *)elt2); |
27 | } | 27 | } |
28 | 28 | ||
29 | int | 29 | int |
@@ -36,14 +36,17 @@ int | |||
36 | enabled_spool_p (const struct spool *spool) | 36 | enabled_spool_p (const struct spool *spool) |
37 | { | 37 | { |
38 | if (source_list || tag_list) | 38 | if (source_list || tag_list) |
39 | return (source_list && gl_list_search (source_list, spool->source_dir)) | 39 | return (source_list && grecs_list_locate (source_list, spool->source_dir)) |
40 | || (tag_list && gl_list_search (tag_list, spool->tag)); | 40 | || (tag_list && grecs_list_locate (tag_list, spool->tag)); |
41 | return 1; | 41 | return 1; |
42 | } | 42 | } |
43 | 43 | ||
44 | OPTIONS_BEGIN(gnu, "wydawca", | 44 | OPTIONS_BEGIN("wydawca", |
45 | [<wydawca synchronizes files from a set of upload directories with the corresponding distribution sites>], | 45 | [<wydawca synchronizes files from a set of upload directories with the corresponding distribution sites>], |
46 | [<UID [UID...]>]) | 46 | [<UID [UID...]>], |
47 | [<gnu>], | ||
48 | [<copyright_year=2011>], | ||
49 | [<copyright_holder=Sergey Poznyakoff>]) | ||
47 | 50 | ||
48 | GROUP(Selecting program mode) | 51 | GROUP(Selecting program mode) |
49 | 52 | ||
@@ -104,20 +107,22 @@ OPTION(spool,S,TAG, | |||
104 | [<process only spool with the given tag (may be used multiple times)>]) | 107 | [<process only spool with the given tag (may be used multiple times)>]) |
105 | BEGIN | 108 | BEGIN |
106 | if (!tag_list) | 109 | if (!tag_list) |
107 | tag_list = gl_list_create_empty (&gl_linked_list_implementation, | 110 | { |
108 | string_eq, NULL, | 111 | tag_list = grecs_list_create (); |
109 | NULL, false); | 112 | tag_list->cmp = string_cmp; |
110 | gl_list_add_last (tag_list, optarg); | 113 | } |
114 | grecs_list_append (tag_list, optarg); | ||
111 | END | 115 | END |
112 | 116 | ||
113 | OPTION(source,s,SOURCE-DIR, | 117 | OPTION(source,s,SOURCE-DIR, |
114 | [<process only spool with the given source (may be used multiple times)>]) | 118 | [<process only spool with the given source (may be used multiple times)>]) |
115 | BEGIN | 119 | BEGIN |
116 | if (!source_list) | 120 | if (!source_list) |
117 | source_list = gl_list_create_empty (&gl_linked_list_implementation, | 121 | { |
118 | string_eq, NULL, | 122 | source_list = grecs_list_create (); |
119 | NULL, false); | 123 | source_list->cmp = string_cmp; |
120 | gl_list_add_last (source_list, optarg); | 124 | } |
125 | grecs_list_append (source_list, optarg); | ||
121 | END | 126 | END |
122 | 127 | ||
123 | GROUP(Logging) | 128 | GROUP(Logging) |
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) | |||
248 | grecs_error (locus, 0, _("not enough arguments")); | 248 | grecs_error (locus, 0, _("not enough arguments")); |
249 | return NULL; | 249 | return NULL; |
250 | } | 250 | } |
251 | value = value->v.arg.v + n; | 251 | value = value->v.arg.v[n]; |
252 | if (value->type != type) | 252 | if (value->type != type) |
253 | { | 253 | { |
254 | grecs_error (locus, 0, _("argument %d has wrong type"), n); | 254 | grecs_error (locus, 0, _("argument %d has wrong type"), n); |
@@ -300,12 +300,11 @@ cb_email_address (enum grecs_callback_command cmd, | |||
300 | 300 | ||
301 | case GRECS_TYPE_LIST: | 301 | case GRECS_TYPE_LIST: |
302 | { | 302 | { |
303 | const void *p; | 303 | struct grecs_list_entry *ep; |
304 | gl_list_iterator_t itr = gl_list_iterator (value->v.list); | 304 | |
305 | 305 | for (ep = value->v.list->head; ep; ep = ep->next) | |
306 | while (gl_list_iterator_next (&itr, &p, NULL)) | ||
307 | { | 306 | { |
308 | const grecs_value_t *vp = p; | 307 | const grecs_value_t *vp = ep->data; |
309 | mu_address_t a; | 308 | mu_address_t a; |
310 | if (assert_string_arg (locus, cmd, vp)) | 309 | if (assert_string_arg (locus, cmd, vp)) |
311 | return 1; | 310 | return 1; |
@@ -500,7 +499,7 @@ parse_statmask (grecs_locus_t *loc, grecs_value_t *val, unsigned long *pmask) | |||
500 | for (i = 0; i < val->v.arg.c; i++) | 499 | for (i = 0; i < val->v.arg.c; i++) |
501 | { | 500 | { |
502 | unsigned long x; | 501 | unsigned long x; |
503 | if (parse_single_statmask (loc, &val->v.arg.v[i], &x, &invert)) | 502 | if (parse_single_statmask (loc, val->v.arg.v[i], &x, &invert)) |
504 | err = 1; | 503 | err = 1; |
505 | else if (invert) | 504 | else if (invert) |
506 | mask &= ~x; | 505 | mask &= ~x; |
@@ -512,12 +511,11 @@ parse_statmask (grecs_locus_t *loc, grecs_value_t *val, unsigned long *pmask) | |||
512 | 511 | ||
513 | case GRECS_TYPE_LIST: | 512 | case GRECS_TYPE_LIST: |
514 | { | 513 | { |
515 | const void *p; | 514 | struct grecs_list_entry *ep; |
516 | gl_list_iterator_t itr = gl_list_iterator (val->v.list); | ||
517 | 515 | ||
518 | while (gl_list_iterator_next (&itr, &p, NULL)) | 516 | for (ep = val->v.list->head; ep; ep = ep->next) |
519 | { | 517 | { |
520 | const grecs_value_t *vp = p; | 518 | const grecs_value_t *vp = ep->data; |
521 | unsigned long x; | 519 | unsigned long x; |
522 | 520 | ||
523 | if (parse_single_statmask (loc, vp, &x, &invert)) | 521 | if (parse_single_statmask (loc, vp, &x, &invert)) |
@@ -686,20 +684,20 @@ cb_define_message (enum grecs_callback_command cmd, | |||
686 | return 1; | 684 | return 1; |
687 | } | 685 | } |
688 | 686 | ||
689 | if (value->v.arg.v[0].type != GRECS_TYPE_STRING) | 687 | if (value->v.arg.v[0]->type != GRECS_TYPE_STRING) |
690 | { | 688 | { |
691 | grecs_error (locus, 0, _("first argument not a string")); | 689 | grecs_error (locus, 0, _("first argument not a string")); |
692 | return 1; | 690 | return 1; |
693 | } | 691 | } |
694 | ident = value->v.arg.v[0].v.string; | 692 | ident = value->v.arg.v[0]->v.string; |
695 | 693 | ||
696 | if (value->v.arg.v[1].type != GRECS_TYPE_STRING) | 694 | if (value->v.arg.v[1]->type != GRECS_TYPE_STRING) |
697 | { | 695 | { |
698 | grecs_error (locus, 0, _("second argument not a string")); | 696 | grecs_error (locus, 0, _("second argument not a string")); |
699 | return 1; | 697 | return 1; |
700 | } | 698 | } |
701 | 699 | ||
702 | register_message_template (ident, value->v.arg.v[1].v.string); | 700 | register_message_template (ident, value->v.arg.v[1]->v.string); |
703 | return 0; | 701 | return 0; |
704 | } | 702 | } |
705 | 703 | ||
@@ -992,10 +990,10 @@ cb_dictionary_type (enum grecs_callback_command cmd, | |||
992 | 990 | ||
993 | static int | 991 | static int |
994 | cb_dictionary_params (enum grecs_callback_command cmd, | 992 | cb_dictionary_params (enum grecs_callback_command cmd, |
995 | grecs_locus_t *locus, | 993 | grecs_locus_t *locus, |
996 | void *varptr, | 994 | void *varptr, |
997 | grecs_value_t *value, | 995 | grecs_value_t *value, |
998 | void *cb_data) | 996 | void *cb_data) |
999 | { | 997 | { |