diff options
author | 2009-06-14 23:39:43 +0000 | |
---|---|---|
committer | 2009-06-14 23:39:43 +0000 | |
commit | 3562dd6aec6899ff170c2fe0c886fc57d78202e6 (patch) | |
tree | 7c1481410c8ba123e43a5a28f0dd84763a24715f /usr.bin/mandoc/main.c | |
parent | sync to 1.7.16: comments, whitespace and spelling fixes; no functional change (diff) | |
download | wireguard-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.c | 19 |
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); |