summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/main.c
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2009-06-14 23:39:43 +0000
committerschwarze <schwarze@openbsd.org>2009-06-14 23:39:43 +0000
commit3562dd6aec6899ff170c2fe0c886fc57d78202e6 (patch)
tree7c1481410c8ba123e43a5a28f0dd84763a24715f /usr.bin/mandoc/main.c
parentsync to 1.7.16: comments, whitespace and spelling fixes; no functional change (diff)
downloadwireguard-openbsd-3562dd6aec6899ff170c2fe0c886fc57d78202e6.tar.xz
wireguard-openbsd-3562dd6aec6899ff170c2fe0c886fc57d78202e6.zip
sync to 1.7.16: support -V command line option
Diffstat (limited to 'usr.bin/mandoc/main.c')
-rw-r--r--usr.bin/mandoc/main.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/usr.bin/mandoc/main.c b/usr.bin/mandoc/main.c
index ddb3b2d2a94..682a5ff2e00 100644
--- a/usr.bin/mandoc/main.c
+++ b/usr.bin/mandoc/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.2 2009/06/14 23:00:57 schwarze Exp $ */
+/* $Id: main.c,v 1.3 2009/06/14 23:39:43 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -98,6 +98,7 @@ static int pset(const char *, int, struct curparse *,
struct man **, struct mdoc **);
static struct man *man_init(struct curparse *);
static struct mdoc *mdoc_init(struct curparse *);
+__dead static void version(void);
__dead static void usage(void);
extern char *__progname;
@@ -116,7 +117,7 @@ main(int argc, char *argv[])
curp.outtype = OUTT_ASCII;
/* LINTED */
- while (-1 != (c = getopt(argc, argv, "f:m:W:T:")))
+ while (-1 != (c = getopt(argc, argv, "f:m:VW:T:")))
switch (c) {
case ('f'):
if ( ! foptions(&curp.fflags, optarg))
@@ -134,6 +135,9 @@ main(int argc, char *argv[])
if ( ! woptions(&curp.wflags, optarg))
return(0);
break;
+ case ('V'):
+ version();
+ /* NOTREACHED */
default:
usage();
/* NOTREACHED */
@@ -187,10 +191,19 @@ main(int argc, char *argv[])
__dead static void
+version(void)
+{
+
+ (void)printf("%s %s\n", __progname, VERSION);
+ exit(EXIT_SUCCESS);
+}
+
+
+__dead static void
usage(void)
{
- (void)fprintf(stderr, "usage: %s [-foption...] "
+ (void)fprintf(stderr, "usage: %s [-V] [-foption...] "
"[-mformat] [-Toutput] [-Werr...]\n",
__progname);
exit(EXIT_FAILURE);