aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2013-03-12 15:03:59 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2013-03-12 15:22:13 +0200
commit1ba8cf95a5f536d4aa6293f9848271a7285bc092 (patch)
treedede8a4bccb1daad8b67530d87845e7fe05749e6 /src
parent293108d7806aa3c0c5e706237b3788b261779e66 (diff)
downloadwydawca-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.am3
-rw-r--r--src/cmdline.opt2
-rw-r--r--src/config.c26
-rw-r--r--src/directive.c28
-rw-r--r--src/diskio.c46
-rw-r--r--src/event.c6
-rw-r--r--src/gpg.c14
-rw-r--r--src/job.c12
-rw-r--r--src/meta.c39
-rw-r--r--src/module.c4
-rw-r--r--src/null.c10
-rw-r--r--src/timer.c8
-rw-r--r--src/triplet.c176
-rw-r--r--src/verify.c6
-rw-r--r--src/vtab.c8
-rw-r--r--src/watcher.c2
-rw-r--r--src/wydawca.c16
-rw-r--r--src/wydawca.h150
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
67incdir=$(pkgdatadir)/$(VERSION)/include 67incdir=$(pkgdatadir)/$(VERSION)/include
68inc_DATA = $(PP_SETUP_FILE) 68inc_DATA = $(PP_SETUP_FILE)
69 69
70LDADD=../grecs/src/libgrecs.a @SQLLIB@ @GPGMELIB@ @LIBLTDL@ 70LDADD=@GRECS_LDADD@ @SQLLIB@ @GPGMELIB@ @LIBLTDL@
71AM_CPPFLAGS= \ 71AM_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,,
69BEGIN 69BEGIN
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;
73END 73END
74 74
75OPTION(cron,,, 75OPTION(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
207static struct keyword event_tab[] = { 207static 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
217const char * 217const char *
218notification_event_str(enum notification_event evt) 218wy_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
231int 231int
232string_to_notification_event(grecs_locus_t *locus, const char *val, 232string_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
717cb_event(enum grecs_callback_command cmd, grecs_node_t *node, 717cb_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 */
22int 22int
23directive_parse(struct file_triplet *trp) 23directive_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. */
63int 63int
64directive_get_value(struct file_triplet *trp, const char *key, 64directive_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. */
96static int 96static 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. */
123int 123int
124directive_first(struct file_triplet *trp, const char **pkey, const char **pval) 124directive_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 */
133int 133int
134directive_next(struct file_triplet *trp, int n, 134directive_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) */
168int 168int
169directive_version_in_range_p(struct file_triplet *trp, 169directive_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. */
240int 240int
241verify_directive_format(struct file_triplet *trp) 241verify_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
389static int 389static int
390run_check_script(const char *script, struct file_triplet *trp, 390run_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}