From: Michael Stapelberg <stapelberg@debian.org>
To: tech@mdocml.bsd.lv
Subject: [PATCH] Implement -v to display the current version and exit
Date: Mon, 16 Jan 2017 09:29:07 +0100 [thread overview]
Message-ID: <CANnVG6ntFaUgKyRV1XtTctOUsZGt6BQAsgUThya=PscQL1Ko5g@mail.gmail.com> (raw)
[-- 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
next reply other threads:[~2017-01-16 8:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-16 8:29 Michael Stapelberg [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CANnVG6ntFaUgKyRV1XtTctOUsZGt6BQAsgUThya=PscQL1Ko5g@mail.gmail.com' \
--to=stapelberg@debian.org \
--cc=tech@mdocml.bsd.lv \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).