diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2013-03-12 15:03:59 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2013-03-12 15:22:13 +0200 |
commit | 1ba8cf95a5f536d4aa6293f9848271a7285bc092 (patch) | |
tree | dede8a4bccb1daad8b67530d87845e7fe05749e6 /src | |
parent | 293108d7806aa3c0c5e706237b3788b261779e66 (diff) | |
download | wydawca-1ba8cf95a5f536d4aa6293f9848271a7285bc092.tar.gz wydawca-1ba8cf95a5f536d4aa6293f9848271a7285bc092.tar.bz2 |
Namespace normalization (2). Provide installable headers.
* Makefile.am (SUBDIRS): Add include.
* configure.ac: Build include/*/Makefile
Set-up grecs as a shared convenience library. Install
its headers.
* include/Makefile.am: New file.
* include/wydawca/Makefile.am: New file.
* include/wydawca/cfg.h: New file.
* include/wydawca/wydawca.h: New file.
* modules/mailutils/Makefile.am (AM_CPPFLAGS): Add include/
* src/Makefile.am (LDADD): Use @GRECS_LDADD@
(AM_CPPFLAGS): Add include/.
* tests/Makefile.am: Likewise.
* src/wydawca.h: Include wydawca/wydawca.h.
(__cat2__, __cat3__): Move to installable header and rename.
(struct wy_user): Move to installable header.
(struct file_triplet): Rename to wy_triplet. All uses changed.
(enum notification_event): Rename to wy_event and move to
installable header.
(struct metadef): Rename to wy_metadef and move to
installable header.
(dry_run_mode): Rename to wy_dry_run and move to
installable header.
(wydawca_gpg_homedir): Rename to wy_gpg_homedir and move to
installable header.
(wy_version, wy_debug_level, wy_log_to_stderr)
(wy_log_facility, wy_syslog_tag)
(wy_log,wy_dbg): Move to installable header.
* modules/mailutils/mod_mailutils.c: Update.
* src/cmdline.opt
* src/config.c
* src/directive.c
* src/diskio.c
* src/event.c
* src/gpg.c
* src/job.c
* src/meta.c
* src/module.c
* src/null.c
* src/timer.c
* src/triplet.c
* src/verify.c
* src/vtab.c
* src/watcher.c
* src/wydawca.c
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 3 | ||||
-rw-r--r-- | src/cmdline.opt | 2 | ||||
-rw-r--r-- | src/config.c | 26 | ||||
-rw-r--r-- | src/directive.c | 28 | ||||
-rw-r--r-- | src/diskio.c | 46 | ||||
-rw-r--r-- | src/event.c | 6 | ||||
-rw-r--r-- | src/gpg.c | 14 | ||||
-rw-r--r-- | src/job.c | 12 | ||||
-rw-r--r-- | src/meta.c | 39 | ||||
-rw-r--r-- | src/module.c | 4 | ||||
-rw-r--r-- | src/null.c | 10 | ||||
-rw-r--r-- | src/timer.c | 8 | ||||
-rw-r--r-- | src/triplet.c | 176 | ||||
-rw-r--r-- | src/verify.c | 6 | ||||
-rw-r--r-- | src/vtab.c | 8 | ||||
-rw-r--r-- | src/watcher.c | 2 | ||||
-rw-r--r-- | src/wydawca.c | 16 | ||||
-rw-r--r-- | src/wydawca.h | 150 |
18 files changed, 268 insertions, 288 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 7b350e5..c4be551 100644 --- a/src/Makefile.am +++ b/src/Makefile.am | |||
@@ -67,8 +67,9 @@ SUFFIXES=.opt .c .h | |||
67 | incdir=$(pkgdatadir)/$(VERSION)/include | 67 | incdir=$(pkgdatadir)/$(VERSION)/include |
68 | inc_DATA = $(PP_SETUP_FILE) | 68 | inc_DATA = $(PP_SETUP_FILE) |
69 | 69 | ||
70 | LDADD=../grecs/src/libgrecs.a @SQLLIB@ @GPGMELIB@ @LIBLTDL@ | 70 | LDADD=@GRECS_LDADD@ @SQLLIB@ @GPGMELIB@ @LIBLTDL@ |
71 | AM_CPPFLAGS= \ | 71 | AM_CPPFLAGS= \ |
72 | -I$(top_srcdir)/include\ | ||
72 | -I$(top_srcdir)/grecs/src/ @MAILUTILS_INCLUDES@\ | 73 | -I$(top_srcdir)/grecs/src/ @MAILUTILS_INCLUDES@\ |
73 | -DSYSCONFDIR=\"$(sysconfdir)\"\ | 74 | -DSYSCONFDIR=\"$(sysconfdir)\"\ |
74 | -DLOCALSTATEDIR=\"$(localstatedir)\"\ | 75 | -DLOCALSTATEDIR=\"$(localstatedir)\"\ |
diff --git a/src/cmdline.opt b/src/cmdline.opt index ef89222..039dc6b 100644 --- a/src/cmdline.opt +++ b/src/cmdline.opt | |||
@@ -69,7 +69,7 @@ OPTION(dry-run,n,, | |||
69 | BEGIN | 69 | BEGIN |
70 | wy_log_to_stderr = 1; | 70 | wy_log_to_stderr = 1; |
71 | wy_debug_level++; | 71 | wy_debug_level++; |
72 | dry_run_mode = 1; | 72 | wy_dry_run = 1; |
73 | END | 73 | END |
74 | 74 | ||
75 | OPTION(cron,,, | 75 | OPTION(cron,,, |
diff --git a/src/config.c b/src/config.c index b89beff..eef4ee1 100644 --- a/src/config.c +++ b/src/config.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* wydawca - automatic release submission daemon | 1 | /* wydawca - automatic release submission daemon |
2 | Copyright (C) 2007-2012 Sergey Poznyakoff | 2 | Copyright (C) 2007-2013 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 |
5 | under the terms of the GNU General Public License as published by the | 5 | under the terms of the GNU General Public License as published by the |
@@ -205,17 +205,17 @@ safe_file_name_alloc(const char *file_name) | |||
205 | } | 205 | } |
206 | 206 | ||
207 | static struct keyword event_tab[] = { | 207 | static struct keyword event_tab[] = { |
208 | { "success", ev_success }, | 208 | { "success", wy_ev_success }, |
209 | { "bad-ownership", ev_bad_ownership }, | 209 | { "bad-ownership", wy_ev_bad_ownership }, |
210 | { "bad-directive-signature", ev_bad_directive_signature }, | 210 | { "bad-directive-signature", wy_ev_bad_directive_signature }, |
211 | { "bad-detached-signature", ev_bad_detached_signature }, | 211 | { "bad-detached-signature", wy_ev_bad_detached_signature }, |
212 | { "check-failure", ev_check_fail }, | 212 | { "check-failure", wy_ev_check_fail }, |
213 | { "statistics", ev_statistics }, | 213 | { "statistics", wy_ev_statistics }, |
214 | {NULL} | 214 | {NULL} |
215 | }; | 215 | }; |
216 | 216 | ||
217 | const char * | 217 | const char * |
218 | notification_event_str(enum notification_event evt) | 218 | wy_event_str(enum wy_event evt) |
219 | { | 219 | { |
220 | const char *ret; | 220 | const char *ret; |
221 | if (tok_to_keyword(evt, event_tab, &ret)) { | 221 | if (tok_to_keyword(evt, event_tab, &ret)) { |
@@ -229,8 +229,8 @@ notification_event_str(enum notification_event evt) | |||
229 | } | 229 | } |
230 | 230 | ||
231 | int | 231 | int |
232 | string_to_notification_event(grecs_locus_t *locus, const char *val, | 232 | string_to_wy_event(grecs_locus_t *locus, const char *val, |
233 | enum notification_event *pret) | 233 | enum wy_event *pret) |
234 | { | 234 | { |
235 | int res; | 235 | int res; |
236 | if (keyword_to_tok(val, event_tab, &res)) { | 236 | if (keyword_to_tok(val, event_tab, &res)) { |
@@ -717,13 +717,13 @@ static int | |||
717 | cb_event(enum grecs_callback_command cmd, grecs_node_t *node, | 717 | cb_event(enum grecs_callback_command cmd, grecs_node_t *node, |
718 | void *varptr, void *cb_data) | 718 | void *varptr, void *cb_data) |
719 | { | 719 | { |
720 | enum notification_event *pev = varptr; | 720 | enum wy_event *pev = varptr; |
721 | grecs_locus_t *locus = &node->locus; | 721 | grecs_locus_t *locus = &node->locus; |
722 | grecs_value_t *value = node->v.value; | 722 | grecs_value_t *value = node->v.value; |
723 | 723 | ||
724 | if (wy_assert_string_arg(locus, cmd, value)) | 724 | if (wy_assert_string_arg(locus, cmd, value)) |
725 | return 1; | 725 | return 1; |
726 | string_to_notification_event(&value->locus, value->v.string, pev); | 726 | string_to_wy_event(&value->locus, value->v.string, pev); |
727 | return 0; | 727 | return 0; |
728 | } | 728 | } |
729 | 729 | ||
@@ -1334,7 +1334,7 @@ static struct grecs_keyword wydawca_kw[] = { | |||
1334 | grecs_type_string, GRECS_LIST, &all_spool_aliases }, | 1334 | grecs_type_string, GRECS_LIST, &all_spool_aliases }, |
1335 | 1335 | ||
1336 | { "gpg-homedir", NULL, N_("GPG home directory"), | 1336 | { "gpg-homedir", NULL, N_("GPG home directory"), |
1337 | grecs_type_string, GRECS_DFLT, &wydawca_gpg_homedir }, | 1337 | grecs_type_string, GRECS_DFLT, &wy_gpg_homedir }, |
1338 | 1338 | ||
1339 | {NULL} | 1339 | {NULL} |
1340 | }; | 1340 | }; |
diff --git a/src/directive.c b/src/directive.c index 481e267..c7e1817 100644 --- a/src/directive.c +++ b/src/directive.c | |||
@@ -20,7 +20,7 @@ | |||
20 | 20 | ||
21 | /* Parse directives from TRP->blurb. Fill TRP->directive */ | 21 | /* Parse directives from TRP->blurb. Fill TRP->directive */ |
22 | int | 22 | int |
23 | directive_parse(struct file_triplet *trp) | 23 | directive_parse(struct wy_triplet *trp) |
24 | { | 24 | { |
25 | size_t dcount, i, j; | 25 | size_t dcount, i, j; |
26 | char *p; | 26 | char *p; |
@@ -61,7 +61,7 @@ directive_parse(struct file_triplet *trp) | |||
61 | /* If a directive KEY exists in the triplet TRP, return 0 and point PVAL | 61 | /* If a directive KEY exists in the triplet TRP, return 0 and point PVAL |
62 | (unless it is NULL) to its value. Othervise, return 1. */ | 62 | (unless it is NULL) to its value. Othervise, return 1. */ |
63 | int | 63 | int |
64 | directive_get_value(struct file_triplet *trp, const char *key, | 64 | directive_get_value(struct wy_triplet *trp, const char *key, |
65 | const char **pval) | 65 | const char **pval) |
66 | { | 66 | { |
67 | int keylen = strlen(key); | 67 | int keylen = strlen(key); |
@@ -94,7 +94,7 @@ directive_get_value(struct file_triplet *trp, const char *key, | |||
94 | 94 | ||
95 | If N points past all the directive, the function returns 0. */ | 95 | If N points past all the directive, the function returns 0. */ |
96 | static int | 96 | static int |
97 | _directive_seq_get(int n, struct file_triplet *trp, | 97 | _directive_seq_get(int n, struct wy_triplet *trp, |
98 | const char **pkey, const char **pval) | 98 | const char **pkey, const char **pval) |
99 | { | 99 | { |
100 | char *p; | 100 | char *p; |
@@ -121,7 +121,7 @@ _directive_seq_get(int n, struct file_triplet *trp, | |||
121 | /* Get the first directive from TRP. Point *PKEY to its keyword and | 121 | /* Get the first directive from TRP. Point *PKEY to its keyword and |
122 | *PVAL to its value. Return 1 on success, 0 on failure. */ | 122 | *PVAL to its value. Return 1 on success, 0 on failure. */ |
123 | int | 123 | int |
124 | directive_first(struct file_triplet *trp, const char **pkey, const char **pval) | 124 | directive_first(struct wy_triplet *trp, const char **pkey, const char **pval) |
125 | { | 125 | { |
126 | int n = 0; | 126 | int n = 0; |
127 | return _directive_seq_get(n, trp, pkey, pval); | 127 | return _directive_seq_get(n, trp, pkey, pval); |
@@ -131,7 +131,7 @@ directive_first(struct file_triplet *trp, const char **pkey, const char **pval) | |||
131 | *PVAL to its value. Return 1 on success, 0 on failure. | 131 | *PVAL to its value. Return 1 on success, 0 on failure. |
132 | Return non-0 on success, 0 on failure */ | 132 | Return non-0 on success, 0 on failure */ |
133 | int | 133 | int |
134 | directive_next(struct file_triplet *trp, int n, | 134 | directive_next(struct wy_triplet *trp, int n, |
135 | const char **pkey, const char **pval) | 135 | const char **pkey, const char **pval) |
136 | { | 136 | { |
137 | return _directive_seq_get(n, trp, pkey, pval); | 137 | return _directive_seq_get(n, trp, pkey, pval); |
@@ -166,7 +166,7 @@ directive_unpack_version(unsigned version, char **pbuf, size_t * psize) | |||
166 | /* Return true if the directory file version of the triplet TRP | 166 | /* Return true if the directory file version of the triplet TRP |
167 | is within the inclusive range FROM and TO (packed) */ | 167 | is within the inclusive range FROM and TO (packed) */ |
168 | int | 168 | int |
169 | directive_version_in_range_p(struct file_triplet *trp, | 169 | directive_version_in_range_p(struct wy_triplet *trp, |
170 | unsigned from, unsigned to) | 170 | unsigned from, unsigned to) |
171 | { | 171 | { |
172 | const char *val; | 172 | const char *val; |
@@ -238,7 +238,7 @@ find_directive(const char *key) | |||
238 | 238 | ||
239 | /* Return 0 if the directory file format of the triplet TRP is OK. */ | 239 | /* Return 0 if the directory file format of the triplet TRP is OK. */ |
240 | int | 240 | int |
241 | verify_directive_format(struct file_triplet *trp) | 241 | verify_directive_format(struct wy_triplet *trp) |
242 | { | 242 | { |
243 | int n, dnum; | 243 | int n, dnum; |
244 | const char *key; | 244 | const char *key; |
@@ -387,7 +387,7 @@ stderr_redirector(const char *tag) | |||
387 | } | 387 | } |
388 | 388 | ||
389 | static int | 389 | static int |
390 | run_check_script(const char *script, struct file_triplet *trp, | 390 | run_check_script(const char *script, struct wy_triplet *trp, |
391 | const char *descr) | 391 | const char *descr) |
392 | { | 392 | { |
393 | static char *script_file; | 393 | static char *script_file; |
@@ -527,7 +527,7 @@ run_check_script(const char *script, struct file_triplet *trp, | |||
527 | } | 527 | } |