diff options
author | Olivier Blin <oblin@mandriva.org> | 2004-08-11 15:13:30 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.org> | 2004-08-11 15:13:30 +0000 |
commit | aff0f40d008cefbd84d6cd1d0bde61247f8a0be8 (patch) | |
tree | 47419b26510d623280d21bea8d4a5726bfaba73d /perl-install/standalone | |
parent | dc5dcee85f93f0a39c479aa51d3d1ac8d33e0b00 (diff) | |
download | drakx-aff0f40d008cefbd84d6cd1d0bde61247f8a0be8.tar drakx-aff0f40d008cefbd84d6cd1d0bde61247f8a0be8.tar.gz drakx-aff0f40d008cefbd84d6cd1d0bde61247f8a0be8.tar.bz2 drakx-aff0f40d008cefbd84d6cd1d0bde61247f8a0be8.tar.xz drakx-aff0f40d008cefbd84d6cd1d0bde61247f8a0be8.zip |
regexp cleanups
Diffstat (limited to 'perl-install/standalone')
-rwxr-xr-x | perl-install/standalone/drakroam | 24 |
1 files changed, 8 insertions, 16 deletions
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" } |