From 2528043867160f85a96471926cd2fdf960d42fe3 Mon Sep 17 00:00:00 2001 From: teastep Date: Fri, 6 Dec 2002 00:31:49 +0000 Subject: [PATCH] Speed up 'separate_list' git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@354 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall/firewall | 1 - Shorewall/functions | 19 ++++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Shorewall/firewall b/Shorewall/firewall index 96bc52ab1..26197ee10 100755 --- a/Shorewall/firewall +++ b/Shorewall/firewall @@ -1183,7 +1183,6 @@ stop_firewall() { iptables -A INPUT -i lo -j ACCEPT iptables -A OUTPUT -o lo -j ACCEPT - for interface in `find_interfaces_by_option dhcp`; do iptables -A INPUT -p udp -i $interface --dport 67:68 -j ACCEPT iptables -A OUTPUT -p udp -o $interface --dport 67:68 -j ACCEPT diff --git a/Shorewall/functions b/Shorewall/functions index 340c0d9b2..90ad27b35 100755 --- a/Shorewall/functions +++ b/Shorewall/functions @@ -25,9 +25,22 @@ find_file() # # Replace commas with spaces and echo the result # -separate_list() -{ - echo $1 | sed 's/,/ /g' +separate_list() { + local list + local part + local newlist + + list="$@" + part="${list%%,*}" + newlist="$part" + + while [ "x$part" != "x$list" ]; do + list="${list#*,}"; + part="${list%%,*}"; + newlist="$newlist $part"; + done + + echo "$newlist" } #