aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am4
-rw-r--r--src/cmdline.opt48
-rw-r--r--src/config.c40
-rw-r--r--src/directive.c2
-rw-r--r--src/diskio.c14
-rw-r--r--src/gpg.c4
-rw-r--r--src/job.c278
-rw-r--r--src/mail.c15
-rw-r--r--src/net.c227
-rw-r--r--src/null.c22
-rw-r--r--src/pidfile.c90
-rw-r--r--src/process.c66
-rw-r--r--src/triplet.c18
-rw-r--r--src/verify.c4
-rw-r--r--src/vtab.c8
-rw-r--r--src/wydawca.c112
-rw-r--r--src/wydawca.h83
17 files changed, 885 insertions, 150 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 7ba9832..903b754 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -25,8 +25,11 @@ wydawca_SOURCES=\
25 exec.c\ 25 exec.c\
26 gpg.c\ 26 gpg.c\
27 interval.c\ 27 interval.c\
28 job.c\
28 meta.c\ 29 meta.c\
29 method.c\ 30 method.c\
31 net.c\
32 pidfile.c\
30 process.c\ 33 process.c\
31 sql.c\ 34 sql.c\
32 sql.h\ 35 sql.h\
@@ -56,6 +59,7 @@ LDADD=../gconf/libgconf.a ../gnu/libgnu.a @SQLLIB@ @GPGMELIB@ @MAILUTILS_LIBS@
56INCLUDES = -I$(top_srcdir)/gconf -I$(top_srcdir)/gnu -I../gnu @MAILUTILS_INCLUDES@ 59INCLUDES = -I$(top_srcdir)/gconf -I$(top_srcdir)/gnu -I../gnu @MAILUTILS_INCLUDES@
57AM_CPPFLAGS= \ 60AM_CPPFLAGS= \
58 -DSYSCONFDIR=\"$(sysconfdir)\"\ 61 -DSYSCONFDIR=\"$(sysconfdir)\"\
62 -DLOCALSTATEDIR=\"$(localstatedir)\"\
59 -DDEFAULT_VERSION_INCLUDE_DIR=\"$(incdir)\"\ 63 -DDEFAULT_VERSION_INCLUDE_DIR=\"$(incdir)\"\
60 -DDEFAULT_INCLUDE_DIR=\"$(pkgdatadir)/include\"\ 64 -DDEFAULT_INCLUDE_DIR=\"$(pkgdatadir)/include\"\
61 -DDEFAULT_PREPROCESSOR="$(DEFAULT_PREPROCESSOR)" 65 -DDEFAULT_PREPROCESSOR="$(DEFAULT_PREPROCESSOR)"
diff --git a/src/cmdline.opt b/src/cmdline.opt
index 53bdd00..b61517b 100644
--- a/src/cmdline.opt
+++ b/src/cmdline.opt
@@ -18,6 +18,7 @@ static struct obstack pp_cmd_stack;
18static int pp_cmd_stack_init; 18static int pp_cmd_stack_init;
19 19
20static gl_list_t source_list; 20static gl_list_t source_list;
21static gl_list_t tag_list;
21 22
22static bool 23static bool
23source_eq (const void *elt1, const void *elt2) 24source_eq (const void *elt1, const void *elt2)
@@ -28,9 +29,10 @@ source_eq (const void *elt1, const void *elt2)
28int 29int
29enabled_spool_p (const struct spool *spool) 30enabled_spool_p (const struct spool *spool)
30{ 31{
31 if (!source_list) 32 if (source_list || tag_list)
32 return 1; 33 return (source_list && gl_list_search (source_list, spool->source_dir))
33 return !!gl_list_search (source_list, spool->source_dir); 34 || (tag_list && gl_list_search (tag_list, spool->tag));
35 return 1;
34} 36}
35 37
36OPTIONS_BEGIN(gnu, "wydawca", 38OPTIONS_BEGIN(gnu, "wydawca",
@@ -61,12 +63,47 @@ BEGIN
61 dry_run_mode = 1; 63 dry_run_mode = 1;
62END 64END
63 65
66OPTION(cron,,,
67 [<force cron mode>])
68BEGIN
69 cron_option = 1;
70 log_to_stderr = 0;
71END
72
73OPTION(force,,,
74 [<force start up even if the pid file already exists>])
75BEGIN
76 force_startup = 1;
77END
78
79OPTION(foreground,,,
80 [<foreground mode>])
81BEGIN
82 foreground_option = 1;
83END
84
85OPTION(single-process,,,
86 [<single process mode>])
87BEGIN
88 single_process_option = 1;
89END
90
64OPTION(config-file,c,FILE, 91OPTION(config-file,c,FILE,
65 [<use FILE instead of the default configuration>]) 92 [<use FILE instead of the default configuration>])
66BEGIN 93BEGIN
67 conffile = optarg; 94 conffile = optarg;
68END 95END
69 96
97OPTION(spool,S,TAG,
98 [<process only spool with the given tag>])
99BEGIN
100 if (!tag_list)
101 tag_list = gl_list_create_empty (&gl_linked_list_implementation,
102 source_eq, NULL,
103 NULL, false);
104 gl_list_add_last (tag_list, optarg);
105END
106
70OPTION(source,s,SOURCE-DIR, 107OPTION(source,s,SOURCE-DIR,
71 [<process only spool with the given source (may be used multiple times)>]) 108 [<process only spool with the given source (may be used multiple times)>])
72BEGIN 109BEGIN
@@ -79,9 +116,8 @@ END
79 116
80GROUP(Logging) 117GROUP(Logging)
81 118
82OPTION(cron,,, 119OPTION(syslog,,,
83 [<log to syslog>]) 120 [<log to syslog>])
84ALIAS(syslog)
85BEGIN 121BEGIN
86 log_to_stderr = 0; 122 log_to_stderr = 0;
87END 123END
diff --git a/src/config.c b/src/config.c
index dd444fe..94afb20 100644
--- a/src/config.c
+++ b/src/config.c
@@ -263,11 +263,6 @@ cb_mailer (enum gconf_callback_command cmd,
263 263
264 if (assert_string_arg (locus, cmd, value)) 264 if (assert_string_arg (locus, cmd, value))
265 return 1; 265 return 1;
266 if (cmd != gconf_callback_set_value)
267 {
268 gconf_error (locus, 0, _("Unexpected block statement"));
269 return 1;
270 }
271 rc = mu_mailer_create (&mailer, value->v.string); 266 rc = mu_mailer_create (&mailer, value->v.string);
272 if (rc) 267 if (rc)
273 gconf_error (locus, 0, _("cannot create mailer `%s': %s"), 268 gconf_error (locus, 0, _("cannot create mailer `%s': %s"),
@@ -1085,22 +1080,17 @@ cb_access_method (enum gconf_callback_command cmd,
1085} 1080}
1086 1081
1087static int 1082static int
1088cb_destination_url (enum gconf_callback_command cmd, 1083cb_url (enum gconf_callback_command cmd,
1089 gconf_locus_t *locus, 1084 gconf_locus_t *locus,
1090 void *varptr, 1085 void *varptr,
1091 gconf_value_t *value, 1086 gconf_value_t *value,
1092 void *cb_data) 1087 void *cb_data)
1093{ 1088{
1094 mu_url_t *purl = varptr, url; 1089 mu_url_t *purl = varptr, url;
1095 int rc; 1090 int rc;
1096 1091
1097 if (assert_string_arg (locus, cmd, value)) 1092 if (assert_string_arg (locus, cmd, value))
1098 return 1; 1093 return 1;
1099 if (cmd != gconf_callback_set_value)
1100 {
1101 gconf_error (locus, 0, _("Unexpected block statement"));
1102 return 1;
1103 }
1104 rc = mu_url_create (&url, value->v.string); 1094 rc = mu_url_create (&url, value->v.string);
1105 if (rc) 1095 if (rc)
1106 { 1096 {
@@ -1122,11 +1112,15 @@ cb_destination_url (enum gconf_callback_command cmd,
1122 1112
1123 1113
1124static struct gconf_keyword spool_kw[] = { 1114static struct gconf_keyword spool_kw[] = {
1115 { "url", N_("arg"), N_("URL corresponding to this spool"),
1116 gconf_type_string, NULL, offsetof(struct spool, url) },
1117 { "alias", N_("arg"), N_("Aliases"),
1118 gconf_type_string|GCONF_LIST, NULL, offsetof(struct spool, aliases) },
1125 { "source", N_("dir"), N_("Source directory"), 1119 { "source", N_("dir"), N_("Source directory"),
1126 gconf_type_string, NULL, offsetof(struct spool, source_dir) }, 1120 gconf_type_string, NULL, offsetof(struct spool, source_dir) },
1127 { "destination", N_("dir"), N_("Destination directory"), 1121 { "destination", N_("dir"), N_("Destination directory"),
1128 gconf_type_string, NULL, offsetof(struct spool, dest_url), 1122 gconf_type_string, NULL, offsetof(struct spool, dest_url),
1129 cb_destination_url }, 1123 cb_url },
1130 { "file-sweep-time", N_("interval"), N_("Define file sweep time"), 1124 { "file-sweep-time", N_("interval"), N_("Define file sweep time"),
1131 gconf_type_string, NULL, offsetof(struct spool, file_sweep_time), 1125 gconf_type_string, NULL, offsetof(struct spool, file_sweep_time),
1132 cb_interval }, 1126 cb_interval },
@@ -1164,7 +1158,7 @@ cb_spool (enum gconf_callback_command cmd,
1164 return 1; 1158 return 1;
1165 } 1159 }
1166 spool = xzalloc (sizeof (*spool)); 1160 spool = xzalloc (sizeof (*spool));
1167 spool->url = xstrdup (value->v.string); 1161 spool->tag = xstrdup (value->v.string);
1168 spool->file_sweep_time = file_sweep_time; 1162 spool->file_sweep_time = file_sweep_time;
1169 for (i = 0; i < NITEMS (spool->access_method); i++) 1163 for (i = 0; i < NITEMS (spool->access_method); i++)
1170 spool->access_method[i] = default_access_method[i]; 1164 spool->access_method[i] = default_access_method[i];
@@ -1233,6 +1227,18 @@ cb_spool (enum gconf_callback_command cmd,
1233 1227
1234 1228
1235static struct gconf_keyword wydawca_kw[] = { 1229static struct gconf_keyword wydawca_kw[] = {
1230 { "daemon", NULL, N_("Enable daemon mode"),
1231 gconf_type_bool, &daemon_mode },
1232 { "foreground", NULL, N_("Start in foreground even in daemon mode"),
1233 gconf_type_bool, &foreground },
1234 { "single-process", NULL, N_("Do not spawn subprocesses"),
1235 gconf_type_bool, &single_process },
1236 { "wakeup-interval", N_("time"), N_("Set wake-up interval"),
1237 gconf_type_string, &wakeup_interval, 0, cb_interval },
1238 { "pidfile", N_("file"), N_("Set pid file name"),
1239 gconf_type_string, &pidfile },
1240 { "listen", N_("socket"), N_("Listen on this address"),
1241 gconf_type_sockaddr, &listen_sockaddr, },
1236 { "mailer", N_("url"), N_("Set mailer URL"), 1242 { "mailer", N_("url"), N_("Set mailer URL"),
1237 gconf_type_string, &mailer, 0, cb_mailer },