summaryrefslogtreecommitdiff
path: root/src/core/libs/lib-misc.sh
diff options
context:
space:
mode:
authorDieter Plaetinck <dieter@plaetinck.be>2009-02-28 18:02:11 +0100
committerDieter Plaetinck <dieter@plaetinck.be>2009-02-28 18:02:11 +0100
commit6f20b17624a1fb9c6e4d6fd1ba4efaf463209065 (patch)
treea7ac85886fc0e917dc6cc233d0629373643195c6 /src/core/libs/lib-misc.sh
parent07d9ffe35c6dffda66987832a25802cbf54f2f4e (diff)
check_is_in fixes.. and this time i mean it.. i think. hopefully. + test script for check_is_in
Diffstat (limited to 'src/core/libs/lib-misc.sh')
-rw-r--r--src/core/libs/lib-misc.sh10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/core/libs/lib-misc.sh b/src/core/libs/lib-misc.sh
index 97252b9..6f7af95 100644
--- a/src/core/libs/lib-misc.sh
+++ b/src/core/libs/lib-misc.sh
@@ -46,18 +46,20 @@ wait_for ()
}
-# $1 set (array) haystack
-# $2 needle
+# $1 needle
+# $2 set (array) haystack
check_is_in ()
{
- [ -z "$1" ] && debug 'MISC' "check_is_in $1 $2" && die_error "check_is_in needs a non-empty needle as \$2 and a haystack as \$1!" # haystack can be empty though
+ [ -z "$1" ] && debug 'MISC' "check_is_in $1 $2" && die_error "check_is_in needs a non-empty needle as \$1 and a haystack as \$2!" # haystack can be empty though
local pattern="$1" element
shift
for element
do
- [[ $element = $pattern ]] && return 0
+ [[ $element = $pattern ]] && debug 'MISC' "Checking if $element = $pattern ..yes !" && return 0
+ debug 'MISC' "Checking if $element = $pattern ... no"
done
+ debug 'MISC' "Check_is_in could not find $1 in $2"
return 1
}