From f3a1103e58c341d5bb42bc889549fef44d685729 Mon Sep 17 00:00:00 2001 From: Aaron Griffin Date: Wed, 5 Aug 2009 10:17:00 -0700 Subject: Enable in_array for prefixed daemons Previous code has issues with ! and @ prefixed DAEMONS Original-by: Florian Pritz Signed-off-by: Aaron Griffin --- functions | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'functions') diff --git a/functions b/functions index 7c8e4df..0f333d4 100644 --- a/functions +++ b/functions @@ -159,13 +159,17 @@ status() { # 1 - not found # Copied from makepkg in_array() { - local needle=$1; shift - [ -z "$1" ] && return 1 # Not Found - local item - for item in "$@"; do - [ "$item" = "$needle" ] && return 0 # Found - done - return 1 # Not Found + local needle=$1; shift + [ -z "$1" ] && return 1 # Not Found + local item + for item in "$@"; do + local c="${item:0:1}" + if [ "$c" == "!" -o "$c" == "@" ]; then + item="${item:1}" + fi + [ "$item" = "$needle" ] && return 0 # Found + done + return 1 # Not Found } # daemons: -- cgit v1.2.3