of specific permit-like actions in Postfix SMTP server
access lists. Files: mantools/postlink, proto/postconf.proto,
global/mail_params.h, smtpd/smtpd.c, smtpd/smtpd_check.c.
+
+20120306
+
+ To improve the interaction with start-up scripts, "postfix
+ start" now waits for master daemon process initialization
+ to complete, and returns a non-zero exit status if daemon
+ initialization failed or if it did not complete in a
+ reasonable amount of time. This involves a new "-w" master
+ option. Files: conf/postfix-script, master/master.c,
+ master/master.h. master/master_monitor.c.
+
+20120307
+
+ postconf -X option to exclude parameters from main.cf
+ (require two-finger action, because this is irreversible).
+ Files: postconf/postconf.[hc], postconf/postconf_edit.c.
If you upgrade from Postfix 2.8 or earlier, read RELEASE_NOTES-2.9
before proceeding.
+Major changes with snapshot 20120306
+====================================
+
+New master "-w" option, to wait for daemon process initialization
+to complete. This feature returns an error exit status if master
+daemon initialization fails, or if it does not complete in a
+reasonable amount of time. The exit status is used by "postfix
+start" to provide more accurate information to system start-up
+scripts.
+
Major changes with snapshot 20120303
====================================
$daemon_directory/postfix-script check-warn
fi
$INFO starting the Postfix mail system
- $daemon_directory/master &
+ # NOTE: wait in foreground process to get the initialization status.
+ $daemon_directory/master -w || {
+ $FATAL "mail system startup failed"
+ exit 1
+ }
;;
drain)
master - Postfix master process
<b>SYNOPSIS</b>
- <b>master</b> [<b>-Ddtv</b>] [<b>-c</b> <i>config</i><b>_</b><i>dir</i>] [<b>-e</b> <i>exit</i><b>_</b><i>time</i>]
+ <b>master</b> [<b>-Ddtvw</b>] [<b>-c</b> <i>config</i><b>_</b><i>dir</i>] [<b>-e</b> <i>exit</i><b>_</b><i>time</i>]
<b>DESCRIPTION</b>
The <a href="master.8.html"><b>master</b>(8)</a> daemon is the resident process that runs
option is passed on to child processes. Multiple <b>-v</b>
options make the software increasingly verbose.
+ <b>-w</b> Wait in a dummy foreground process, while the real
+ master daemon initializes in a background process.
+ The dummy foreground process returns a zero exit
+ status only if the master daemon initialization is
+ successful, and if it completes in a reasonable
+ amount of time.
+
+ This feature is available in Postfix 2.10 and
+ later.
+
Signals:
<b>SIGHUP</b> Upon receipt of a <b>HUP</b> signal (e.g., after "<b>postfix</b>
running processes to finish what they are doing.
<b>DIAGNOSTICS</b>
- Problems are reported to <b>syslogd</b>(8).
+ Problems are reported to <b>syslogd</b>(8). The exit status is
+ non-zero in case of problems, including problems while
+ initializing as a master daemon process in the background.
<b>ENVIRONMENT</b>
<b>MAIL_DEBUG</b>
After initialization, start a debugger as specified
- with the <b><a href="postconf.5.html#debugger_command">debugger_command</a></b> configuration parameter
+ with the <b><a href="postconf.5.html#debugger_command">debugger_command</a></b> configuration parameter
in the <a href="postconf.5.html"><b>main.cf</b></a> configuration file.
<b>MAIL_CONFIG</b>
<b>CONFIGURATION PARAMETERS</b>
Unlike most Postfix daemon processes, the <a href="master.8.html"><b>master</b>(8)</a> server
does not automatically pick up changes to <a href="postconf.5.html"><b>main.cf</b></a>. Changes
- to <a href="master.5.html"><b>master.cf</b></a> are never picked up automatically. Use the
+ to <a href="master.5.html"><b>master.cf</b></a> are never picked up automatically. Use the
"<b>postfix reload</b>" command after a configuration change.
<b>RESOURCE AND RATE CONTROLS</b>
<b><a href="postconf.5.html#default_process_limit">default_process_limit</a> (100)</b>
- The default maximal number of Postfix child pro-
+ The default maximal number of Postfix child pro-
cesses that provide a given service.
<b><a href="postconf.5.html#max_idle">max_idle</a> (100s)</b>
- The maximum amount of time that an idle Postfix
- daemon process waits for an incoming connection
+ The maximum amount of time that an idle Postfix
+ daemon process waits for an incoming connection
before terminating voluntarily.
<b><a href="postconf.5.html#max_use">max_use</a> (100)</b>
- The maximal number of incoming connections that a
- Postfix daemon process will service before termi-
+ The maximal number of incoming connections that a
+ Postfix daemon process will service before termi-
nating voluntarily.
<b><a href="postconf.5.html#service_throttle_time">service_throttle_time</a> (60s)</b>
Available in Postfix version 2.6 and later:
<b><a href="postconf.5.html#master_service_disable">master_service_disable</a> (empty)</b>
- Selectively disable <a href="master.8.html"><b>master</b>(8)</a> listener ports by
+ Selectively disable <a href="master.8.html"><b>master</b>(8)</a> listener ports by
service type or by service name and type.
<b>MISCELLANEOUS CONTROLS</b>
<b><a href="postconf.5.html#config_directory">config_directory</a> (see 'postconf -d' output)</b>
- The default location of the Postfix <a href="postconf.5.html">main.cf</a> and
+ The default location of the Postfix <a href="postconf.5.html">main.cf</a> and
<a href="master.5.html">master.cf</a> configuration files.
<b><a href="postconf.5.html#daemon_directory">daemon_directory</a> (see 'postconf -d' output)</b>
- The directory with Postfix support programs and
+ The directory with Postfix support programs and
daemon programs.
<b><a href="postconf.5.html#debugger_command">debugger_command</a> (empty)</b>
tem receives mail on.
<b><a href="postconf.5.html#inet_protocols">inet_protocols</a> (all)</b>
- The Internet protocols Postfix will attempt to use
+ The Internet protocols Postfix will attempt to use
when making or accepting connections.
<b><a href="postconf.5.html#import_environment">import_environment</a> (see 'postconf -d' output)</b>
- The list of environment parameters that a Postfix
+ The list of environment parameters that a Postfix
process will import from a non-Postfix parent
process.
and most Postfix daemon processes.
<b><a href="postconf.5.html#process_id">process_id</a> (read-only)</b>
- The process ID of a Postfix command or daemon
+ The process ID of a Postfix command or daemon
process.
<b><a href="postconf.5.html#process_name">process_name</a> (read-only)</b>
- The process name of a Postfix command or daemon
+ The process name of a Postfix command or daemon
process.
<b><a href="postconf.5.html#queue_directory">queue_directory</a> (see 'postconf -d' output)</b>
- The location of the Postfix top-level queue direc-
+ The location of the Postfix top-level queue direc-
tory.
<b><a href="postconf.5.html#syslog_facility">syslog_facility</a> (mail)</b>
The syslog facility of Postfix logging.
<b><a href="postconf.5.html#syslog_name">syslog_name</a> (see 'postconf -d' output)</b>
- The mail system name that is prepended to the
- process name in syslog records, so that "smtpd"
+ The mail system name that is prepended to the
+ process name in syslog records, so that "smtpd"
becomes, for example, "postfix/smtpd".
<b>FILES</b>
syslogd(8), system logging
<b>LICENSE</b>
- The Secure Mailer license must be distributed with this
+ The Secure Mailer license must be distributed with this
software.
<b>AUTHOR(S)</b>
<b>postconf</b> [<b>-ev</b>] [<b>-c</b> <i>config</i><b>_</b><i>dir</i>] [<i>parameter=value ...</i>]
- <b>postconf</b> [<b>-#v</b>] [<b>-c</b> <i>config</i><b>_</b><i>dir</i>] [<i>parameter ...</i>]
+ <b>postconf</b> [<b>-#vX</b>] [<b>-c</b> <i>config</i><b>_</b><i>dir</i>] [<i>parameter ...</i>]
<b>Managing <a href="master.5.html">master.cf</a>:</b>
tiple <b>-v</b> options make the software increasingly
verbose.
+ <b>-X</b> Edit the <a href="postconf.5.html"><b>main.cf</b></a> configuration file, and remove the
+ parameters given on the <a href="postconf.1.html"><b>postconf</b>(1)</a> command line.
+ The file is copied to a temporary file then renamed
+ into place. Specify a list of parameter names, not
+ <i>name</i>=<i>value</i> pairs. There is no <a href="postconf.1.html"><b>postconf</b>(1)</a> command
+ to perform the reverse operation.
+
+ This feature is available with Postfix 2.10 and
+ later.
+
<b>-#</b> Edit the <a href="postconf.5.html"><b>main.cf</b></a> configuration file, and comment
out the parameters given on the <a href="postconf.1.html"><b>postconf</b>(1)</a> command
line, so that those parameters revert to their
\fBpostconf\fR [\fB-ev\fR] [\fB-c \fIconfig_dir\fR]
[\fIparameter=value ...\fR]
-\fBpostconf\fR [\fB-#v\fR] [\fB-c \fIconfig_dir\fR]
+\fBpostconf\fR [\fB-#vX\fR] [\fB-c \fIconfig_dir\fR]
[\fIparameter ...\fR]
\fBManaging master.cf:\fR
.IP \fB-v\fR
Enable verbose logging for debugging purposes. Multiple \fB-v\fR
options make the software increasingly verbose.
+.IP \fB-X\fR
+Edit the \fBmain.cf\fR configuration file, and remove
+the parameters given on the \fBpostconf\fR(1) command line.
+The file is copied to a temporary file then renamed into
+place.
+Specify a list of parameter names, not \fIname\fR=\fIvalue\fR
+pairs. There is no \fBpostconf\fR(1) command to perform
+the reverse operation.
+
+This feature is available with Postfix 2.10 and later.
.IP \fB-#\fR
Edit the \fBmain.cf\fR configuration file, and comment out
the parameters given on the \fBpostconf\fR(1) command line,
.SH "SYNOPSIS"
.na
.nf
-\fBmaster\fR [\fB-Ddtv\fR] [\fB-c \fIconfig_dir\fR] [\fB-e \fIexit_time\fR]
+\fBmaster\fR [\fB-Ddtvw\fR] [\fB-c \fIconfig_dir\fR] [\fB-e \fIexit_time\fR]
.SH DESCRIPTION
.ad
.fi
Enable verbose logging for debugging purposes. This option
is passed on to child processes. Multiple \fB-v\fR options
make the software increasingly verbose.
+.IP \fB-w\fR
+Wait in a dummy foreground process, while the real master
+daemon initializes in a background process. The dummy
+foreground process returns a zero exit status only if the
+master daemon initialization is successful, and if it
+completes in a reasonable amount of time.
+.sp
+This feature is available in Postfix 2.10 and later.
.PP
Signals:
.IP \fBSIGHUP\fR
.SH DIAGNOSTICS
.ad
.fi
-Problems are reported to \fBsyslogd\fR(8).
+Problems are reported to \fBsyslogd\fR(8). The exit status
+is non-zero in case of problems, including problems while
+initializing as a master daemon process in the background.
.SH "ENVIRONMENT"
.na
.nf
* Patches change both the patchlevel and the release date. Snapshots have no
* patchlevel; they change the release date only.
*/
-#define MAIL_RELEASE_DATE "20120305"
+#define MAIL_RELEASE_DATE "20120308"
#define MAIL_VERSION_NUMBER "2.10"
#ifdef SNAPSHOT
SRCS = master.c master_conf.c master_ent.c master_sig.c master_avail.c \
master_spawn.c master_service.c master_status.c master_listen.c \
master_proto.c single_server.c multi_server.c master_vars.c \
- master_wakeup.c master_flow.c master_watch.c mail_flow.c
+ master_wakeup.c master_flow.c master_watch.c mail_flow.c \
+ master_monitor.c
OBJS = master.o master_conf.o master_ent.o master_sig.o master_avail.o \
master_spawn.o master_service.o master_status.o master_listen.o \
- master_vars.o master_wakeup.o master_watch.o master_flow.o
+ master_vars.o master_wakeup.o master_watch.o master_flow.o \
+ master_monitor.o
LIB_OBJ = single_server.o multi_server.o trigger_server.o master_proto.o \
mail_flow.o event_server.o
HDRS = mail_server.h master_proto.h mail_flow.h
master_listen.o: ../../include/vstring.h
master_listen.o: master.h
master_listen.o: master_listen.c
+master_monitor.o: ../../include/iostuff.h
+master_monitor.o: ../../include/msg.h
+master_monitor.o: ../../include/sys_defs.h
+master_monitor.o: master.h
+master_monitor.o: master_monitor.c
master_proto.o: ../../include/msg.h
master_proto.o: ../../include/sys_defs.h
master_proto.o: master_proto.c
/* SUMMARY
/* Postfix master process
/* SYNOPSIS
-/* \fBmaster\fR [\fB-Ddtv\fR] [\fB-c \fIconfig_dir\fR] [\fB-e \fIexit_time\fR]
+/* \fBmaster\fR [\fB-Ddtvw\fR] [\fB-c \fIconfig_dir\fR] [\fB-e \fIexit_time\fR]
/* DESCRIPTION
/* The \fBmaster\fR(8) daemon is the resident process that runs Postfix
/* daemons on demand: daemons to send or receive messages via the
/* Enable verbose logging for debugging purposes. This option
/* is passed on to child processes. Multiple \fB-v\fR options
/* make the software increasingly verbose.
+/* .IP \fB-w\fR
+/* Wait in a dummy foreground process, while the real master
+/* daemon initializes in a background process. The dummy
+/* foreground process returns a zero exit status only if the
+/* master daemon initialization is successful, and if it
+/* completes in a reasonable amount of time.
+/* .sp
+/* This feature is available in Postfix 2.10 and later.
/* .PP
/* Signals:
/* .IP \fBSIGHUP\fR
/* terminate only the master ("\fBpostfix stop\fR") and allow running
/* processes to finish what they are doing.
/* DIAGNOSTICS
-/* Problems are reported to \fBsyslogd\fR(8).
+/* Problems are reported to \fBsyslogd\fR(8). The exit status
+/* is non-zero in case of problems, including problems while
+/* initializing as a master daemon process in the background.
/* ENVIRONMENT
/* .ad
/* .fi
static NORETURN usage(const char *me)
{
- msg_fatal("usage: %s [-c config_dir] [-D (debug)] [-d (don't detach from terminal)] [-e exit_time] [-t (test)] [-v]", me);
+ msg_fatal("usage: %s [-c config_dir] [-D (debug)] [-d (don't detach from terminal)] [-e exit_time] [-t (test)] [-v] [-w (wait for initialization)]", me);
}
MAIL_VERSION_STAMP_DECLARE;
VSTRING *why;
WATCHDOG *watchdog;
ARGV *import_env;
+ int wait_flag = 0;
+ int monitor_fd = -1;
/*
* Fingerprint executables and core dumps.
/*
* Process JCL.
*/
- while ((ch = GETOPT(argc, argv, "c:Dde:tv")) > 0) {
+ while ((ch = GETOPT(argc, argv, "c:Dde:tvw")) > 0) {
switch (ch) {
case 'c':
if (setenv(CONF_ENV_PATH, optarg, 1) < 0)
case 'v':
msg_verbose++;
break;
+ case 'w':
+ wait_flag = 1;
+ break;
default:
usage(argv[0]);
/* NOTREACHED */
if (argc > optind)
usage(argv[0]);
+ /*
+ * Run a foreground monitor process that returns an exit status of 0 when
+ * the child background process reports successful initialization as a
+ * daemon process. We use a generous limit in case main/master.cf specify
+ * symbolic hosts/ports and the naming service is slow.
+ */
+#define MASTER_INIT_TIMEOUT 100 /* keep this limit generous */
+
+ if (wait_flag)
+ monitor_fd = master_monitor(MASTER_INIT_TIMEOUT);
+
/*
* If started from a terminal, get rid of any tty association. This also
* means that all errors and warnings must go to the syslog daemon.
msg_info("daemon started -- version %s, configuration %s",
var_mail_version, var_config_dir);
+ /*
+ * Report successful initialization to the foreground monitor process.
+ */
+ if (monitor_fd >= 0) {
+ write(monitor_fd, "", 1);
+ (void) close(monitor_fd);
+ }
+
/*
* Process events. The event handler will execute the read/write/timer
* action routines. Whenever something has happened, see if we received
extern void master_str_watch(const MASTER_STR_WATCH *);
extern void master_int_watch(MASTER_INT_WATCH *);
+ /*
+ * master_monitor.c
+ */
+extern int master_monitor(int);
+
/* DIAGNOSTICS
/* BUGS
/* SEE ALSO
--- /dev/null
+/*++
+/* NAME
+/* master_monitor 3
+/* SUMMARY
+/* Postfix master - start-up monitoring
+/* SYNOPSIS
+/* #include "master.h"
+/*
+/* int master_monitor(time_limit)
+/* int time_limit;
+/* DESCRIPTION
+/* master_monitor() forks off a background child process, and
+/* returns in the child. The result value is the file descriptor
+/* on which the child process must write one byte after it
+/* completes successful initialization as a daemon process.
+/*
+/* The foreground process waits for the child's completion for
+/* a limited amount of time. It terminates with exit status 0
+/* in case of success, non-zero otherwise.
+/* DIAGNOSTICS
+/* Fatal errors: system call failure.
+/* BUGS
+/* SEE ALSO
+/* LICENSE
+/* .ad
+/* .fi
+/* The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/* Wietse Venema
+/* IBM T.J. Watson Research
+/* P.O. Box 704
+/* Yorktown Heights, NY 10598, USA
+/*--*/
+
+/* System library. */
+
+#include <sys_defs.h>
+#include <signal.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+/* Utility library. */
+
+#include <msg.h>
+#include <iostuff.h>
+
+/* Application-specific. */
+
+#include <master.h>
+
+/* master_monitor - fork off a foreground monitor process */
+
+int master_monitor(int time_limit)
+{
+ pid_t pid;
+ int pipes[2];
+ char buf[1];
+
+ /*
+ * Sanity check.
+ */
+ if (time_limit <= 0)
+ msg_panic("master_monitor: bad time limit: %d", time_limit);
+
+ /*
+ * Set up the plumbing for child-to-parent communication.
+ */
+ if (pipe(pipes) < 0)
+ msg_fatal("pipe: %m");
+ close_on_exec(pipes[0], CLOSE_ON_EXEC);
+ close_on_exec(pipes[1], CLOSE_ON_EXEC);
+
+ /*
+ * Fork the child, and wait for it to report successful initialization.
+ */
+ switch (pid = fork()) {
+ case -1:
+ /* Error. */
+ msg_fatal("fork: %m");
+ case 0:
+ /* Child. Initialize as daemon in the background. */
+ close(pipes[0]);
+ return (pipes[1]);
+ default:
+ /* Parent. Monitor the child in the foreground. */
+ close(pipes[1]);
+ switch (timed_read(pipes[0], buf, 1, time_limit, (char *) 0)) {
+ default:
+ /* The child process still runs, but something is wrong. */
+ (void) kill(pid, SIGKILL);
+ /* FALLTHROUGH */
+ case 0:
+ /* The child process exited prematurely. */
+ msg_fatal("daemon initialization failure");
+ case 1:
+ /* The child process initialized successfully. */
+ exit(0);
+ }
+ }
+}
/* \fBpostconf\fR [\fB-ev\fR] [\fB-c \fIconfig_dir\fR]
/* [\fIparameter=value ...\fR]
/*
-/* \fBpostconf\fR [\fB-#v\fR] [\fB-c \fIconfig_dir\fR]
+/* \fBpostconf\fR [\fB-#vX\fR] [\fB-c \fIconfig_dir\fR]
/* [\fIparameter ...\fR]
/*
/* \fBManaging master.cf:\fR
/* .IP \fB-v\fR
/* Enable verbose logging for debugging purposes. Multiple \fB-v\fR
/* options make the software increasingly verbose.
+/* .IP \fB-X\fR
+/* Edit the \fBmain.cf\fR configuration file, and remove
+/* the parameters given on the \fBpostconf\fR(1) command line.
+/* The file is copied to a temporary file then renamed into
+/* place.
+/* Specify a list of parameter names, not \fIname\fR=\fIvalue\fR
+/* pairs. There is no \fBpostconf\fR(1) command to perform
+/* the reverse operation.
+/*
+/* This feature is available with Postfix 2.10 and later.
/* .IP \fB-#\fR
/* Edit the \fBmain.cf\fR configuration file, and comment out
/* the parameters given on the \fBpostconf\fR(1) command line,
/*
* Parse JCL.
*/
- while ((ch = GETOPT(argc, argv, "aAbc:C:deEf#hlmMntv")) > 0) {
+ while ((ch = GETOPT(argc, argv, "aAbc:C:deEf#hlmMntvX")) > 0) {
switch (ch) {
case 'a':
cmd_mode |= SHOW_SASL_SERV;
break;
case 'C':
param_class = name_mask_opt("-C option", param_class_table,
- optarg, NAME_MASK_ANY_CASE | NAME_MASK_FATAL);
+ optarg, NAME_MASK_ANY_CASE | NAME_MASK_FATAL);
break;
case 'd':
cmd_mode |= SHOW_DEFS;
ext_argv = argv_alloc(2);
argv_add(ext_argv, "bounce", "-SVndump_templates", (char *) 0);
break;
+ case 'X':
+ /* This is irreversible, therefore require two-finger action. */
+ cmd_mode = EDIT_EXCL;
+ break;
case 'v':
msg_verbose++;
break;
default:
- msg_fatal("usage: %s [-a (server SASL types)] [-A (client SASL types)] [-b (bounce templates)] [-c config_dir] [-C param_class] [-d (defaults)] [-e (edit)] [-f (fold lines)] [-# (comment-out)] [-h (no names)] [-l (lock types)] [-m (map types)] [-M (master.cf)] [-n (non-defaults)] [-v] [name...]", argv[0]);
+ msg_fatal("usage: %s [-a (server SASL types)] [-A (client SASL types)] [-b (bounce templates)] [-c config_dir] [-C param_class] [-d (defaults)] [-e (edit)] [-f (fold lines)] [-# (comment-out)] [-h (no names)] [-l (lock types)] [-m (map types)] [-M (master.cf)] [-n (non-defaults)] [-v] [-X (exclude)] [name...]", argv[0]);
}
}
/*
* Sanity check.
*/
- junk = (cmd_mode & (SHOW_DEFS | SHOW_NONDEF | SHOW_MAPS | SHOW_LOCKS | EDIT_MAIN | SHOW_SASL_SERV | SHOW_SASL_CLNT | COMMENT_OUT | SHOW_MASTER));
+ junk = (cmd_mode & (SHOW_DEFS | SHOW_NONDEF | SHOW_MAPS | SHOW_LOCKS | EDIT_MAIN | SHOW_SASL_SERV | SHOW_SASL_CLNT | COMMENT_OUT | SHOW_MASTER | EDIT_EXCL));
if (junk != 0 && ((junk != SHOW_DEFS && junk != SHOW_NONDEF
&& junk != SHOW_MAPS && junk != SHOW_LOCKS && junk != EDIT_MAIN
&& junk != SHOW_SASL_SERV && junk != SHOW_SASL_CLNT
- && junk != COMMENT_OUT && junk != SHOW_MASTER)
+ && junk != COMMENT_OUT && junk != SHOW_MASTER
+ && junk != EDIT_EXCL)
|| ext_argv != 0))
- msg_fatal("specify one of -a, -A, -b, -d, -e, -#, -l, -m, -M and -n");
+ msg_fatal("specify one of -a, -A, -b, -d, -e, -#, -l, -m, -M, -n, and -X");
/*
* Display bounce template information and exit.
/*
* Edit main.cf.
*/
- else if (cmd_mode & (EDIT_MAIN | COMMENT_OUT)) {
+ else if (cmd_mode & (EDIT_MAIN | COMMENT_OUT | EDIT_EXCL)) {
edit_parameters(cmd_mode, argc - optind, argv + optind);
} else if (cmd_mode == DEF_MODE
&& argv[optind] && strchr(argv[optind], '=')) {
#define COMMENT_OUT (1<<9) /* #-out selected main.cf entries */
#define SHOW_MASTER (1<<10) /* show master.cf entries */
#define FOLD_LINE (1<<11) /* fold long *.cf entries */
+#define EDIT_EXCL (1<<12) /* exclude main.cf entries */
#define DEF_MODE SHOW_NAME /* default mode */
* postconf_dbms.c
*/
extern void register_dbms_parameters(const char *,
- const char *(*) (const char *, int, char *),
+ const char *(*) (const char *, int, char *),
PC_MASTER_ENT *);
/*
table = htable_create(argc);
while ((cp = *argv++) != 0) {
if (strchr(cp, '\n') != 0)
- msg_fatal("-e or -# accepts no multi-line input");
+ msg_fatal("-e, -X, or -# accepts no multi-line input");
while (ISSPACE(*cp))
cp++;
if (*cp == '#')
- msg_fatal("-e or -# accepts no comment input");
+ msg_fatal("-e, -X, or -# accepts no comment input");
if (mode & EDIT_MAIN) {
if ((err = split_nameval(cp, &edit_key, &edit_val)) != 0)
msg_fatal("%s: \"%s\"", err, cp);
- } else if (mode & COMMENT_OUT) {
+ } else if (mode & (COMMENT_OUT | EDIT_EXCL)) {
if (*cp == 0)
- msg_fatal("-# requires non-blank parameter names");
+ msg_fatal("-X or -# requires non-blank parameter names");
if (strchr(cp, '=') != 0)
- msg_fatal("-# requires parameter names only");
+ msg_fatal("-X or -# requires parameter names only");
edit_key = mystrdup(cp);
trimblanks(edit_key, 0);
edit_val = 0;
vstream_fprintf(dst, "%s = %s\n", STR(key), cvalue->value);
else if (mode & COMMENT_OUT)
vstream_fprintf(dst, "#%s", cp);
- else
- msg_panic("edit_parameters: unknown mode %d", mode);
} else {
vstream_fputs(STR(buf), dst);
}