aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/man
diff options
context:
space:
mode:
authorMohamed Akram <mohd.akram@outlook.com>2024-01-15 18:27:04 +0000
committerWarner Losh <imp@FreeBSD.org>2024-01-15 18:30:37 +0000
commitec13a838e6857585d3c3db70a0a67e337248ec28 (patch)
tree4a6008b2a5fc0e87e784deac54aa2779a93e22b2 /usr.bin/man
parenta5ef95cd228e43bcc459a5c8a9911e57888ba5fd (diff)
downloadsrc-ec13a838e6857585d3c3db70a0a67e337248ec28.tar.gz
src-ec13a838e6857585d3c3db70a0a67e337248ec28.zip
man: avoid unportable use of utilities
echo -e is not portable. It can be replaced by printf %b (it works only with the /bin/sh built-in echo, not /bin/echo anyway). head -# is not portable, but head -n # is. Replace these two things in three places total. Signed-off-by: Mohamed Akram <mohd.akram@outlook.com> Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1062
Diffstat (limited to 'usr.bin/man')
-rwxr-xr-xusr.bin/man/man.sh6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/man/man.sh b/usr.bin/man/man.sh
index 777726f880db..efb05603f912 100755
--- a/usr.bin/man/man.sh
+++ b/usr.bin/man/man.sh
@@ -312,7 +312,7 @@ man_check_for_so() {
# We need to loop to accommodate multiple .so directives.
while true
do
- line=$($cattool "$manpage" | head -1)
+ line=$($cattool "$manpage" | head -n1)
case "$line" in
.so*) trim "${line#.so}"
decho "$manpage includes $tstr"
@@ -897,11 +897,11 @@ search_whatis() {
bad=${bad#\\n}
if [ -n "$good" ]; then
- echo -e "$good" | $MANPAGER
+ printf '%b\n' "$good" | $MANPAGER
fi
if [ -n "$bad" ]; then
- echo -e "$bad" >&2
+ printf '%b\n' "$bad" >&2
fi
exit $rval