summaryrefslogtreecommitdiff
path: root/Debian/Debhelper/Dh_Getopt.pm
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2010-01-04 19:09:14 -0500
committerJoey Hess <joey@gnu.kitenet.net>2010-01-04 19:09:14 -0500
commit04ca5a54fed1f02a9089a6c1b5364cdf9ef190eb (patch)
treecca8287e82beaed709be3a9252f19ee54238532f /Debian/Debhelper/Dh_Getopt.pm
parent02bf22b2c4c695fd959f11c0d6a803795e014c2e (diff)
don't call getopt recursively
That messes with the return value of the outer call.
Diffstat (limited to 'Debian/Debhelper/Dh_Getopt.pm')
-rw-r--r--Debian/Debhelper/Dh_Getopt.pm19
1 files changed, 11 insertions, 8 deletions
diff --git a/Debian/Debhelper/Dh_Getopt.pm b/Debian/Debhelper/Dh_Getopt.pm
index 4df3eed..f27775b 100644
--- a/Debian/Debhelper/Dh_Getopt.pm
+++ b/Debian/Debhelper/Dh_Getopt.pm
@@ -70,6 +70,7 @@ sub getoptions {
my $array=shift;
my %params=@_;
+ my @test;
my %options=(
"v" => \$dh{VERBOSE},
"verbose" => \$dh{VERBOSE},
@@ -130,14 +131,8 @@ sub getoptions {
"ignore=s" => \&AddIgnore,
- "O=s" => sub { my($option,$value)=@_;
- # Try to parse an option, but ignore it
- # if it is not known.
- if (getoptions([$value], %params, test => 1)) {
- getoptions([$value], %params);
- }
- },
-
+ "O=s" => sub { push @test, $_[1] },
+
(ref $params{options} ? %{$params{options}} : ()) ,
"<>" => \&NonOption,
@@ -159,6 +154,14 @@ sub getoptions {
$SIG{__WARN__}=$oldwarn;
}
+ foreach my $opt (@test) {
+ # Try to parse an option, but ignore it
+ # if it is not known.
+ if (getoptions([$opt], %params, test => 1)) {
+ getoptions([$opt], %params);
+ }
+ }
+
return 1 if $params{ignore_unknown_options};
return $ret;
}