summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2004-08-10 14:40:02 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2004-08-10 14:40:02 +0000
commita5fd3ecdbe93b5460d34095b3a4c85c88d8adc07 (patch)
treee652530de193522036eb888676ee33833153b5f5
parent3eae423bdd5300c20da7d5bc4dce52bd149832fa (diff)
downloaddrakx-backup-do-not-use-a5fd3ecdbe93b5460d34095b3a4c85c88d8adc07.tar
drakx-backup-do-not-use-a5fd3ecdbe93b5460d34095b3a4c85c88d8adc07.tar.gz
drakx-backup-do-not-use-a5fd3ecdbe93b5460d34095b3a4c85c88d8adc07.tar.bz2
drakx-backup-do-not-use-a5fd3ecdbe93b5460d34095b3a4c85c88d8adc07.tar.xz
drakx-backup-do-not-use-a5fd3ecdbe93b5460d34095b3a4c85c88d8adc07.zip
(AddNet, WriteConfig) do not bother accessing arrays like in C
-rwxr-xr-xperl-install/standalone/drakroam24
1 files changed, 10 insertions, 14 deletions
diff --git a/perl-install/standalone/drakroam b/perl-install/standalone/drakroam
index 3f61039a2..0e679b402 100755
--- a/perl-install/standalone/drakroam
+++ b/perl-install/standalone/drakroam
@@ -40,8 +40,6 @@ my $DHClient = '/sbin/dhclient';
# initialize variables
my $ScanInterval = 60; # tell deamon to search for new nets every x seconds
-my $NumberOfNets = 0; # really lame way to count the number of nets to write to config file
-# there must be a better way to count the number of arrays in $KnownList->{data} !!
# initialize main window
$MainWindow = Gtk2::Window->new;
@@ -157,7 +155,6 @@ $KnownControls->pack_start($RemoveNetButton, 0, 0, 0);
$RemoveNetButton->signal_connect(clicked => sub {
my @selected = $KnownList->get_selected_indices;
splice @{$KnownList->{data}}, "@selected", 1;
- $NumberOfNets--;
});
$ConnectButton = Gtk2::Button->new("Connect");
$KnownControls->pack_start($ConnectButton, 0, 0, 0);
@@ -307,8 +304,7 @@ sub AddNet {
my $key = shift @_;
my $dhcp = shift @_;
print "Adding net $essid\n";
- push(@{$KnownList->{data}}, [$essid, $mode, $channel, $key, $dhcp]);
- $NumberOfNets++;
+ push @{$KnownList->{data}}, [ $essid, $mode, $channel, $key, $dhcp ];
}
sub ReadConfig {
@@ -345,19 +341,19 @@ sub ReadConfig {
sub WriteConfig {
open(my $CONFIG, "> $config") or die("Can't open configuration file\n");
print $CONFIG "#wlandetect configuration file\n#format: essid<tab><tab>commands\n#use @DEV@ for device name\n";
- for ($row=0; $row < $NumberOfNets; $row++) { # again, lame
- print $CONFIG "$KnownList->{data}[$row][0]\t\t$IWConfig essid $KnownList->{data}[$row][0]";
- if ($KnownList->{data}[$row][1]) {
- print $CONFIG "mode $KnownList->{data}[$row][1] ";
+ foreach my $row (@{$KnownList->{data}}) { # again, lame
+ print $CONFIG "$row->[0]\t\t$IWConfig essid $row->[0]";
+ if ($row->[1]) {
+ print $CONFIG "mode $row->[1] ";
}
- if ($KnownList->{data}[$row][2]) {
- print $CONFIG "channel $KnownList->{data}[$row][2] ";
+ if ($row->[2]) {
+ print $CONFIG "channel $row->[2] ";
}
- if ($KnownList->{data}[$row][3]) {
- print $CONFIG "key $KnownList->{data}[$row][3] ";
+ if ($row->[3]) {
+ print $CONFIG "key $row->[3] ";
}
print $CONFIG "; ";
- if ($KnownList->{data}[$row][4]) {
+ if ($row->[4]) {
print $CONFIG "$IFConfig \@DEV\@ up; $DHClient \@DEV\@";
}
else {