From: Peter Maydell <pmaydell@chiark.greenend.org.uk>
Date: Sun, 3 Aug 2008 15:14:23 +0000 (+0000)
Subject: Bug #23436: fix some minor manpage syntax errors and add a test which runs
X-Git-Tag: PRE_POSIX_CONVERSION~45
X-Git-Url: http://git.marmaro.de/?a=commitdiff_plain;h=a3ef57491a1bc4d2e227b14a8e838ffb6c5b5f63;p=mmh

Bug #23436: fix some minor manpage syntax errors and add a test which runs
groff over them and checks that no warnings are emitted.
---

diff --git a/man/forw.man b/man/forw.man
index c59f4a6c..0f05b68f 100644
--- a/man/forw.man
+++ b/man/forw.man
@@ -96,10 +96,14 @@ If the
 .B \-annotate
 switch is given, each message being forwarded will
 be annotated with the lines:
-
-     Forwarded:\ date
-     Forwarded:\ addrs
-
+.PP
+.RS 5
+.nf
+Forwarded:\ date
+Forwarded:\ addrs
+.fi
+.RE
+.PP
 where each address list contains as many lines as required.  This
 annotation will be done only if the message is sent directly from
 .BR forw .
@@ -295,8 +299,8 @@ the
 .BR \-mime ,
 and
 .B \-digest
-switches is bypassed, and the usual leading and trailing
-'Forwarded Message' delimiters are not added.
+switches is bypassed, and the usual leading and
+trailing 'Forwarded Message' delimiters are not added.
 The same caveats apply to this option as to the
 .B \-build
 switch.
diff --git a/man/inc.man b/man/inc.man
index baaead8e..86280b97 100644
--- a/man/inc.man
+++ b/man/inc.man
@@ -88,7 +88,7 @@ line per message to the end of the specified audit\-file with the format:
 .PP
 .RS 5
 .nf
-\*(<<inc\*(>> date
+<<inc>> date
 <scan line for first message>
 <scan line for second message>
 <etc.>
diff --git a/man/mh-chart.man b/man/mh-chart.man
index 707e2be3..5e097e43 100644
--- a/man/mh-chart.man
+++ b/man/mh-chart.man
@@ -331,7 +331,7 @@ is equivalent to
 .IR text ]
 .RB [ \-cc
 .I addrs
-...]
+\&...]
 .RB [ \-from
 .IR addr ]
 .RB [ \-subject
@@ -450,7 +450,7 @@ all/mail/nomail ]
 .RB [ \-snoop ]
 %nmhendpop%
 .RI [ users
-... ]
+\&... ]
 .RB [ \-version ]
 .RB [ \-help ]
 
diff --git a/man/mhmail.man b/man/mhmail.man
index 7e46677c..75f49189 100644
--- a/man/mhmail.man
+++ b/man/mhmail.man
@@ -15,7 +15,7 @@ mhmail \- send or read mail
 .IR text ]
 .RB [ \-cc
 .I addrs
-...]
+\&...]
 .RB [ \-from
 .IR addr ]
 .RB [ \-subject
@@ -77,7 +77,7 @@ length,
 .B mhmail
 will not send the message.  You can use the switch
 .B \-body
-\*(lr\*(rq to force an empty message.
+\*(lq\*(rq to force an empty message.
 .PP
 Normally, addresses appearing as arguments are put in the \*(lqTo:\*(rq
 field.  If the
diff --git a/man/mhshow.man b/man/mhshow.man
index 37172025..78d8ed95 100644
--- a/man/mhshow.man
+++ b/man/mhshow.man
@@ -529,7 +529,7 @@ operates may vary for
 different machines,
 .B mhshow
 will look for the environment variable
-.BE $MHSHOW .
+.BR $MHSHOW .
 If present, this specifies the name of an additional
 user profile which should be read.  Hence, when a user logs in on a
 particular display device, this environment variable should be set to
diff --git a/man/mhstore.man b/man/mhstore.man
index ae15292a..49072735 100644
--- a/man/mhstore.man
+++ b/man/mhstore.man
@@ -162,8 +162,8 @@ the message contains information indicating the filename that should
 be used to store the content.  This information should be specified
 as the attribute \*(lqname=filename\*(rq in the \*(lqContent-Type\*(rq header
 for the content you are storing.  For security reasons, this filename
-will be ignored if it begins with the character '/', '.', '|', or
-'!', or if it contains the character '%'.  For the sake of security,
+will be ignored if it begins with the character '/', '.', '|', or '!',
+or if it contains the character '%'.  For the sake of security,
 this switch is not the default, and it is recommended that you do
 NOT put the
 .B \-auto
@@ -418,7 +418,7 @@ operates may vary for
 different machines,
 .B mhstore
 will look for the environment variable
-.BE $MHSTORE .
+.BR $MHSTORE .
 If present, this specifies the name of an additional
 user profile which should be read.  Hence, when a user logs in on a
 particular machine, this environment variable should be set to
diff --git a/man/msgchk.man b/man/msgchk.man
index 49a841d2..6decb1e5 100644
--- a/man/msgchk.man
+++ b/man/msgchk.man
@@ -27,7 +27,7 @@ all/mail/nomail ]
 .RB [ \-snoop ]
 %nmhendpop%
 .RI [ users
-... ]
+\&... ]
 .RB [ \-version ]
 .RB [ \-help ]
 .ad
diff --git a/man/packf.man b/man/packf.man
index d220a76a..a351578b 100644
--- a/man/packf.man
+++ b/man/packf.man
@@ -91,4 +91,3 @@ inc(1)
 .SH CONTEXT
 If a folder is given, it will become the current folder.  The first
 message packed will become the current message.
-.En
diff --git a/man/scan.man b/man/scan.man
index 3655a100..7da788e9 100644
--- a/man/scan.man
+++ b/man/scan.man
@@ -37,8 +37,8 @@ and, if room allows, some of the body of the message.  For example:
 .RS 5
 .nf
 .ta \w'15+- 'u +\w'07/\|05x 'u +\w'Dcrocker  'u
-15+	10/\|05 crocker	nned\0\0\*(<<Last week I asked some of
-16\-	10/\|05 crocker	message id format\0\0\*(<<I recommend
+15+	10/\|05 crocker	nned\0\0<<Last week I asked some of
+16\-	10/\|05 crocker	message id format\0\0\<<I recommend
 18	10/\|06 brien	Re: Exit status from mkdir
 19	10/\|07*brien	\*(lqscan\*(rq listing format in nmh
 .fi
diff --git a/test/tests/manpages/test-manpages b/test/tests/manpages/test-manpages
new file mode 100644
index 00000000..ab06831c
--- /dev/null
+++ b/test/tests/manpages/test-manpages
@@ -0,0 +1,53 @@
+#!/bin/sh
+######################################################
+#
+# Test that the manpages don't have any syntax errors
+# as detected by groff.
+#
+######################################################
+
+# First find out whether we have a groff on the path:
+
+# portable implementation of 'which' utility
+findprog()
+{
+  FOUND=
+  PROG="$1"
+  IFS_SAVE="$IFS"
+  IFS=:
+  for D in $PATH; do
+    if [ -z "$D" ]; then
+      D=.
+    fi
+    if [ -f "$D/$PROG" ] && [ -x "$D/$PROG" ]; then
+      printf '%s\n' "$D/$PROG"
+      break
+    fi
+  done
+  IFS="$IFS_SAVE"
+}
+
+if [ -z "$(findprog groff)" ]; then
+  echo "Test $0 SKIP (missing groff)"
+  exit 120
+fi
+
+cd $MH_TEST_DIR/share/man
+
+# groff will still exit with status zero even if warnings
+# were emitted, so we have to jump through hoops to
+# find out if any were emitted.
+
+expected=$MH_TEST_DIR/$$.expected
+actual=$MH_TEST_DIR/$$.actual
+
+# There aren't any expected warnings at the moment but
+# this mechanism does let us add them if necessary later.
+rm -f "$expected" "$actual"
+touch "$expected" "$actual"
+
+for manpage in man?/*.?; do
+  groff -Tutf8 -mandoc -wmac "$manpage" > /dev/null 2>>"$actual"
+done
+
+diff -u "$expected" "$actual"