# HG changeset patch # User markus schnalke # Date 1291317775 10800 # Node ID f4117fd5a16366386206fe57f69e76f089348de7 # Parent 05fa719b7002ca814cac71bbc310fe2dc581a0ed made default mode sensible Until now in case no mode was specified, a message would have been read from stdin but then it would fail because no recipients had been given on the cmd line. (This had been useful only if -t was given.) Now in case of no mode being specified neither address arguments or -t is given then the version message is printed, otherwise mode accept is entered (as until yet). diff -r 05fa719b7002 -r f4117fd5a163 man/masqmail.8 --- a/man/masqmail.8 Wed Dec 01 18:27:46 2010 -0300 +++ b/man/masqmail.8 Thu Dec 02 16:22:55 2010 -0300 @@ -33,6 +33,12 @@ but not all are implemented. The \fB\-qo\fP option is additional, and unique to masqmail. +When no mode had been specified by either a command line option +(e.g. \fB\-bd\fP, \fB\-bs\fP) or by calling masqmail under a special name +(e.g. ``mailq''), then the default mode is used. +This is accepting messages on stdin if any address arguments are given, +and only printing its version (\fB\-bV\fP) otherwise. + .TP \fB\-\-\fR diff -r 05fa719b7002 -r f4117fd5a163 src/masqmail.c --- a/src/masqmail.c Wed Dec 01 18:27:46 2010 -0300 +++ b/src/masqmail.c Thu Dec 02 16:22:55 2010 -0300 @@ -38,7 +38,8 @@ It, as well as the distinction beween the two (non exclusive) daemon (queue and listen) modes, is handled by flags.*/ typedef enum _mta_mode { - MODE_ACCEPT = 0, /* accept message on stdin */ + MODE_NONE = 0, /* for being able to check if a mode was defined */ + MODE_ACCEPT, /* accept message on stdin */ MODE_DAEMON, /* run as daemon */ MODE_RUNQUEUE, /* single queue run, online or offline */ MODE_SMTP, /* accept SMTP on stdin */ @@ -46,7 +47,6 @@ MODE_MCMD, /* do queue manipulation */ MODE_VERSION, /* show version */ MODE_BI, /* fake ;-) */ - MODE_NONE /* to prevent default MODE_ACCEPT */ } mta_mode; char *pidfile = NULL; @@ -382,7 +382,7 @@ char* opt; gint arg; - mta_mode mta_mode = MODE_ACCEPT; + mta_mode mta_mode = MODE_NONE; gboolean do_listen = FALSE; gboolean do_runq = FALSE; gboolean do_runq_online = FALSE; @@ -536,6 +536,11 @@ } } + if (!mta_mode) { + fprintf(stderr, "arg:%d argc:%d\n", arg, argc); + mta_mode = (arg