summaryrefslogtreecommitdiff
path: root/bin/dnssec/dnssec-settime.c
diff options
context:
space:
mode:
Diffstat (limited to 'bin/dnssec/dnssec-settime.c')
-rw-r--r--bin/dnssec/dnssec-settime.c67
1 files changed, 24 insertions, 43 deletions
diff --git a/bin/dnssec/dnssec-settime.c b/bin/dnssec/dnssec-settime.c
index 108d8033c126c..88f8cf1683310 100644
--- a/bin/dnssec/dnssec-settime.c
+++ b/bin/dnssec/dnssec-settime.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2013 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2009-2014 Internet Systems Consortium, Inc. ("ISC")
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -14,8 +14,6 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: dnssec-settime.c,v 1.32 2011/06/02 20:24:45 each Exp $ */
-
/*! \file */
#include <config.h>
@@ -68,6 +66,7 @@ usage(void) {
fprintf(stderr, " -K directory: set key file location\n");
fprintf(stderr, " -L ttl: set default key TTL\n");
fprintf(stderr, " -v level: set level of verbosity\n");
+ fprintf(stderr, " -V: print version information\n");
fprintf(stderr, " -h: help\n");
fprintf(stderr, "Timing options:\n");
fprintf(stderr, " -P date/[+-]offset/none: set/unset key "
@@ -171,7 +170,7 @@ main(int argc, char **argv) {
isc_stdtime_get(&now);
-#define CMDLINE_FLAGS "A:D:E:fhI:i:K:L:P:p:R:S:uv:"
+#define CMDLINE_FLAGS "A:D:E:fhI:i:K:L:P:p:R:S:uv:V"
while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
switch (ch) {
case 'E':
@@ -236,10 +235,7 @@ main(int argc, char **argv) {
}
break;
case 'L':
- if (strcmp(isc_commandline_argument, "none") == 0)
- ttl = 0;
- else
- ttl = strtottl(isc_commandline_argument);
+ ttl = strtottl(isc_commandline_argument);
setttl = ISC_TRUE;
break;
case 'v':
@@ -252,65 +248,45 @@ main(int argc, char **argv) {
fatal("-P specified more than once");
changed = ISC_TRUE;
- if (!strcasecmp(isc_commandline_argument, "none")) {
- unsetpub = ISC_TRUE;
- } else {
- setpub = ISC_TRUE;
- pub = strtotime(isc_commandline_argument,
- now, now);
- }
+ pub = strtotime(isc_commandline_argument,
+ now, now, &setpub);
+ unsetpub = !setpub;
break;
case 'A':
if (setact || unsetact)
fatal("-A specified more than once");
changed = ISC_TRUE;
- if (!strcasecmp(isc_commandline_argument, "none")) {
- unsetact = ISC_TRUE;
- } else {
- setact = ISC_TRUE;
- act = strtotime(isc_commandline_argument,
- now, now);
- }
+ act = strtotime(isc_commandline_argument,
+ now, now, &setact);
+ unsetact = !setact;
break;
case 'R':
if (setrev || unsetrev)
fatal("-R specified more than once");
changed = ISC_TRUE;
- if (!strcasecmp(isc_commandline_argument, "none")) {
- unsetrev = ISC_TRUE;
- } else {
- setrev = ISC_TRUE;
- rev = strtotime(isc_commandline_argument,
- now, now);
- }
+ rev = strtotime(isc_commandline_argument,
+ now, now, &setrev);
+ unsetrev = !setrev;
break;
case 'I':
if (setinact || unsetinact)
fatal("-I specified more than once");
changed = ISC_TRUE;
- if (!strcasecmp(isc_commandline_argument, "none")) {
- unsetinact = ISC_TRUE;
- } else {
- setinact = ISC_TRUE;
- inact = strtotime(isc_commandline_argument,
- now, now);
- }
+ inact = strtotime(isc_commandline_argument,
+ now, now, &setinact);
+ unsetinact = !setinact;
break;
case 'D':
if (setdel || unsetdel)
fatal("-D specified more than once");
changed = ISC_TRUE;
- if (!strcasecmp(isc_commandline_argument, "none")) {
- unsetdel = ISC_TRUE;
- } else {
- setdel = ISC_TRUE;
- del = strtotime(isc_commandline_argument,
- now, now);
- }
+ del = strtotime(isc_commandline_argument,
+ now, now, &setdel);
+ unsetdel = !setdel;
break;
case 'S':
predecessor = isc_commandline_argument;
@@ -324,8 +300,13 @@ main(int argc, char **argv) {
program, isc_commandline_option);
/* Falls into */
case 'h':
+ /* Does not return. */
usage();
+ case 'V':
+ /* Does not return. */
+ version(program);
+
default:
fprintf(stderr, "%s: unhandled option -%c\n",
program, isc_commandline_option);