diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-12-11 21:01:35 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-12-11 21:01:35 +0200 |
commit | 94c29f6b6180dca91ae4034ffcb50c6a5c171b75 (patch) | |
tree | ba75fd15d2cfe18cb083dc04267c58a63ae28208 /src/pies.c | |
parent | 4d759daeec0abf98294ece5a689c608890ffb4d1 (diff) | |
download | pies-94c29f6b6180dca91ae4034ffcb50c6a5c171b75.tar.gz pies-94c29f6b6180dca91ae4034ffcb50c6a5c171b75.tar.bz2 |
Final cleanup for version 1.2.
* configure.ac (INETD_SH): Rename to INETD.
* NEWS: Update.
* src/.gitignore (inetd.sh): rename to inetd.
* doc/pies.texi: Update.
* src/Makefile.am (pkgstatedir): New variable.
(AM_CPPFLAGS): Add define.
(inetd.sh): Replace with inetd.
(install-exec-hook): Remove.
* src/pies.c (statedir): New variable.
(pies_keywords): New keyword: "state-directory".
(set_file_names): Split in two functions:
(set_conf_file_names, set_state_file_names).
(main): Call set_conf_file_names before,
and set_state_file_names after parsing the configs.
Diffstat (limited to 'src/pies.c')
-rw-r--r-- | src/pies.c | 34 |
1 files changed, 20 insertions, 14 deletions
@@ -27,6 +27,7 @@ char *log_tag; struct pies_privs pies_privs; int foreground; int command; +char *statedir = DEFAULT_STATE_DIR; char *instance; char *pidfile; char *ctlfile; @@ -1421,6 +1422,10 @@ struct grecs_keyword pies_keywords[] = { NULL, N_("Show source info with debugging messages."), grecs_type_bool, &source_info_option, 0, NULL}, + {"state-directory", + NULL, + N_("Full file name of the program state directory."), + grecs_type_string, &statedir, 0, NULL}, {"pidfile", NULL, N_("Write PID to this file."), @@ -2170,28 +2175,28 @@ mkfilename (const char *dir, const char *name, const char *suf) return s; } -void -set_file_names (const char *base) +static void +set_conf_file_names (const char *base) { - const char *p; - - p = strrchr (base, '/'); - if (p) - base = p + 1; if (!conf_head) { char *name = mkfilename (SYSCONFDIR, base, ".conf"); add_config (current_syntax, name); free (name); } +} + +static void +set_state_file_names (const char *base) +{ if (!pidfile) - pidfile = mkfilename (LOCALSTATEDIR, base, ".pid"); + pidfile = mkfilename (statedir, base, ".pid"); if (!ctlfile) - ctlfile = mkfilename (LOCALSTATEDIR, base, ".ctl"); + ctlfile = mkfilename (statedir, base, ".ctl"); if (!statfile) - statfile = mkfilename (LOCALSTATEDIR, base, ".stat"); + statfile = mkfilename (statedir, base, ".stat"); if (!qotdfile) - qotdfile = mkfilename (LOCALSTATEDIR, base, ".qotd"); + qotdfile = mkfilename (statedir, base, ".qotd"); } int @@ -2229,10 +2234,10 @@ main (int argc, char **argv) else instance++; } - else - log_tag = instance; - set_file_names (instance); + log_tag = instance; + + set_conf_file_names (instance); if (!DEFAULT_PREPROCESSOR) grecs_preprocessor = NULL; @@ -2274,6 +2279,7 @@ main (int argc, char **argv) } } + set_state_file_names (instance); set_mailer_argcv (); if (lint_mode) |