diff options
| author | Alejandro Colomar <alx@kernel.org> | 2024-12-06 15:32:48 +0100 |
|---|---|---|
| committer | Alejandro Colomar <alx@kernel.org> | 2024-12-06 16:09:11 +0100 |
| commit | 63f3d63ea780ead7626e527cec7bc0034c9c1955 (patch) | |
| tree | 401fc214f188c48bb376e3e2b98849ce6ba3c39f /src | |
| parent | 119ca28ddcdefdf77e507cc9c61c9280702794b2 (diff) | |
| download | man-pages-63f3d63ea780ead7626e527cec7bc0034c9c1955.tar.gz | |
src/bin/diffman: -w: Add support for diff(1)'s -w flag
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Diffstat (limited to 'src')
| -rwxr-xr-x | src/bin/diffman | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/bin/diffman b/src/bin/diffman index 56f6741355..c4f31359e6 100755 --- a/src/bin/diffman +++ b/src/bin/diffman @@ -6,12 +6,27 @@ set -Eeuo pipefail; shopt -s lastpipe; + +# Defaults: +w=''; + + err() { >&2 echo "$(basename "$0"): error: $*"; exit 1; } + +while getopts "w" opt; do + case "$opt" in + w) w='-w'; ;;& + \?) exit 1; ;;& + esac; +done; +shift $((OPTIND-1)); + + if test $# -ne 2; then err "Expected two arguments."; fi; @@ -32,4 +47,8 @@ printf '%s\n' "$2.XXXXXX" \ groff -man -Tutf8 <"$p1" >"$t1"; groff -man -Tutf8 <"$p2" >"$t2"; -diff -u "$t1" "$t2"; + +opts=($w -u); + + +diff "${opts[@]}" "$t1" "$t2"; |
