Skip to content

Commit

Permalink
Use typeset -l instead of local keyword in scripts
Browse files Browse the repository at this point in the history
Related: #238
  • Loading branch information
siteshwar committed Jun 25, 2018
1 parent 58dabeb commit 0a72c11
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/cmd/ksh93/tests/util/preamble.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 "<I> ${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 "<W> ${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 "<E> ${test_name}[$lineno]: $msg"
if (( $# > 2 ))
then
Expand Down
8 changes: 4 additions & 4 deletions src/cmd/ksh93/tests/util/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 "<I> ${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 "<W> ${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 "<E> ${test_name}[$lineno]: $msg"
if (( $# > 2 ))
then
Expand Down

0 comments on commit 0a72c11

Please sign in to comment.