aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2009-10-16 13:06:36 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2009-10-16 13:06:36 +0300
commite9950f2fa8e45e86396371e91443dc04f14fb5f2 (patch)
tree094e8dc99e049d8a515b963571c186d6cba366e2
parenta0631c9ac2c13c3ef1db027a490620504a287d3f (diff)
downloadpies-e9950f2fa8e45e86396371e91443dc04f14fb5f2.tar.gz
pies-e9950f2fa8e45e86396371e91443dc04f14fb5f2.tar.bz2
Implement -D and -U options (preprocessor control).
* Makefile.am (dist-hook,alpha,alphacheck): New rules. (ChangeLog): Be silent. * NEWS: Update. * doc/pies.texi: Update. * gnulib.modules: Add quote and quotearg * src/pies.c: Implement -D and -U options. Improve --help output. * src/pies.h: Include quotearg.h
-rw-r--r--Makefile.am18
-rw-r--r--NEWS5
-rw-r--r--doc/pies.texi110
-rw-r--r--gnulib.modules2
-rw-r--r--src/pies.c81
-rw-r--r--src/pies.h1
6 files changed, 165 insertions, 52 deletions
diff --git a/Makefile.am b/Makefile.am
index 67e64f3..0f97a90 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,6 +2,22 @@ ACLOCAL_AMFLAGS = -I m4 -I am -I grecs/am
SUBDIRS=gnu grecs lib src doc po
+dist-hook:
+ @PATCHLEV=`echo "$(PACKAGE_VERSION)" | \
+ sed -r "s/[0-9]+\.[0-9]+\.?//"`; \
+ if test $${PATCHLEV:-0} -lt 50; then \
+ if grep -q FIXME NEWS; then \
+ echo >&2 "NEWS file contains FIXMEs"; \
+ exit 1; \
+ fi; \
+ fi
+
+alpha:
+ $(MAKE) dist distdir=$(PACKAGE)-$(VERSION)-`date +"%Y%m%d"`
+
+alphacheck:
+ $(MAKE) distcheck distdir=$(PACKAGE)-$(VERSION)-`date +"%Y%m%d"`
+
# Define the following variables in order to use the ChangeLog rule below:
# prev_change_log [optional] Name of the previous ChangeLog file.
# gen_start_date [optional] Start ChangeLog from this date.
@@ -12,7 +28,7 @@ changelog_dir = .
.PHONY: ChangeLog
ChangeLog:
- if test -d .git; then \
+ @if test -d .git; then \
cmd=$(top_srcdir)/build-aux/gitlog-to-changelog; \
if test -n "$(gen_start_date)"; then \
cmd="$$cmd --since=\"$(gen_start_date)\""; \
diff --git a/NEWS b/NEWS
index 105cf41..083a42b 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-Mailfromd NEWS -- history of user-visible changes. 2009-09-03
+Mailfromd NEWS -- history of user-visible changes. 2009-10-16
Copyright (C) 2005, 2006, 2007, 2008, 2009 Sergey Poznyakoff
See the end of file for copying conditions.
@@ -7,6 +7,9 @@ Please send Mailfromd bug reports to <bug-mailfromd@gnu.org.ua>
Version 1.0 (Git)
+First independent release. Previous versions were released as
+part of Mailfromd (http://mailfromd.software.gnu.org.ua).
+
=========================================================================
Copyright information:
diff --git a/doc/pies.texi b/doc/pies.texi
index 93a329e..0bc3bee 100644
--- a/doc/pies.texi
+++ b/doc/pies.texi
@@ -29,8 +29,10 @@
@include macros.texi
@ifinfo
-@dircategory GNU Utilities
-@direntry (pies) pies. Program execution supervisor.
+@dircategory System Administration
+@direntry
+* Pies: (pies). Program Invocation and Execution Supervisor.
+* pies: (pies) Invocation. Pies Command Line Options.
@end direntry
@end ifinfo
@@ -81,7 +83,7 @@ documents @command{pies} Version @value{VERSION}.
* Pies Debugging::
* Configuration Example::
* Command Line Usage::
-* Pies Invocation::
+* Invocation::
* Reporting Bugs::
Appendices
@@ -507,6 +509,24 @@ is similar to GNU m4 @option{--prefix-builtin} options, but has an
advantage that it works with non-GNU @command{m4} implementations as
well.
+Additional preprocessor symbols may be defined and the existing
+symbols may be undefined using the following command line options:
+
+@table @option
+@xopindex{define, described}
+@cindex @option{-D}
+@item --define=@var{sym}[=@var{value}]
+@itemx -D @var{symbol}[=@var{value}]
+Define symbol @var{sym} as having @var{value}, or emtpy, if
+the @var{value} is not given.
+
+@xopindex{undefine, described}
+@cindex @option{-U}
+@item --undefine=@var{sym}
+@itemx -U @var{sym}
+Undefine symbol @var{sym}.
+@end table
+
@node Component Statement
@section Component Statement
@kwindex component
@@ -1802,16 +1822,12 @@ smtpc: qmgr
smtps: smar qmgr
@end smallexample
-@node Pies Invocation
+@node Invocation
@chapter Pies Invocation
This section summarizes @command{pies} command line options.
@table @option
-@opsummary{config-help}
-@item --config-help
-Show configuration file summary. @xref{Pies Configuration File}.
-
@opsummary{config-file}
@item --config-file=@var{file}
@item -c @var{file}
@@ -1820,6 +1836,30 @@ Read configuration from @var{file}, instead of the default
@xref{Pies Configuration File}.
+@opsummary{config-help}
+@item --config-help
+Show configuration file summary. @xref{Pies Configuration File}.
+
+@opsummary{define}
+@item --define=@var{sym}[=@var{value}]
+@itemx -D @var{symbol}[=@var{value}]
+Define symbol @var{sym} as having @var{value}, or emtpy, if
+the @var{value} is not given. @xref{Preprocessor}.
+
+@opsummary{debug}
+@item --debug=@var{level}
+@itemx -x @var{level}
+Set debug verbosity level. @xref{Pies Debugging}, for a description
+of @var{level}.
+
+@opsummary{dump-depmap}
+@item --dump-depmap
+Dump dependency map. @xref{dump-depmap}.
+
+@opsummary{dump-prereq}
+@item --dump-prereq
+Dump prerequisite charts. @xref{dump-prereq}.
+
@item -E
Preprocess configuration file and exit. @xref{Preprocessor}.
@@ -1831,28 +1871,35 @@ Force startup even if another instance may be running.
@item --foreground
Remain in foreground.
-@opsummary{source-info}
-@item --source-info
-Show source info with debugging messages. @xref{source-info}.
+@item --help
+Display a short usage summary and exit.
@opsummary{lint}
@item --lint
@itemx -t
+@opsummary{source-info}
+@item --source-info
+Show source info with debugging messages. @xref{source-info}.
+
+@opsummary{status}
+@item --status
+@itemx -s
+Display info about the running instance. @xref{pies-status}.
+
@opsummary{stderr}
@item --stderr
Log to standard error.
+@opsummary{stop}
+@item --stop
+@itemx -S
+Stop the running instance.
+
@opsummary{syslog}
@item --syslog
Log to syslog. This is the default.
-@opsummary{debug}
-@item -x @var{level}
-@itemx --debug=@var{level}
-Set debug verbosity level. @xref{Pies Debugging}, for a description
-of @var{level}.
-
@opsummary{reload}
@opsummary{hup}
@item -r
@@ -1865,33 +1912,16 @@ Reload the running instance of pies.
@itemx --restart-component
Restart components named in the command line. @xref{pies-restart}.
-@opsummary{status}
-@item -s
-@itemx --status
-Display info about the running instance. @xref{pies-status}.
-
-@opsummary{stop}
-@item -S
-@itemx --stop
-Stop the running instance.
-
-@opsummary{dump-depmap}
-@item --dump-depmap
-Dump dependency map. @xref{dump-depmap}.
-
-@opsummary{dump-prereq}
-@item --dump-prereq
-Dump prerequisite charts. @xref{dump-prereq}.
+@item --version
+Display program version and license information and exit.
-@item --help
-Display a short usage summary and exit.
+@xopindex{undefine}
+@item --undefine=@var{sym}
+@itemx -U @var{sym}
+Undefine symbol @var{sym}. @xref{Preprocessor}.
@item --usage
Display a short summary of available options and exit.
-
-@item --version
-Display program version and license information and exit.
-
@end table
@node Reporting Bugs
diff --git a/gnulib.modules b/gnulib.modules
index e505b7e..54ea90c 100644
--- a/gnulib.modules
+++ b/gnulib.modules
@@ -10,6 +10,8 @@ inttostr
inttypes
obstack
progname
+quote
+quotearg
sysexits
xalloc
xvasprintf
diff --git a/src/pies.c b/src/pies.c
index f2ed365..52abc80 100644
--- a/src/pies.c
+++ b/src/pies.c
@@ -40,9 +40,38 @@ char *mailer_program = "/usr/sbin/sendmail";
char *mailer_command_line = "/usr/sbin/sendmail -oi -t";
int mailer_argc;
char **mailer_argv;
+struct obstack pp_stk;
+struct quoting_options *pp_qopt;
+static void
+add_pp_option (const char *opt, const char *arg)
+{
+ if (!DEFAULT_PREPROCESSOR)
+ {
+ logmsg (LOG_ERR, _("no preprocessor configured"));
+ exit (EX_CONFIG);
+ }
+
+ obstack_1grow (&pp_stk, ' ');
+ obstack_grow (&pp_stk, opt, strlen (opt));
+ if (arg)
+ {
+ char *qarg;
+ size_t qlen;
+
+ if (!pp_qopt)
+ {
+ pp_qopt = clone_quoting_options (NULL);
+ set_quoting_style (pp_qopt, shell_quoting_style);
+ }
+ qarg = quotearg_alloc_mem (arg, strlen (arg), &qlen, pp_qopt);
+ obstack_grow (&pp_stk, qarg, qlen);
+ free (qarg);
+ }
+}
+
/* Logging */
void
log_setup (int want_stderr)
@@ -1206,8 +1235,13 @@ config_init ()
grecs_set_keywords (pies_keywords);
grecs_include_path_setup (DEFAULT_VERSION_INCLUDE_DIR,
DEFAULT_INCLUDE_DIR, NULL);
- grecs_preprocessor = DEFAULT_PREPROCESSOR;
grecs_log_to_stderr = log_to_stderr;
+ if (DEFAULT_PREPROCESSOR)
+ {
+ obstack_init (&pp_stk);
+ obstack_grow (&pp_stk, DEFAULT_PREPROCESSOR,
+ sizeof (DEFAULT_PREPROCESSOR) - 1);
+ }
}
void
@@ -1245,13 +1279,10 @@ enum
static struct argp_option options[] = {
#define GRP 0
+ {NULL, 0, NULL, 0, N_("Operation Mode"), GRP},
{"foreground", OPT_FOREGROUND, 0, 0, N_("remain in foreground"), GRP + 1},
{"stderr", OPT_STDERR, NULL, 0, N_("log to stderr"),},
{"syslog", OPT_SYSLOG, NULL, 0, N_("log to syslog"),},
- {"debug", 'x', N_("LEVEL"), 0,
- N_("set debug verbosity level"), GRP + 1},
- {"source-info", OPT_SOURCE_INFO, NULL, 0,
- N_("show source info with debugging messages"), GRP + 1},
{"force", OPT_FORCE, NULL, 0,
N_("force startup even if another instance may be running"), GRP + 1},
{"lint", 't', NULL, 0,
@@ -1264,7 +1295,16 @@ static struct argp_option options[] = {
N_("show configuration file summary"), GRP + 1},
#undef GRP
+#define GRP 5
+ {NULL, 0, NULL, 0, N_("Preprocessor"), GRP},
+ {"define", 'D', N_("NAME[=VALUE]"), 0,
+ N_("define a preprocessor symbol NAME as having VALUE, or empty"), GRP+1 },
+ {"undefine", 'U', N_("NAME"), 0,
+ N_("undefine a preprocessor symbol NAME"), GRP+1 },
+#undef GRP
+
#define GRP 10
+ {NULL, 0, NULL, 0, N_("Component Management"), GRP},
{"restart-component", OPT_RESTART, NULL, 0,
N_("restart components named in the command line"), GRP + 1},
{"reload", OPT_RELOAD, NULL, 0,
@@ -1277,6 +1317,11 @@ static struct argp_option options[] = {
#undef GRP
#define GRP 20
+ {NULL, 0, NULL, 0, N_("Debugging and Additional Diagnostics"), GRP},
+ {"debug", 'x', N_("LEVEL"), 0,
+ N_("set debug verbosity level"), GRP + 1},
+ {"source-info", OPT_SOURCE_INFO, NULL, 0,
+ N_("show source info with debugging messages"), GRP + 1},
{"dump-prereq", OPT_DUMP_PREREQ, NULL, 0,
N_("dump prerequisite charts"), GRP + 1},
{"dump-depmap", OPT_DUMP_DEPMAP, NULL, 0,
@@ -1290,17 +1335,25 @@ parse_opt (int key, char *arg, struct argp_state *state)
{
switch (key)
{
- case 't':
- log_to_stderr = 1;
- lint_mode = 1;
+ case 'c':
+ conffile = arg;
break;
+ case 'D':
+ add_pp_option ("-D", arg);
+ break;
+
+ case 'U':
+ add_pp_option ("-U", arg);
+ break;
+
case 'E':
preprocess_only = 1;
break;
- case 'c':
- conffile = arg;
+ case 't':
+ log_to_stderr = 1;
+ lint_mode = 1;
break;
case OPT_CONFIG_HELP:
@@ -1780,6 +1833,14 @@ main (int argc, char **argv)
if (argp_parse (&argp, argc, argv, 0, &index, NULL))
exit (EX_USAGE);
+ if (!DEFAULT_PREPROCESSOR)
+ grecs_preprocessor = NULL;
+ else
+ {
+ grecs_preprocessor = obstack_finish (&pp_stk);
+ free (pp_qopt);
+ }
+
if (preprocess_only)
exit (grecs_preproc_run (conffile, grecs_preprocessor) ? EX_CONFIG : 0);
diff --git a/src/pies.h b/src/pies.h
index 9b8ee2d..f1cb13e 100644
--- a/src/pies.h
+++ b/src/pies.h
@@ -51,6 +51,7 @@
#define obstack_chunk_free free
#include "obstack.h"
#include "xvasprintf.h"
+#include "quotearg.h"
#include "acl.h"
#include "libpies.h"

Return to:

Send suggestions and report system problems to the System administrator.