summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/OpenBSD
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2023-05-21 13:44:22 +0000
committerMarc Espie <espie@cvs.openbsd.org>2023-05-21 13:44:22 +0000
commit3c0f87a0db0476ae1b22f5c1183b8fdedbebc7de (patch)
tree35eb3cbf99762556e5847a8ea99083c8b649129e /usr.sbin/pkg_add/OpenBSD
parent595561d59e945e220964ca9c7d2d92ea911b2b95 (diff)
"fix" for 5.36: pass the possible option value as an extra param
instead of defined/undefined, so that the code sub is called with the right number of parameters.
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Getopt.pm12
1 files changed, 6 insertions, 6 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Getopt.pm b/usr.sbin/pkg_add/OpenBSD/Getopt.pm
index f382c3fa09e..98713830664 100644
--- a/usr.sbin/pkg_add/OpenBSD/Getopt.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Getopt.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Getopt.pm,v 1.14 2023/05/19 07:25:16 espie Exp $
+# $OpenBSD: Getopt.pm,v 1.15 2023/05/21 13:44:21 espie Exp $
#
# Copyright (c) 2006 Marc Espie <espie@openbsd.org>
#
@@ -29,17 +29,17 @@ our @EXPORT = qw(getopts);
sub handle_option
{
- my ($opt, $hash, $params) = @_;
+ my ($opt, $hash, @params) = @_;
if (defined $hash->{$opt} and ref($hash->{$opt}) eq 'CODE') {
- &{$hash->{$opt}}($params);
+ &{$hash->{$opt}}(@params);
} else {
no strict "refs";
no strict "vars";
- if (defined $params) {
- ${"opt_$opt"} = $params;
- $hash->{$opt} = $params;
+ if (@params > 0) {
+ ${"opt_$opt"} = $params[0];
+ $hash->{$opt} = $params[0];
} else {
${"opt_$opt"}++;
$hash->{$opt}++;