Module Name: src
Committed By: christos
Date: Fri Apr 5 22:30:18 UTC 2024
Modified Files:
src/lib/libterminfo: genman
Log Message:
>From Jan-Benedict Glaw:
Use `printf` instead of `echo` for precise output
`man` pages generated under NetBSD and Linux differ as the escape codes
may or may not be interpreted when going through those two chained `echo`es.
Instead just use `printf`, which produces the desired output, always.
To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libterminfo/genman
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libterminfo/genman
diff -u src/lib/libterminfo/genman:1.5 src/lib/libterminfo/genman:1.6
--- src/lib/libterminfo/genman:1.5 Fri Jan 25 07:52:45 2013
+++ src/lib/libterminfo/genman Fri Apr 5 18:30:18 2024
@@ -1,5 +1,5 @@
#!/bin/sh
-# $NetBSD: genman,v 1.5 2013/01/25 12:52:45 roy Exp $
+# $NetBSD: genman,v 1.6 2024/04/05 22:30:18 christos Exp $
# Copyright (c) 2009, 2013 The NetBSD Foundation, Inc.
#
@@ -44,11 +44,11 @@ gentab()
# Generate a list of long names and codes
$TOOL_SED -n \
-e "s/#define t_\([^(]*\).*>$tab\[TICODE_\([^]]*\).*/\1 \2/p" \
- $ti | $TOOL_SORT | while read name code foo; do
+ $ti | $TOOL_SORT | while read name code _; do
cap=$($TOOL_SED -ne "s/.*{ \"\(..\)\", TICODE_$code }.*/\1/p" \
$tc | head -n 1)
desc=$($TOOL_SED -ne "s/ \* $name\: \(.*\)/\1/p" $ti)
- echo ".It \"\\&$name\" Ta Sy \"\\&$code\" Ta Sy \"\\&$cap\" Ta \"\\&$desc\""
+ printf '.It "\\&%s" Ta Sy "\\&%s" Ta Sy "\\&%s" Ta "\\&%s"\n' "${name}" "${code}" "${cap}" "${desc}"
done
}
@@ -56,15 +56,15 @@ boolcaps=$(gentab $TERMH $TERMC flags)
numcaps=$(gentab $TERMH $TERMC nums)
strcaps=$(gentab $TERMH $TERMC strs)
-echo ".\\\"DO NOT EDIT"
-echo ".\\\"Automatically generated from termcap.5.in"
-echo ".\\\""
+printf '.\\"DO NOT EDIT\n'
+printf '.\\"Automatically generated from termcap.5.in\n'
+printf '.\\"\n'
while read -r line; do
case "$line" in
- "@BOOLCAPS@") echo "$boolcaps";;
- "@NUMCAPS@") echo "$numcaps";;
- "@STRCAPS@") echo "$strcaps";;
- *) echo "$line";;
+ "@BOOLCAPS@") printf '%s\n' "${boolcaps}";;
+ "@NUMCAPS@") printf '%s\n' "${numcaps}";;
+ "@STRCAPS@") printf '%s\n' "${strcaps}";;
+ *) printf '%s\n' "${line}";;
esac
done <$TERMM