From e372729b8cc489af7b1b2305d6fd9c1895b9c8d4 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Mon, 29 Oct 2007 09:45:49 +0000 Subject: Network config arrays are now split by embedded new lines instead of being evaled into space separated values. This makes it easier to read, maintain and document as discussed on gentoo-dev. --- net.Linux/arping.sh | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'net.Linux/arping.sh') diff --git a/net.Linux/arping.sh b/net.Linux/arping.sh index 817f8b2d..68d04216 100644 --- a/net.Linux/arping.sh +++ b/net.Linux/arping.sh @@ -39,21 +39,30 @@ arping_address() { return 0 } +_arping_in_config() { + _get_array "config_${IFVAR}" | while read i; do + [ "${i}" = "arping" ] && return 0 + done + return 1 +} + arping_start() { local gateways= x= conf= i= einfo "Pinging gateways on ${IFACE} for configuration" - eval $(_get_array "gateways_${IFVAR}") - if [ $# = 0 ] ; then + eval gateways=\$gateways_${IFVAR} + if [ -n "${gateways}" ] ; then eerror "No gateways have been defined (gateways_${IFVAR}=\"...\")" return 1 fi eindent - for x in "$@"; do - eval set -- "${x}" + for x in ${gateways}; do + local IFS=, + set -- ${x} local ip=$1 mac=$2 extra= + unset IFS if [ -n "${mac}" ] ; then mac="$(echo "${mac}" | tr '[:lower:]' '[:upper:]')" @@ -90,13 +99,10 @@ arping_start() { system_pre_start # Ensure that we have a valid config - ie arping is no longer there - eval $(_get_array "config_${IFVAR}") - for i in "$@" ; do - if [ "${i}" = "arping" ] ; then - veend 1 "No config found for ${ip} (config_${conf}=\"...\")" - continue 2 - fi - done + if _arping_in_config; then + veend 1 "No config found for ${ip} (config_${conf}=\"...\")" + continue 2 + fi _load_config return 0 -- cgit v1.2.3