tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
* [PATCH] Implement -v to display the current version and exit
@ 2017-01-16  8:29 Michael Stapelberg
  2017-01-17  0:37 ` Ingo Schwarze
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Stapelberg @ 2017-01-16  8:29 UTC (permalink / raw)
  To: tech

[-- Attachment #1: Type: text/plain, Size: 427 bytes --]

(Re-sending this post which was automatically denied before I
subscribed to this list.)

Rationale:
When using mandoc’s output in other services (e.g. a web man viewer),
it would be beneficial to display the version of mandoc that is in
use. Currently, one cannot determine mandoc’s version in a package
management-indepent way.

Please consider merging the attached patch. Thanks!

-- 
Best regards,
Michael

[-- Attachment #2: 0001-Implement-v-to-display-the-current-version-and-exit.patch --]
[-- Type: text/x-patch, Size: 1566 bytes --]

From 6846d805786f702ff28b6b2d370330bf2c16cc46 Mon Sep 17 00:00:00 2001
From: Michael Stapelberg <stapelberg@debian.org>
Date: Wed, 11 Jan 2017 09:06:46 +0100
Subject: [PATCH] Implement -v to display the current version and exit

---
 configure | 2 ++
 main.c    | 6 +++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index adf9eb4..e80cf68 100755
--- a/configure
+++ b/configure
@@ -40,6 +40,7 @@ UTF8_LOCALE=
 CC=`printf "all:\\n\\t@echo \\\$(CC)\\n" | env -i make -sf -`
 CFLAGS="-g -W -Wall -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings"
 CFLAGS="${CFLAGS} -Wno-unused-parameter"
+CPPFLAGS="-DVERSION=\\\"\${VERSION}\\\""
 LDADD=
 LDFLAGS=
 LD_NANOSLEEP=
@@ -438,6 +439,7 @@ BUILD_TARGETS	= ${BUILD_TARGETS}
 INSTALL_TARGETS	= ${INSTALL_TARGETS}
 CC		= ${CC}
 CFLAGS		= ${CFLAGS}
+CPPFLAGS	= ${CPPFLAGS}
 LDADD		= ${LDADD}
 LDFLAGS		= ${LDFLAGS}
 STATIC		= ${STATIC}
diff --git a/main.c b/main.c
index b64b3be..fcfb27f 100644
--- a/main.c
+++ b/main.c
@@ -195,7 +195,7 @@ main(int argc, char *argv[])
 	outmode = OUTMODE_DEF;
 
 	while (-1 != (c = getopt(argc, argv,
-			"aC:cfhI:iK:klM:m:O:S:s:T:VW:w"))) {
+			"aC:cfhI:iK:klM:m:O:S:s:T:vVW:w"))) {
 		switch (c) {
 		case 'a':
 			outmode = OUTMODE_ALL;
@@ -261,6 +261,10 @@ main(int argc, char *argv[])
 			if ( ! toptions(&curp, optarg))
 				return (int)MANDOCLEVEL_BADARG;
 			break;
+		case 'v':
+			printf("mandoc %s\n", VERSION);
+			exit(0);
+			break;
 		case 'W':
 			if ( ! woptions(&curp, optarg))
 				return (int)MANDOCLEVEL_BADARG;
-- 
2.11.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-01-17 13:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-16  8:29 [PATCH] Implement -v to display the current version and exit Michael Stapelberg
2017-01-17  0:37 ` Ingo Schwarze
2017-01-17  7:28   ` Michael Stapelberg
2017-01-17 13:09     ` Ingo Schwarze
2017-01-17 13:22       ` Michael Stapelberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).