summaryrefslogtreecommitdiff
path: root/usr.sbin/acme-client/main.c
diff options
context:
space:
mode:
authorSebastian Benoit <benno@cvs.openbsd.org>2017-01-21 08:47:22 +0000
committerSebastian Benoit <benno@cvs.openbsd.org>2017-01-21 08:47:22 +0000
commitffda170c27e872cb3c93de63042205bd5590468f (patch)
treea9ef8160daae4894d3639b0b9ab020ffbd4ff5d8 /usr.sbin/acme-client/main.c
parent59e0a50ed107de9adf2704718fd9025fd361d321 (diff)
acme-client use configuration file [5 of 5]
implement new -n option to check and print configuration ok florian
Diffstat (limited to 'usr.sbin/acme-client/main.c')
-rw-r--r--usr.sbin/acme-client/main.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/usr.sbin/acme-client/main.c b/usr.sbin/acme-client/main.c
index 91b0aed71e5..e321a538a69 100644
--- a/usr.sbin/acme-client/main.c
+++ b/usr.sbin/acme-client/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.18 2017/01/21 08:45:52 benno Exp $ */
+/* $Id: main.c,v 1.19 2017/01/21 08:47:21 benno Exp $ */
/*
* Copyright (c) 2016 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -54,7 +54,7 @@ main(int argc, char *argv[])
struct domain_c *domain = NULL;
struct altname_c *ac;
- while (-1 != (c = getopt(argc, argv, "bFADrvf:")))
+ while (-1 != (c = getopt(argc, argv, "bFADrvnf:")))
switch (c) {
case 'b':
backup = 1;
@@ -79,6 +79,9 @@ main(int argc, char *argv[])
verbose = verbose ? 2 : 1;
popts |= ACME_OPT_VERBOSE;
break;
+ case 'n':
+ popts |= ACME_OPT_CHECK;
+ break;
default:
goto usage;
}
@@ -182,6 +185,9 @@ main(int argc, char *argv[])
if (ne > 0)
exit(EXIT_FAILURE);
+ if (popts & ACME_OPT_CHECK)
+ exit(EXIT_SUCCESS);
+
/* Set the zeroth altname as our domain. */
altsz = domain->altname_count + 1;
alts = calloc(altsz, sizeof(char *));
@@ -399,6 +405,6 @@ main(int argc, char *argv[])
(2 == c ? EXIT_SUCCESS : 2));
usage:
fprintf(stderr,
- "usage: acme-client [-bFADrv] [-f file] domain\n");
+ "usage: acme-client [-bFADrvn] [-f file] domain\n");
return (EXIT_FAILURE);
}