diff options
author | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-06-29 03:25:16 +0000 |
---|---|---|
committer | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-06-29 03:25:16 +0000 |
commit | c143a6d111b2ac86e55d21db43d789949a61087b (patch) | |
tree | 004f28ad24fd68edff64e4e9a82debdbbd1c98e2 /bin | |
parent | 7d3571004e8c5d1069f2cba1ca8809b230b43228 (diff) | |
download | ATCD-c143a6d111b2ac86e55d21db43d789949a61087b.tar.gz |
fix arg processing
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/check_build_logs | 18 | ||||
-rwxr-xr-x | bin/libsize.pl | 11 |
2 files changed, 14 insertions, 15 deletions
diff --git a/bin/check_build_logs b/bin/check_build_logs index 899814925b0..8d2f519e586 100755 --- a/bin/check_build_logs +++ b/bin/check_build_logs @@ -27,32 +27,32 @@ $mail_recipients = ''; #### #### Process command line args. #### -foreach my $arg (@ARGV) { - if ($arg eq '-l') { - if ( $ARGV[1] =~ /^[\da-zA-Z]+$/ ) { +while ($#ARGV >= $[) { + if ($ARGV[0] eq '-l') { + if ($ARGV[1] =~ /^[\da-zA-Z]+$/) { $log_directory = $ARGV[1]; shift; } else { print STDERR "$0: must provide argument for -l option\n"; die $usage; } - shift; - } elsif ($arg eq '-m') { - if ( $ARGV[1] =~ /^[\da-zA-Z]+$/ ) { + } elsif ($ARGV[0] eq '-m') { + if ($ARGV[1] =~ /^[\da-zA-Z]+$/) { $mail_recipients = $ARGV[1]; shift; } else { print STDERR "$0: must provide argument for -m option\n"; die $usage; } - shift; - } elsif ($arg eq '-?') { + } elsif ($ARGV[0] eq '-?') { print "$usage"; exit; } else { + print "$0: unknown arg: $ARGV[0]\n"; print "$usage"; - exit; + exit 1; } + shift; } diff --git a/bin/libsize.pl b/bin/libsize.pl index b165d5b535f..db0f09ca531 100755 --- a/bin/libsize.pl +++ b/bin/libsize.pl @@ -49,21 +49,20 @@ $lib_extension = 'a'; #### #### Process command line args. #### -@argv = @ARGV; -foreach my $arg (@argv) { - if ($arg eq '-h') { +while ($#ARGV >= $[ && $ARGV[0] =~ /^-/) { + if ($ARGV[0] eq '-h') { $html = 1; chop ($sysname = `uname -s`); chop ($sysrev = `uname -r`); shift; - } elsif ($arg eq '-s') { + } elsif ($ARGV[0] eq '-s') { $lib_extension = 'so'; $build_args =~ s/ static_libs_only=1//; shift; - } elsif ($arg eq '-v') { + } elsif ($ARGV[0] eq '-v') { $verbose = 1; shift; - } elsif ($arg eq '-?') { + } elsif ($ARGV[0] eq '-?') { print "$usage"; exit; } else { |