summaryrefslogtreecommitdiff
path: root/src/core/libs
diff options
context:
space:
mode:
authorDieter Plaetinck <dieter@plaetinck.be>2010-12-07 10:48:45 +0100
committerDieter Plaetinck <dieter@plaetinck.be>2010-12-07 10:48:45 +0100
commitd48a46ee6f2eee6e1757e2c45f0a3557752a49b2 (patch)
treed7b221bb3af89e75fe56f3b8ae13a164d38f9be8 /src/core/libs
parenta1d7585036f0cee7a69b18aaaa4bda4c66982336 (diff)
clean up variable names/scopes in loading code
Diffstat (limited to 'src/core/libs')
-rwxr-xr-xsrc/core/libs/lib-flowcontrol.sh17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/core/libs/lib-flowcontrol.sh b/src/core/libs/lib-flowcontrol.sh
index 078a33d..3fd4112 100755
--- a/src/core/libs/lib-flowcontrol.sh
+++ b/src/core/libs/lib-flowcontrol.sh
@@ -26,7 +26,7 @@ load_module ()
{
[ -z "$1" ] && die_error "load_module needs a module argument"
log "Loading module $1 ..."
- path=$LIB_USER/"$1"
+ local path=$LIB_USER/"$1"
[ "$1" = core ] && path=$LIB_CORE
for submodule in lib #procedure don't load procedures automatically!
@@ -37,12 +37,13 @@ load_module ()
[ "$1" = core ] && die_error "$path/${submodule}s does not exist. something is horribly wrong with this installation"
else
shopt -s nullglob
- for i in "$path/${submodule}s"/*
+ local module
+ for module in "$path/${submodule}s"/*
do
# I have the habit of editing files while testing, don't source my backup files!
- [[ "$i" == *~ ]] && continue
-
- load_${submodule} "$1" "`basename "$i"`"
+ [[ "$module" == *~ ]] && continue
+ module=$(basename "$module")
+ load_${submodule} "$1" "$module"
done
fi
done
@@ -59,11 +60,11 @@ load_procedure()
if [ "$1" = 'http' ]
then
log "Loading procedure $2 ..."
- procedure=$RUNTIME_DIR/aif-procedure-downloaded-`basename $2`
+ local procedure=$RUNTIME_DIR/aif-procedure-downloaded-`basename $2`
wget "$2" -q -O $procedure >/dev/null || die_error "Could not download procedure $2"
else
log "Loading procedure $1/procedures/$2 ..."
- procedure=$LIB_USER/"$1"/procedures/"$2"
+ local procedure=$LIB_USER/"$1"/procedures/"$2"
[ "$1" = core ] && procedure=$LIB_CORE/procedures/"$2"
fi
[ -f "$procedure" ] && source "$procedure" || die_error "Something went wrong while sourcing procedure $procedure"
@@ -77,7 +78,7 @@ load_lib ()
[ -z "$1" ] && die_error "load_library needs a module als \$1 and library as \$2"
[ -z "$2" ] && die_error "load_library needs a library as \$2"
log "Loading library $1/libs/$2 ..."
- lib=$LIB_USER/"$1"/libs/"$2"
+ local lib=$LIB_USER/"$1"/libs/"$2"
[ "$1" = core ] && lib=$LIB_CORE/libs/"$2"
source $lib || die_error "Something went wrong while sourcing library $lib"
}