diff options
author | Matthias Andree <matthias.andree@gmx.de> | 2010-12-18 16:07:57 +0100 |
---|---|---|
committer | Matthias Andree <matthias.andree@gmx.de> | 2016-07-06 10:03:46 +0200 |
commit | 36c5075506895b66e783b76355013de66823fb3d (patch) | |
tree | 9296bc7cad0bd7fecaa90b1a0ce61bd85675c60f /options.c | |
parent | 1ae9d7bf1499cb005a52030ab4ed51a37ec81b02 (diff) | |
download | fetchmail-36c5075506895b66e783b76355013de66823fb3d.tar.gz fetchmail-36c5075506895b66e783b76355013de66823fb3d.tar.bz2 fetchmail-36c5075506895b66e783b76355013de66823fb3d.zip |
Accept more options with a running daemon.
(Cherry-picked from master's 1a92b2909610096a11d26f7a7317d32819354be3.)
Diffstat (limited to 'options.c')
-rw-r--r-- | options.c | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -233,7 +233,10 @@ static int xatoi(char *s, int *errflagptr) int parsecmdline (int argc /** argument count */, char **argv /** argument strings */, struct runctl *rctl /** global run controls to modify */, - struct query *ctl /** option record to initialize */) + struct query *ctl /** option record to initialize */, + flag *safewithbg /** set to whether options are + compatible with another copy + running in the background */) { /* * return value: if positive, argv index of last parsed option + 1 @@ -248,9 +251,12 @@ int parsecmdline (int argc /** argument count */, int errflag = 0; /* TRUE when a syntax error is detected */ int helpflag = 0; /* TRUE when option help was explicitly requested */ int option_index; + int option_safe; /* to track if option currently parsed is safe + with a background copy */ char *buf, *cp; rctl->poll_interval = -1; + *safewithbg = TRUE; memset(ctl, '\0', sizeof(struct query)); /* start clean */ ctl->smtp_socket = -1; @@ -259,21 +265,26 @@ int parsecmdline (int argc /** argument count */, (c = getopt_long(argc,argv,shortoptions, longoptions, &option_index)) != -1) { + option_safe = FALSE; + switch (c) { case 'V': versioninfo = TRUE; + option_safe = TRUE; break; case 'c': check_only = TRUE; break; case 's': outlevel = O_SILENT; + option_safe = 1; break; case 'v': if (outlevel >= O_VERBOSE) outlevel = O_DEBUG; else outlevel = O_VERBOSE; + option_safe = TRUE; break; case 'd': rctl->poll_interval = xatoi(optarg, &errflag); @@ -600,6 +611,7 @@ int parsecmdline (int argc /** argument count */, case LA_CONFIGDUMP: configdump = TRUE; + option_safe = TRUE; break; case LA_SYSLOG: @@ -615,9 +627,11 @@ int parsecmdline (int argc /** argument count */, break; case '?': + helpflag = 1; default: - helpflag++; + break; } + *safewithbg &= option_safe; } if (errflag || ocount > 1 || helpflag) { |