[git commit] remove "local" bashism from a few scripts

Denys Vlasenko vda.linux at googlemail.com
Tue Jan 24 19:52:42 UTC 2017


commit: https://git.busybox.net/busybox/commit/?id=bca4ea8b68403e6f751341b82c65937f14590679
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 examples/depmod            |  2 +-
 scripts/gen_build_files.sh |  4 +++-
 scripts/trylink            | 14 ++++++--------
 testsuite/runtest          | 10 +++++-----
 4 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/examples/depmod b/examples/depmod
index d769590..8d421c6 100755
--- a/examples/depmod
+++ b/examples/depmod
@@ -7,7 +7,7 @@
 # Licensed under GPLv2, see file LICENSE in this source tree.
 #
 
-local BASE="${1:-/usr/lib/modules}"
+BASE="${1:-/usr/lib/modules}"
 
 find "$BASE" -name '*.ko.gz' | while read I ; do
 	N=`basename "$I" '.ko.gz'`
diff --git a/scripts/gen_build_files.sh b/scripts/gen_build_files.sh
index ebee17c..f79fa2f 100755
--- a/scripts/gen_build_files.sh
+++ b/scripts/gen_build_files.sh
@@ -20,7 +20,9 @@ chk() { status "CHK" "$@"; }
 generate()
 {
 	# NB: data to be inserted at INSERT line is coming on stdin
-	local src="$1" dst="$2" header="$3"
+	src="$1"
+	dst="$2"
+	header="$3"
 	#chk "${dst}"
 	{
 		# Need to use printf: different shells have inconsistent
diff --git a/scripts/trylink b/scripts/trylink
index c2a4316..9f288c1 100755
--- a/scripts/trylink
+++ b/scripts/trylink
@@ -46,8 +46,7 @@ try() {
 }
 
 check_cc() {
-    local tempname="$(mktemp tmp.XXXXXXXXXX)"
-    local r
+    tempname="$(mktemp tmp.XXXXXXXXXX)"
     echo "int main(int argc,char**argv){return argv?argc:0;}" >"$tempname".c
     # Can use "-o /dev/null", but older gcc tend to *unlink it* on failure! :(
     # Was using "-xc /dev/null", but we need a valid C program.
@@ -55,14 +54,13 @@ check_cc() {
     # '... -D"BB_VER=KBUILD_STR(1.N.M)" ...'
     # and we need shell to process quotes!
     $CC $CFLAGS $LDFLAGS $1 "$tempname".c -o "$tempname" >/dev/null 2>&1
-    r=$?
+    exitcode=$?
     rm -f "$tempname" "$tempname".c "$tempname".o
-    return $r
+    return $exitcode
 }
 
 check_libc_is_glibc() {
-    local tempname="$(mktemp tmp.XXXXXXXXXX)"
-    local r
+    tempname="$(mktemp tmp.XXXXXXXXXX)"
     echo "\
 	#include <stdlib.h>
 	/* Apparently uclibc defines __GLIBC__ (compat trick?). Oh well. */
@@ -71,9 +69,9 @@ check_libc_is_glibc() {
 	#endif
 	" >"$tempname".c
     ! $CC $CFLAGS "$tempname".c -c -o "$tempname".o >/dev/null 2>&1
-    r=$?
+    exitcode=$?
     rm -f "$tempname" "$tempname".c "$tempname".o
-    return $r
+    return $exitcode
 }
 
 EXE="$1"
diff --git a/testsuite/runtest b/testsuite/runtest
index 51575d9..44f9cd1 100755
--- a/testsuite/runtest
+++ b/testsuite/runtest
@@ -12,12 +12,12 @@ total_failed=0
 # Option -e will make testcase stop on the first failed command.
 run_applet_testcase()
 {
-	local applet="$1"
-	local testcase="$2"
+	applet="$1"
+	testcase="$2"
 
-	local status=0
-	local uc_applet=$(echo "$applet" | tr a-z A-Z)
-	local testname="$testcase"
+	status=0
+	uc_applet=$(echo "$applet" | tr a-z A-Z)
+	testname="$testcase"
 
 	testname="${testname##*/}" # take basename
 	if grep "^# CONFIG_$uc_applet is not set$" "$bindir/.config" >/dev/null; then


More information about the busybox-cvs mailing list