summaryrefslogtreecommitdiffstats
path: root/watchfrr/watchfrr.c
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2017-03-08 16:22:43 +0100
committerDavid Lamparter <equinox@opensourcerouting.org>2017-03-08 16:23:55 +0100
commit9272302b003fdc1090045b809d38185b1ecab72b (patch)
treecd800a1c4b7614e937614c36c45fd09dcec00581 /watchfrr/watchfrr.c
parent*: fix some user-visible Quagga remnants (diff)
downloadfrr-9272302b003fdc1090045b809d38185b1ecab72b.tar.xz
frr-9272302b003fdc1090045b809d38185b1ecab72b.zip
watchfrr: make min/max restart interval longopts
-m/-M seem to be seldomly used... ... and I kindof need/want -M for module loading. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'watchfrr/watchfrr.c')
-rw-r--r--watchfrr/watchfrr.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/watchfrr/watchfrr.c b/watchfrr/watchfrr.c
index 413a63100..6edce242b 100644
--- a/watchfrr/watchfrr.c
+++ b/watchfrr/watchfrr.c
@@ -174,6 +174,9 @@ struct daemon {
struct restart_info restart;
};
+#define OPTION_MINRESTART 2000
+#define OPTION_MAXRESTART 2001
+
static const struct option longopts[] = {
{"daemon", no_argument, NULL, 'd'},
{"statedir", required_argument, NULL, 'S'},
@@ -189,8 +192,8 @@ static const struct option longopts[] = {
{"all-restart", no_argument, NULL, 'a'},
{"always-all-restart", no_argument, NULL, 'A'},
{"unresponsive-restart", no_argument, NULL, 'z'},
- {"min-restart-interval", required_argument, NULL, 'm'},
- {"max-restart-interval", required_argument, NULL, 'M'},
+ {"min-restart-interval", required_argument, NULL, OPTION_MINRESTART },
+ {"max-restart-interval", required_argument, NULL, OPTION_MAXRESTART },
{"pid-file", required_argument, NULL, 'p'},
{"blank-string", required_argument, NULL, 'b'},
{"help", no_argument, NULL, 'h'},
@@ -263,10 +266,10 @@ Otherwise, the interval is doubled (but capped at the -M value).\n\n", progname,
The value should range from %d (LOG_EMERG) to %d (LOG_DEBUG),\n\
but it can be set higher than %d if extra-verbose debugging\n\
messages are desired.\n\
--m, --min-restart-interval\n\
+ --min-restart-interval\n\
Set the minimum seconds to wait between invocations of daemon\n\
restart commands (default is %d).\n\
--M, --max-restart-interval\n\
+ --max-restart-interval\n\
Set the maximum seconds to wait between invocations of daemon\n\
restart commands (default is %d).\n\
-i, --interval Set the status polling interval in seconds (default is %d)\n\
@@ -1044,7 +1047,7 @@ int main(int argc, char **argv)
frr_preinit(&watchfrr_di, argc, argv);
progname = watchfrr_di.progname;
- frr_opt_add("aAb:dek:l:m:M:i:p:r:R:S:s:t:T:z", longopts, "");
+ frr_opt_add("aAb:dek:l:i:p:r:R:S:s:t:T:z", longopts, "");
gs.restart.name = "all";
while ((opt = frr_getopt(argc, argv, NULL)) != EOF) {
@@ -1098,7 +1101,7 @@ int main(int argc, char **argv)
}
}
break;
- case 'm':
+ case OPTION_MINRESTART:
{
char garbage[3];
if ((sscanf(optarg, "%ld%1s",
@@ -1112,7 +1115,7 @@ int main(int argc, char **argv)
}
}
break;
- case 'M':
+ case OPTION_MAXRESTART:
{
char garbage[3];
if ((sscanf(optarg, "%ld%1s",