[arch-projects] [initscripts] [PATCH 11/20] Deprecate in_array()

Kurt J. Bosch kjb-temp-2009 at alpenjodel.de
Sun Jul 10 12:56:59 EDT 2011


in_array() strips '@' and therefore the name is missleading.
For checking DAEMONS, ck_autostart() should be used.
---
 functions |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/functions b/functions
index 6efcd52..caa9060 100644
--- a/functions
+++ b/functions
@@ -162,10 +162,15 @@ status() {
 	return $ret
 }
 
-#  usage : in_array( $needle, $haystack )
+# This is deprecated!
+# It strips '@' and therefore the name is missleading.
+# For checking DAEMONS, ck_autostart() should be used!
+#
+#  usage : is_in_array( $needle, $haystack )
 # return : 0 - found
 #          1 - not found
 in_array() {
+	echo "WARNING: Call to deprecated function in_array() from $0" >&2
 	local needle=$1; shift
 	local item
 	for item; do
@@ -272,7 +277,7 @@ stop_all_daemons() {
 	for daemon in /run/daemons/*; do
 		[[ -f $daemon ]] || continue
 		daemon=${daemon##*/}
-		in_array "$daemon" "${DAEMONS[@]}" || stop_daemon "$daemon"
+		ck_autostart "$daemon" && stop_daemon "$daemon"
 	done
 
 	# Shutdown daemons in reverse order
-- 
1.7.1



More information about the arch-projects mailing list