diff options
author | Olivier Blin <oblin@mandriva.org> | 2004-08-11 05:48:19 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.org> | 2004-08-11 05:48:19 +0000 |
commit | 6ae499d4529cc37bb7629830542138b75202de85 (patch) | |
tree | d864783ba14b1f16413a1c6f1c491d958db8a4f4 /perl-install/standalone/drakroam | |
parent | fd3b33367c59a30383bcf29fc6b0eedb2b7b964b (diff) | |
download | drakx-6ae499d4529cc37bb7629830542138b75202de85.tar drakx-6ae499d4529cc37bb7629830542138b75202de85.tar.gz drakx-6ae499d4529cc37bb7629830542138b75202de85.tar.bz2 drakx-6ae499d4529cc37bb7629830542138b75202de85.tar.xz drakx-6ae499d4529cc37bb7629830542138b75202de85.zip |
use cat_, remove unneeded local $_, try to fix ConnectNow
Diffstat (limited to 'perl-install/standalone/drakroam')
-rwxr-xr-x | perl-install/standalone/drakroam | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/perl-install/standalone/drakroam b/perl-install/standalone/drakroam index b0f6ff396..b1465811c 100755 --- a/perl-install/standalone/drakroam +++ b/perl-install/standalone/drakroam @@ -175,12 +175,11 @@ sub UpdateStatus() { my $CurrentWEP = ""; my $CurrentSignal = "-"; print("Updating\n"); - local $_; foreach (run_program::get_stdout($IWConfig)) { - if (/ESSID:"(\S*)"/) { $CurrentNet = $1 } - if (/Mode:(\S*)\s/) { $CurrentMode = $1 } - if (/key:(\S*)\s/) { $CurrentWEP = $1 } - if (m!Quality:(\S*)/!) { $CurrentSignal = $1 } + /ESSID:"(\S*)"/ and $CurrentNet = $1; + /Mode:(\S*)\s/ and $CurrentMode = $1; + /key:(\S*)\s/ and $CurrentWEP = $1; + m!Quality:(\S*)/! and $CurrentSignal = $1; } foreach (run_program::get_stdout($IFConfig, $device)) { if (/inet addr:(\S*)\s/) { $CurrentIP = $1 } @@ -198,18 +197,15 @@ sub UpdateStatus() { } sub UpdateAvailable() { + my ($essid, $mode, $wep, $signal); print("Running iwlist\n"); @{$AvailableList->{data}} = (); - my ($mode, $wep, $signal, $essid); - foreach (run_program::get_stdout($IWList, "scan")) { - if (/([^ ]+)([ \t]+)Scan completed :/) { $device = $1 } - elsif (/([^ ]+)([ \t]+)No scan results/) { $device = $1 } - if (/ESSID:"(\S*)"/) { - $essid = $1; - print("Found $essid.\n"); - } - if (/Mode:(\S*)/) { $mode = $1 } - if (m!Quality:(\S*)/!) { $signal = $1 } + foreach (run_program::get_stdout($IWList, "scan")) { + /([^ ]+)([ \t]+)Scan completed :/ and $device = $1; + /([^ ]+)([ \t]+)No scan results/ and $device = $1; + /ESSID:"(\S*)"/ and $essid = $1; + /Mode:(\S*)/ and $mode = $1; + m!Quality:(\S*)/! and $signal = $1; if (/key:(\S*)\s/) { $wep = $1; print("Mode: $mode, WEP: $wep, Signal: $signal\n"); @@ -225,11 +221,9 @@ sub AddNet { } sub ReadConfig() { - open(my $CONFIG, $config) or die "Configuration file not found.\n"; print "Reading config file.\n\n"; my $line = 0; - local $_; - while (<$CONFIG>) { + foreach (cat_($config)) { $line++; if (/^#/) {} #ignore comments elsif (/^\n/) {} #ignore blank lines @@ -253,7 +247,6 @@ sub ReadConfig() { } else { die "Line $line of configuration file is not parseable.\n" } } - close $CONFIG; } sub WriteConfig() { @@ -298,6 +291,7 @@ sub SetInterval() { } sub ConnectNow { + my ($row) = @_; my @command = ""; push @command, "$IWConfig essid $KnownList->{data}[$row][0] "; if ($KnownList->{data}[$row][1]) { @@ -328,7 +322,6 @@ sub Disconnect { } sub Dialog { -# read file my ($FilePointer) = @_; my $content = join('', cat_($FilePointer)); # dump into a dialog |