diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 4 | ||||
-rw-r--r-- | src/cmdline.opt | 48 | ||||
-rw-r--r-- | src/config.c | 40 | ||||
-rw-r--r-- | src/directive.c | 2 | ||||
-rw-r--r-- | src/diskio.c | 14 | ||||
-rw-r--r-- | src/gpg.c | 4 | ||||
-rw-r--r-- | src/job.c | 278 | ||||
-rw-r--r-- | src/mail.c | 15 | ||||
-rw-r--r-- | src/net.c | 227 | ||||
-rw-r--r-- | src/null.c | 22 | ||||
-rw-r--r-- | src/pidfile.c | 90 | ||||
-rw-r--r-- | src/process.c | 66 | ||||
-rw-r--r-- | src/triplet.c | 18 | ||||
-rw-r--r-- | src/verify.c | 4 | ||||
-rw-r--r-- | src/vtab.c | 8 | ||||
-rw-r--r-- | src/wydawca.c | 112 | ||||
-rw-r--r-- | src/wydawca.h | 83 |
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@ | |||
56 | INCLUDES = -I$(top_srcdir)/gconf -I$(top_srcdir)/gnu -I../gnu @MAILUTILS_INCLUDES@ | 59 | INCLUDES = -I$(top_srcdir)/gconf -I$(top_srcdir)/gnu -I../gnu @MAILUTILS_INCLUDES@ |
57 | AM_CPPFLAGS= \ | 60 | AM_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; | |||
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 gl_list_t source_list; |
21 | static gl_list_t tag_list; | ||
21 | 22 | ||
22 | static bool | 23 | static bool |
23 | source_eq (const void *elt1, const void *elt2) | 24 | source_eq (const void *elt1, const void *elt2) |
@@ -28,9 +29,10 @@ source_eq (const void *elt1, const void *elt2) | |||
28 | int | 29 | int |
29 | enabled_spool_p (const struct spool *spool) | 30 | enabled_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 | ||
36 | OPTIONS_BEGIN(gnu, "wydawca", | 38 | OPTIONS_BEGIN(gnu, "wydawca", |
@@ -61,12 +63,47 @@ BEGIN | |||
61 | dry_run_mode = 1; | 63 | dry_run_mode = 1; |
62 | END | 64 | END |
63 | 65 | ||
66 | OPTION(cron,,, | ||
67 | [<force cron mode>]) | ||
68 | BEGIN | ||
69 | cron_option = 1; | ||
70 | log_to_stderr = 0; | ||
71 | END | ||
72 | |||
73 | OPTION(force,,, | ||
74 | [<force start up even if the pid file already exists>]) | ||
75 | BEGIN | ||
76 | force_startup = 1; | ||
77 | END | ||
78 | |||
79 | OPTION(foreground,,, | ||
80 | [<foreground mode>]) | ||
81 | BEGIN | ||
82 | foreground_option = 1; | ||
83 | END | ||
84 | |||
85 | OPTION(single-process,,, | ||
86 | [<single process mode>]) | ||
87 | BEGIN | ||
88 | single_process_option = 1; | ||
89 | END | ||
90 | |||
64 | OPTION(config-file,c,FILE, | 91 | OPTION(config-file,c,FILE, |
65 | [<use FILE instead of the default configuration>]) | 92 | [<use FILE instead of the default configuration>]) |
66 | BEGIN | 93 | BEGIN |
67 | conffile = optarg; | 94 | conffile = optarg; |
68 | END | 95 | END |
69 | 96 | ||
97 | OPTION(spool,S,TAG, | ||
98 | [<process only spool with the given tag>]) | ||
99 | BEGIN | ||
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); | ||
105 | END | ||
106 | |||
70 | OPTION(source,s,SOURCE-DIR, | 107 | OPTION(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)>]) |
72 | BEGIN | 109 | BEGIN |
@@ -79,9 +116,8 @@ END | |||
79 | 116 | ||
80 | GROUP(Logging) | 117 | GROUP(Logging) |
81 | 118 | ||
82 | OPTION(cron,,, | 119 | OPTION(syslog,,, |
83 | [<log to syslog>]) | 120 | [<log to syslog>]) |
84 | ALIAS(syslog) | ||
85 | BEGIN | 121 | BEGIN |
86 | log_to_stderr = 0; | 122 | log_to_stderr = 0; |
87 | END | 123 | END |
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 | ||
1087 | static int | 1082 | static int |
1088 | cb_destination_url (enum gconf_callback_command cmd, | 1083 | cb_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 | ||
1124 | static struct gconf_keyword spool_kw[] = { | 1114 | static 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 | ||
1235 | static struct gconf_keyword wydawca_kw[] = { | 1229 | static 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 }, |