]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
src/bin/diffman, man/man1/diffman.1: Use man(1) to format the pages
authorAlejandro Colomar <alx@kernel.org>
Sun, 5 Jan 2025 14:34:54 +0000 (15:34 +0100)
committerAlejandro Colomar <alx@kernel.org>
Sun, 5 Jan 2025 17:07:05 +0000 (18:07 +0100)
This allows using the environment variables that man(1) understands.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
man/man1/diffman.1
src/bin/diffman

index e648f7b3829aef3dbd9c9904ce9c0ce71a4486c2..b93916e377656b9ffd2eafc44fecca6a8bc580c8 100644 (file)
@@ -41,6 +41,9 @@ lines of unified context.
 .TP
 .B \-w
 Ignore all white space.
+.SH ENVIRONMENT
+See
+.BR man (1).
 .SH EXAMPLES
 .EX
 .RB $\~ "diffman membarrier man2/membarrier.2 | less \-R" ;
index dbd12e0a571dc8c9cf57e61aba42d53c88d8773c..12bad62e7e9e2429fb9fff5d0fb434bda03dae90 100755 (executable)
@@ -36,9 +36,6 @@ if test $# -ne 2; then
        err "Expected two arguments.";
 fi;
 
-p1="$(man -w "$1")";
-p2="$(man -w "$2")";
-
 printf '%s\n' "$1.XXXXXX" \
 | sed 's,.*/,,' \
 | xargs mktemp -t \
@@ -49,17 +46,11 @@ printf '%s\n' "$2.XXXXXX" \
 | xargs mktemp -t \
 | read -r t2;
 
-preconv <"$p1" \
-| tbl \
-| eqn -Tutf8 \
-| troff -mandoc -Tutf8 \
-| grotty >"$t1";
-
-preconv <"$p2" \
-| tbl \
-| eqn -Tutf8 \
-| troff -mandoc -Tutf8 \
-| grotty >"$t2";
+test -v MAN_KEEP_FORMATTING \
+|| export MAN_KEEP_FORMATTING=1;
+
+man "$1" >"$t1";
+man "$2" >"$t2";
 
 
 # shellcheck disable=SC2206  # We want only non-empty variables in the array.