From a62613490deacb59d893202c96ea79444c467968 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Wed, 8 Sep 2004 08:01:35 +0000 Subject: handle options in any order --- perl-install/standalone/drakupdate_fstab | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'perl-install/standalone') diff --git a/perl-install/standalone/drakupdate_fstab b/perl-install/standalone/drakupdate_fstab index 89689a08b..25fa7ad1c 100755 --- a/perl-install/standalone/drakupdate_fstab +++ b/perl-install/standalone/drakupdate_fstab @@ -31,10 +31,23 @@ $::isStandalone = 1; #- not using standalone.pm which generates too many logs fo log::l("drakupdate_fstab called with @ARGV\n"); -$::testing = $ARGV[0] eq '--test' && shift @ARGV; -$::auto = $ARGV[0] eq '--auto' && shift @ARGV; -my $no_flag = $ARGV[0] eq '--no-flag' && shift @ARGV; -my $debug = $ARGV[0] eq '--debug' && shift @ARGV; +my ($no_flag, $debug, $removed); + +my %args = ( + '--auto' => \$::auto, + '--debug' => \$debug, + '--no-flag' => \$no_flag, + '--test' => \$::testing, + ); + +each_index { + if ($args{$_}) { + ${$args{$_}} = 1; + splice @ARGV, $::i - $removed, 1; + $removed++; + } +} @ARGV; + my ($raw_action, $device_name) = @ARGV; my ($action) = $raw_action =~ /^--(add|del)/; -- cgit v1.2.1