diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-02-24 00:49:40 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-02-24 00:57:16 +0200 |
commit | 4213ec5ef9695aa504938c0e764ba9a4f08921b2 (patch) | |
tree | 88ac2b2eb01337f0924d687df38b2a163bc94e11 /src/config.c | |
parent | 337a06f32fb530e0e0884fef2f5f630cca9911a1 (diff) | |
download | wydawca-4213ec5ef9695aa504938c0e764ba9a4f08921b2.tar.gz wydawca-4213ec5ef9695aa504938c0e764ba9a4f08921b2.tar.bz2 |
Initial implementation of daemon mode.
* gconf/gconf-gram.y (string_to_sockaddr_: Take struct gconf_sockaddr as the
first argument.
* gconf/gconf.h (struct gconf_sockaddr): New data type.
* src/job.c, src/net.c, src/pidfile.c: New files.
* src/Makefile.am (wydawca_SOURCES): Add job.c, net.c, pidfile.c
* src/cmdline.opt: New options: --cron (change semantics), --force,
--foreground, --single-process, --spool
* src/wydawca.c: New daemon mode.
* src/config.c: New statements: spool.alias, daemon, foreground,
single-process, wakeup-interval, pidfile, listen
* src/directive.c, src/diskio.c, src/gpg.c, src/mail.c, src/null.c,
src/process.c, src/triplet.c, src/verify.c, src/vtab.c, src/wydawca.h: use
static struct spool wherever feasible.
* src/triplet.c: New meta-variable "spool"
* tests/etc/wydawca.rcin: Update.
* tests/upload-dry.at: Update.
Diffstat (limited to 'src/config.c')
-rw-r--r-- | src/config.c | 32 |
1 files changed, 19 insertions, 13 deletions
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, if (assert_string_arg (locus, cmd, value)) return 1; - if (cmd != gconf_callback_set_value) - { - gconf_error (locus, 0, _("Unexpected block statement")); - return 1; - } rc = mu_mailer_create (&mailer, value->v.string); if (rc) gconf_error (locus, 0, _("cannot create mailer `%s': %s"), @@ -1085,7 +1080,7 @@ cb_access_method (enum gconf_callback_command cmd, } static int -cb_destination_url (enum gconf_callback_command cmd, +cb_url (enum gconf_callback_command cmd, gconf_locus_t *locus, void *varptr, gconf_value_t *value, @@ -1096,11 +1091,6 @@ cb_destination_url (enum gconf_callback_command cmd, if (assert_string_arg (locus, cmd, value)) return 1; - if (cmd != gconf_callback_set_value) - { - gconf_error (locus, 0, _("Unexpected block statement")); - return 1; - } rc = mu_url_create (&url, value->v.string); if (rc) { @@ -1122,11 +1112,15 @@ cb_destination_url (enum gconf_callback_command cmd, static struct gconf_keyword spool_kw[] = { + { "url", N_("arg"), N_("URL corresponding to this spool"), + gconf_type_string, NULL, offsetof(struct spool, url) }, + { "alias", N_("arg"), N_("Aliases"), + gconf_type_string|GCONF_LIST, NULL, offsetof(struct spool, aliases) }, { "source", N_("dir"), N_("Source directory"), gconf_type_string, NULL, offsetof(struct spool, source_dir) }, { "destination", N_("dir"), N_("Destination directory"), gconf_type_string, NULL, offsetof(struct spool, dest_url), - cb_destination_url }, + cb_url }, { "file-sweep-time", N_("interval"), N_("Define file sweep time"), gconf_type_string, NULL, offsetof(struct spool, file_sweep_time), cb_interval }, @@ -1164,7 +1158,7 @@ cb_spool (enum gconf_callback_command cmd, return 1; } spool = xzalloc (sizeof (*spool)); - spool->url = xstrdup (value->v.string); + spool->tag = xstrdup (value->v.string); spool->file_sweep_time = file_sweep_time; for (i = 0; i < NITEMS (spool->access_method); i++) spool->access_method[i] = default_access_method[i]; @@ -1233,6 +1227,18 @@ cb_spool (enum gconf_callback_command cmd, static struct gconf_keyword wydawca_kw[] = { + { "daemon", NULL, N_("Enable daemon mode"), + gconf_type_bool, &daemon_mode }, + { "foreground", NULL, N_("Start in foreground even in daemon mode"), + gconf_type_bool, &foreground }, + { "single-process", NULL, N_("Do not spawn subprocesses"), + gconf_type_bool, &single_process }, + { "wakeup-interval", N_("time"), N_("Set wake-up interval"), + gconf_type_string, &wakeup_interval, 0, cb_interval }, + { "pidfile", N_("file"), N_("Set pid file name"), + gconf_type_string, &pidfile }, + { "listen", N_("socket"), N_("Listen on this address"), + gconf_type_sockaddr, &listen_sockaddr, }, { "mailer", N_("url"), N_("Set mailer URL"), gconf_type_string, &mailer, 0, cb_mailer }, { "admin-address", N_("email"), N_("Set admin email address"), |