>>>>> Colin Watson <[EMAIL PROTECTED]> writes:
> Package: man-db
> Version: 2.5.0-3
> Severity: wishlist
> It would be useful to be able to tell man to pass the -wmac option to
> groff, or other similar warning options. I would like to add at least an
> option to man to pass arbitrary warning options to groff; it might even
> be useful (with care) to allow passing arbitrary options rather than
> limiting it to warnings.
It was suggested that man-db gets one more command as well, to
do the checking in a ``standard way''. So, I suggest the
following:
* add support for an MANROFFOPT environment variable to specify
extra arguments to groff (analogous to MANROFFSEQ and MANOPT);
* add a command, `manwe' (for ``MAN with Warnings Enabled''),
which will behave just like `man', but with (some) Groff
warnings enabled;
* the command should support altering the set of warnings to be
enabled via, say, MANWEWARN environment variable.
Please note that `manwe' would only work as intended if `man' is
to call `groff'. So, `-t' option may be necessary, e. g.:
$ manwe -t ifconfig > /dev/null
<standard input>:63: warning: `Note:' not defined
$
The patch follows.
--- man-db-2.5.0-debian-3/include/Defines.in 2007-09-17 00:47:10.000000000
+0700
+++ man-db-2.5.0-debian-3-manwe/include/Defines.in 2007-11-24
02:46:55.000000000 +0600
@@ -80,6 +80,7 @@
man = $(shell echo man |sed '$(transform)')
mandb = $(shell echo mandb |sed '$(transform)')
+manwe = $(shell echo manwe |sed '$(transform)')
catman = $(shell echo catman |sed '$(transform)')
whatis = $(shell echo whatis |sed '$(transform)')
apropos = $(shell echo apropos |sed '$(transform)')
--- man-db-2.5.0-debian-3/man/Makefile.in 2007-09-17 02:37:33.000000000
+0700
+++ man-db-2.5.0-debian-3-manwe/man/Makefile.in 2007-11-24 02:29:07.000000000
+0600
@@ -41,6 +41,7 @@
# capitalized variants for .TH lines
thman := $(shell echo '$(man)' | tr '[:lower:]' '[:upper:]')
thmandb := $(shell echo '$(mandb)' | tr '[:lower:]' '[:upper:]')
+thmanwe := $(shell echo '$(manwe)' | tr '[:lower:]' '[:upper:]')
thwhatis := $(shell echo '$(whatis)' | tr '[:lower:]' '[:upper:]')
thapropos := $(shell echo '$(apropos)' | tr '[:lower:]' '[:upper:]')
thcatman := $(shell echo '$(catman)' | tr '[:lower:]' '[:upper:]')
@@ -58,6 +59,7 @@
-e 's,%man%,$(man),g' \
-e 's,%mandb%,$(mandb),g' \
-e 's,%manpath%,$(manpath),g' \
+ -e 's,%manwe%,$(manwe),g' \
-e 's,%catman%,$(catman),g' \
-e 's,%apropos%,$(apropos),g' \
-e 's,%whatis%,$(whatis),g' \
@@ -65,6 +67,7 @@
-e 's,%thzsoelim%,$(thzsoelim),g' \
-e 's,%thman%,$(thman),g' \
-e 's,%thmandb%,$(thmandb),g' \
+ -e 's,%thmanwe%,$(thmanwe),g' \
-e 's,%thmanpath%,$(thmanpath),g' \
-e 's,%thcatman%,$(thcatman),g' \
-e 's,%thapropos%,$(thapropos),g' \
@@ -74,7 +77,7 @@
$< > $@
endef
-man1 = man manpath apropos whatis zsoelim lexgrog manconv
+man1 = man manpath apropos whatis zsoelim lexgrog manconv manwe
man5 = manpath
man8 = mandb catman accessdb
--- man-db-2.5.0-debian-3/man/man1/manwe.man1 1970-01-01 07:00:00.000000000
+0700
+++ man-db-2.5.0-debian-3-manwe/man/man1/manwe.man1 2007-11-24
02:39:41.000000000 +0600
@@ -0,0 +1,36 @@
+.\" Man page for manwe
+.\"
+.\" Author: Ivan Shmakov
+.\" This file is in public domain
+.\"
+.\" (Hope I didn't mess this one; is it my first manual page?)
+.\"
+.pc
+.TH %thmanwe% 1 "%date%" "%version%" "Manual pager utils"
+.SH NAME
+%manwe% \- a man with warnings enabled
+.SH SYNOPSIS
+.\" The general command line
+.B %manwe%
+.RI [\| man-options .\|.\|.\|\|]
+.SH DESCRIPTION
+.B %manwe%
+behaves identically to
+.BR %man% ,
+but with roff warnings enabled.
+.SH ENVIRONMENT
+.\".TP \w'MANWEWARN\ \ 'u
+.TP
+.if !'po4a'hide' .B MANWEWARN
+If
+.RB $ MANWEWARN
+is set, its value is used as the comma- or space-separated list of
+Groff warnings to enable. Check
+.BR groff (1)
+documentation for a full list.
+.SH "SEE ALSO"
+.BR %man% (1),
+.BR groff (1).
+.SH HISTORY
+2007 \- Written by Ivan Shmakov in response to Debian
+.BR Bug#451187 .
--- man-db-2.5.0-debian-3/src/Makefile.in 2007-09-17 01:35:35.000000000
+0700
+++ man-db-2.5.0-debian-3-manwe/src/Makefile.in 2007-11-24 02:25:51.000000000
+0600
@@ -79,6 +79,7 @@
# The default programs to build
all: $(PROGS) $(PUBTOOLS) manconv wrapper man_db.conf
+all: manwe.sh
#--------------------#
# some general rules #
@@ -128,12 +129,16 @@
globbing: globbing.c util.o
$(LINK.c) -DTEST $^ $(LDLIBS) -o $@
+manwe.sh: manwe.sh.in
+ sed -e "s/@MAN@/$(man)/" $< > manwe.sh
+
# The standard targets
install:
$(MKINSTALLDIRS) $(DESTDIR)$(bindir) $(DESTDIR)$(sbindir) \
$(DESTDIR)$(libdir)/man-db
$(INSTALL_PROGRAM) $(man_install_flags) man $(DESTDIR)$(bindir)/$(man)
$(INSTALL_PROGRAM) $(man_install_flags) mandb
$(DESTDIR)$(bindir)/$(mandb)
+ $(INSTALL_PROGRAM) manwe.sh $(DESTDIR)$(bindir)/$(manwe)
$(INSTALL_PROGRAM) manpath $(DESTDIR)$(bindir)/$(manpath)
$(INSTALL_PROGRAM) catman $(DESTDIR)$(bindir)/$(catman)
$(INSTALL_PROGRAM) whatis $(DESTDIR)$(bindir)/$(whatis)
--- man-db-2.5.0-debian-3/src/man.c 2007-11-24 01:54:12.000000000 +0600
+++ man-db-2.5.0-debian-3-manwe/src/man.c 2007-11-24 02:15:52.000000000
+0600
@@ -1254,6 +1254,7 @@
char *fmt_prog;
pipeline *p = pipeline_new ();
command *cmd;
+ const char *roff_opt;
#ifndef ALT_EXT_FORMAT
dir = dir; /* not used unless looking for formatters in catdir */
@@ -1261,6 +1262,10 @@
pp_string = get_preprocessors (decomp, dbfilters);
+ if ((roff_opt = getenv ("MANROFFOPT")) == 0) {
+ roff_opt = "";
+ }
+
#ifdef ALT_EXT_FORMAT
/* Check both external formatter locations */
if (dir) {
@@ -1444,6 +1449,8 @@
add_roff_line_length (cmd, &save_cat);
#endif
+ command_argstr (cmd, roff_opt);
+
wants_dev = 1;
wants_post = 1;
break;
@@ -1522,6 +1529,7 @@
cmd = command_new_args (fmt_prog, file, pp_string, NULL);
if (roff_device)
command_arg (cmd, roff_device);
+ command_argstr (cmd, roff_opt);
pipeline_command (p, cmd);
}
--- man-db-2.5.0-debian-3/src/manwe.sh.in 1970-01-01 07:00:00.000000000
+0700
+++ man-db-2.5.0-debian-3-manwe/src/manwe.sh.in 2007-11-24 03:14:39.000000000
+0600
@@ -0,0 +1,6 @@
+#!/bin/sh
+: ${MANWEWARN:=mac}
+opt="$(echo "$MANWEWARN" | tr ' \t\r' \\n | sed -e s/^/-w/)"
+opt="$opt${MANROFFOPT+ }${MANROFFOPT}"
+
+MANROFFOPT="$opt" exec @MAN@ "$@"
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]