remove "local" bashism from a few scripts
authorDenys Vlasenko <vda.linux@googlemail.com>
Tue, 24 Jan 2017 19:52:42 +0000 (20:52 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Tue, 24 Jan 2017 19:52:42 +0000 (20:52 +0100)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
examples/depmod
scripts/gen_build_files.sh
scripts/trylink
testsuite/runtest

index d769590d0a537ebc637d85ccbe3bace24df95f7a..8d421c6ab5a15c62767a413bf5e40b2e1eeab067 100755 (executable)
@@ -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'`
index ebee17c641807d6e255d7bc371b3af6c20324954..f79fa2f83c60a45cc77950e73e97201e22eb6209 100755 (executable)
@@ -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
index c2a431626672916954a68eaff05660034529842c..9f288c141a6bb7d0b939a1b83fdd770fa010f0f9 100755 (executable)
@@ -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"
index 51575d9260b2e3935c837cd4da5d37468076010d..44f9cd1a1f15ccbd28c9db24ef1ebc68a7807393 100755 (executable)
@@ -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