aboutsummaryrefslogtreecommitdiff
path: root/src/pies.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pies.c')
-rw-r--r--src/pies.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/src/pies.c b/src/pies.c
index d9b5a6d..91fabca 100644
--- a/src/pies.c
+++ b/src/pies.c
@@ -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)

Return to:

Send suggestions and report system problems to the System administrator.