From b1199cc6b90b11ad492dd145934ad8086db4f757 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Thu, 21 Apr 2005 11:40:14 +0000 Subject: (ConnectNow) simplify --- perl-install/standalone/drakroam | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'perl-install/standalone') diff --git a/perl-install/standalone/drakroam b/perl-install/standalone/drakroam index a782bcb63..d8f360b7b 100755 --- a/perl-install/standalone/drakroam +++ b/perl-install/standalone/drakroam @@ -355,15 +355,10 @@ sub ConnectNow { my ($row) = @_; my @command = ""; push @command, "$IWConfig $device essid $KnownList->{data}[$row][0] "; - if ($KnownList->{data}[$row][1]) { - push @command, "mode $KnownList->{data}[$row][1] "; - } - if ($KnownList->{data}[$row][2]) { - push @command, "channel $KnownList->{data}[$row][2] "; - } - if ($KnownList->{data}[$row][4]) { - push @command, "key $KnownList->{data}[$row][4] "; - } + my %commands = (1 => 'mode', 2 => 'channel', 4 => 'key'); + foreach (my ($key, $cmd) = each %commands) { + push @command, "$cmd $KnownList->{data}[$row][$key] " if $KnownList->{data}[$row][$key]; + } push @command, "; "; if ($KnownList->{data}[$row][3]) { push @command, "$IFConfig $device up; $DHClient $device"; -- cgit v1.2.1