From aff0f40d008cefbd84d6cd1d0bde61247f8a0be8 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Wed, 11 Aug 2004 15:13:30 +0000 Subject: regexp cleanups --- perl-install/standalone/drakroam | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) (limited to 'perl-install') diff --git a/perl-install/standalone/drakroam b/perl-install/standalone/drakroam index 1c5e8c87e..8d6f640a0 100755 --- a/perl-install/standalone/drakroam +++ b/perl-install/standalone/drakroam @@ -58,24 +58,16 @@ my %available_roaming_daemons = ( read_config => sub { my ($config) = @_; each_index { - if (/^#/) {} #ignore comments - elsif (/^\n/) {} #ignore blank lines - elsif (/([^ \t]+)([ \t]+)(.*)/) { - my $essid = $1; + /^#/ || /^\n/ and next; #ignore comments and blank lines + if (/([^ \t]+)([ \t]+)(.*)/) { + my ($essid, $mode, $channel, $key, $dhcp); my $command = $3; # setup new network entry - my $mode; - my $channel; - my $key; - my $dhcp; - if ($command =~ /mode\s(\S*);/) { $mode = $1 } - elsif ($command =~ /mode\s(\S*)\s/) { $mode = $1 } - if ($command =~ /channel\s(\S*);/) { $channel = $1 } - elsif ($command =~ /channel\s(\S*)\s/) { $channel = $1 } - if ($command =~ /key\s(\S*);/) { $key = $1 } - elsif ($command =~ /key\s(\S*)\s/) { $key = $1 } - if ($command =~ /dhclient/) { $dhcp = 1 } - else { $dhcp = 0 } + $essid = $1; + ($mode) = $command =~ /mode\s([^\s;]+)/; + ($channel) = $command =~ /channel\s([^\s;]+)/; + ($key) = $command =~ /key\s([^\s;]+)/; + $dhcp = $command =~ /dhclient/; &AddNet($essid, $mode, $channel, $key, $dhcp); } else { die "Line $::i of configuration file is not parseable.\n" } -- cgit v1.2.1