aboutsummaryrefslogtreecommitdiff
path: root/check/man
diff options
context:
space:
mode:
Diffstat (limited to 'check/man')
-rwxr-xr-xcheck/man49
1 files changed, 49 insertions, 0 deletions
diff --git a/check/man b/check/man
new file mode 100755
index 00000000..4b5a7831
--- /dev/null
+++ b/check/man
@@ -0,0 +1,49 @@
+#!/bin/sh
+# Check that manual pages and logical binaries match up
+
+# Need some scripts from the source directory
+PATH=bin:$PATH
+
+# Create temporary directory and implement cleanup function for it
+td=
+cleanup() {
+ rm -fr -- "$td"
+}
+for sig in EXIT HUP INT TERM ; do
+ trap cleanup "$sig"
+done
+td=$(mktd test-man) || exit
+
+# Get lists of logical binaries and manual pages
+for dir in bin games ; do (
+ cd -- "$dir"
+ pa *
+) done |
+sed 's/\...*$//' |
+sort | uniq > "$td"/bin
+for dir in man/man[168] ; do (
+ cd -- "$dir"
+ pa *.[168]
+) done |
+sed 's/\.[168]$//' |
+sort | uniq > "$td"/man
+
+# Get lists of noman scripts and nobin manual pages
+comm -23 "$td"/bin "$td"/man > "$td"/noman
+comm -13 "$td"/bin "$td"/man > "$td"/nobin
+
+# Emit the content of both, if any
+ex=0
+if [ -s "$td"/noman ] ; then
+ printf >&2 '%s\n' 'No manual pages found for:'
+ cat >&2 -- "$td"/noman
+ ex=1
+fi
+if [ -s "$td"/nobin ] ; then
+ printf >&2 '%s\n' 'Stray manual page for:'
+ cat >&2 -- "$td"/nobin
+ ex=1
+fi
+
+# Exit appropriately
+exit "$ex"