diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2009-06-14 23:39:44 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2009-06-14 23:39:44 +0000 |
commit | 8a7e073ca27b9e1be1b6d24148ae05302d0df734 (patch) | |
tree | 1c5365b5805f50a3ee056118936c060d09f3e49f /usr.bin | |
parent | f6d27199ebf240c1093c65815688d8051d048ab2 (diff) |
sync to 1.7.16: support -V command line option
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/mandoc/Makefile | 4 | ||||
-rw-r--r-- | usr.bin/mandoc/main.c | 19 | ||||
-rw-r--r-- | usr.bin/mandoc/mandoc.1 | 6 |
3 files changed, 24 insertions, 5 deletions
diff --git a/usr.bin/mandoc/Makefile b/usr.bin/mandoc/Makefile index e1071157e07..e33d66041a8 100644 --- a/usr.bin/mandoc/Makefile +++ b/usr.bin/mandoc/Makefile @@ -1,7 +1,9 @@ -# $OpenBSD: Makefile,v 1.2 2009/04/15 20:10:20 miod Exp $ +# $OpenBSD: Makefile,v 1.3 2009/06/14 23:39:43 schwarze Exp $ .include <bsd.own.mk> +VERSION=1.7.16 +CFLAGS+=-DVERSION=\"${VERSION}\" CFLAGS+=-W -Wall -Wstrict-prototypes .if ${USE_GCC3:L} != "no" CFLAGS+=-Wno-unused-parameter 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); diff --git a/usr.bin/mandoc/mandoc.1 b/usr.bin/mandoc/mandoc.1 index b03c5555f92..683ddd55596 100644 --- a/usr.bin/mandoc/mandoc.1 +++ b/usr.bin/mandoc/mandoc.1 @@ -1,4 +1,4 @@ -.\" $Id: mandoc.1,v 1.3 2009/06/14 23:00:57 schwarze Exp $ +.\" $Id: mandoc.1,v 1.4 2009/06/14 23:39:43 schwarze Exp $ .\" .\" Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se> .\" @@ -24,6 +24,7 @@ .\" SECTION .Sh SYNOPSIS .Nm mandoc +.Op Fl V .Op Fl f Ns Ar option... .Op Fl m Ns Ar format .Op Fl W Ns Ar err... @@ -55,6 +56,9 @@ Output format. See for available formats. Defaults to .Fl T Ns Ar ascii . .\" ITEM +.It Fl V +Print version and exit. +.\" ITEM .It Fl W Ns Ar err... Print warning messages. May be set to .Fl W Ns Ar all |