Module Name: src
Committed By: kre
Date: Mon Oct 14 08:27:19 UTC 2024
Modified Files:
src/bin/sh: mknodenames.sh
Log Message:
Use tools awk where appropriate
And while here, switch from using echo to printf (via a
function echo() which just uses printf, but is limited to
this file only - it isn't general enough for use elsewhere).
NFCI
To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/bin/sh/mknodenames.sh
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/bin/sh/mknodenames.sh
diff -u src/bin/sh/mknodenames.sh:1.6 src/bin/sh/mknodenames.sh:1.7
--- src/bin/sh/mknodenames.sh:1.6 Sat Aug 18 03:09:37 2018
+++ src/bin/sh/mknodenames.sh Mon Oct 14 08:27:19 2024
@@ -1,10 +1,19 @@
#! /bin/sh
-# $NetBSD: mknodenames.sh,v 1.6 2018/08/18 03:09:37 kre Exp $
+# $NetBSD: mknodenames.sh,v 1.7 2024/10/14 08:27:19 kre Exp $
# Use this script however you like, but it would be amazing if
# it has any purpose other than as part of building the shell...
+# All (like every single one) uses of echo in this script
+# have at most 1 argument (string) to print, and none use -n
+# hence replacing echo with printf is trivial...
+
+echo()
+{
+ command printf '%s\n' "$1"
+}
+
if [ -z "$1" ]; then
echo "Usage: $0 nodes.h" 1>&2
exit 1
@@ -25,7 +34,7 @@ echo "#define NODENAMES_H_INCLUDED"
echo
echo "#ifdef DEBUG"
-MAX=$(awk < "$NODES" '
+MAX=$(${AWK:-awk} < "$NODES" '
/#define/ {
if ($3 > MAX) MAX = $3
}