From 0a72c1194d6f807d3cc4324246f30e7a90f16279 Mon Sep 17 00:00:00 2001 From: Siteshwar Vashisht Date: Wed, 20 Jun 2018 12:28:11 +0200 Subject: [PATCH] Use typeset -l instead of local keyword in scripts Related: #238 --- src/cmd/ksh93/tests/util/preamble.sh | 8 ++++---- src/cmd/ksh93/tests/util/util.sh | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/cmd/ksh93/tests/util/preamble.sh b/src/cmd/ksh93/tests/util/preamble.sh index b204c88d8972..22a6f317d3f9 100644 --- a/src/cmd/ksh93/tests/util/preamble.sh +++ b/src/cmd/ksh93/tests/util/preamble.sh @@ -22,20 +22,20 @@ integer error_count=0 integer start_of_test_lineno=0 # redefined later to be read-only function log_info { - local lineno=$(( $1 < 0 ? $1 : $1 - $start_of_test_lineno )) + typeset -l lineno=$(( $1 < 0 ? $1 : $1 - $start_of_test_lineno )) print -r " ${test_name}[$lineno]: ${@:2}" } alias log_info='log_info $LINENO' function log_warning { - local lineno=$(( $1 < 0 ? $1 : $1 - $start_of_test_lineno )) + typeset -l lineno=$(( $1 < 0 ? $1 : $1 - $start_of_test_lineno )) print -u2 -r " ${test_name}[$lineno]: ${@:2}" } alias log_warning='log_warning $LINENO' function log_error { - local lineno=$(( $1 < 0 ? $1 : $1 - $start_of_test_lineno )) - local msg="$2" + typeset -l lineno=$(( $1 < 0 ? $1 : $1 - $start_of_test_lineno )) + typeset -l msg="$2" print -u2 -r " ${test_name}[$lineno]: $msg" if (( $# > 2 )) then diff --git a/src/cmd/ksh93/tests/util/util.sh b/src/cmd/ksh93/tests/util/util.sh index 5da1b29b3ad6..efe61da7a85d 100644 --- a/src/cmd/ksh93/tests/util/util.sh +++ b/src/cmd/ksh93/tests/util/util.sh @@ -21,20 +21,20 @@ integer error_count=0 integer start_of_test_lineno=0 # redefined later to be read-only function log_info { - local lineno=$(( $1 < 0 ? $1 : $1 - $start_of_test_lineno )) + typeset -l lineno=$(( $1 < 0 ? $1 : $1 - $start_of_test_lineno )) print -r " ${test_name}[$lineno]: ${@:2}" } alias log_info='log_info $LINENO' function log_warning { - local lineno=$(( $1 < 0 ? $1 : $1 - $start_of_test_lineno )) + typeset -l lineno=$(( $1 < 0 ? $1 : $1 - $start_of_test_lineno )) print -u2 -r " ${test_name}[$lineno]: ${@:2}" } alias log_warning='log_warning $LINENO' function log_error { - local lineno=$(( $1 < 0 ? $1 : $1 - $start_of_test_lineno )) - local msg="$2" + typeset -l lineno=$(( $1 < 0 ? $1 : $1 - $start_of_test_lineno )) + typeset -l msg="$2" print -u2 -r " ${test_name}[$lineno]: $msg" if (( $# > 2 )) then