aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/.gitignore2
-rw-r--r--src/Makefile.am25
-rw-r--r--src/pies.c34
3 files changed, 31 insertions, 30 deletions
diff --git a/src/.gitignore b/src/.gitignore
index fe9c6fe..18a7111 100644
--- a/src/.gitignore
+++ b/src/.gitignore
@@ -1,4 +1,4 @@
-inetd.sh
+inetd
meta1gram.c
meta1gram.h
meta1gram.output
diff --git a/src/Makefile.am b/src/Makefile.am
index 98815b0..856efe8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -57,28 +57,23 @@ LDADD = \
../gnu/libgnu.a\
$(MF_PROCTITLE_LIBS)
+pkgstatedir=$(localstatedir)/pies
+
AM_CPPFLAGS=\
-DDEFAULT_PREPROCESSOR="$(DEFAULT_PREPROCESSOR)"\
-DDEFAULT_VERSION_INCLUDE_DIR=\"$(incdir)\"\
- -DDEFAULT_INCLUDE_DIR=\"$(pkgdatadir)/include\"
+ -DDEFAULT_INCLUDE_DIR=\"$(pkgdatadir)/include\"\
+ -DDEFAULT_STATE_DIR=\"$(pkgstatedir)\"
AM_YFLAGS=-dvt -pmeta1
AM_LFLAGS=-dvp -Pmeta1 -olex.yy.c
-SUFFIXES = .in .sh
EXTRA_SCRIPTS = inetd.in
-sbin_SCRIPTS = @INETD_SH@
-inetd.sh: inetd.in
+sbin_SCRIPTS = @INETD@
-.in.sh:
- $(AM_V_GEN)sed 's|_SBINDIR_|$(sbindir)|' $< > $@
+inetd: inetd.in
+ $(AM_V_GEN)sed 's|_SBINDIR_|$(sbindir)|' \
+ $(top_srcdir)/src/inetd.in > $(top_builddir)/src/inetd
-install-exec-hook:
- if test -n "@INETD_SH@" && \
- test -f $(DESTDIR)$(sbindir)/@INETD_SH@; then \
- test -f $(DESTDIR)$(sbindir)/inetd$(EXEEXT) && \
- cd $(DESTDIR)$(sbindir) && \
- mv -f inetd$(EXEEXT) inetd$(EXEEXT)~; \
- cd $(DESTDIR)$(sbindir) && \
- mv @INETD_SH@ inetd$(EXEEXT); \
- fi
+install-data-hook:
+ test -d $(DESTDIR)$(pkgstatedir) || $(MKDIR_P) $(pkgstatedir)
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.