diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2004-11-14 13:20:08 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2004-11-14 13:20:08 +0000 |
commit | 2d98eb6b2cca20bbb6db8b3385fb854be00da864 (patch) | |
tree | a96db09150a23752b70bfb39a81ea8f78025a8c4 /usr.sbin/pkg_add | |
parent | da33fcdd468f43ac502df62c70e72d13563a087d (diff) |
allows for several -f options, since OpenBSD::Getopt makes this possible
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r-- | usr.sbin/pkg_add/pkg_add | 14 | ||||
-rw-r--r-- | usr.sbin/pkg_add/pkg_delete | 15 |
2 files changed, 16 insertions, 13 deletions
diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add index 3654a2b12e0..c8c930d6efd 100644 --- a/usr.sbin/pkg_add/pkg_add +++ b/usr.sbin/pkg_add/pkg_add @@ -1,7 +1,7 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: pkg_add,v 1.120 2004/11/14 12:54:30 espie Exp $ +# $OpenBSD: pkg_add,v 1.121 2004/11/14 13:20:07 espie Exp $ # # Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org> # @@ -557,13 +557,15 @@ sub install_package return (); } -our ($opt_a, $opt_v, $opt_n, $opt_I, $opt_f, $opt_L, $opt_B, $opt_A, $opt_P, $opt_Q, $opt_x, $opt_r, $opt_q, $opt_c); +our ($opt_a, $opt_v, $opt_n, $opt_I, $opt_L, $opt_B, $opt_A, $opt_P, $opt_Q, $opt_x, $opt_r, $opt_q, $opt_c); $opt_v = 0; getopts('aqcvnrxIL:f:B:A:P:Q:', - {'v' => sub {++$opt_v;} }); -if ($opt_f) { - %forced = map {($_, 1)} split(/,/, $opt_f); -} + {'v' => sub {++$opt_v;}, + 'f' => sub { + for my $o (split/,/, shift) { + $forced{$o} = 1; + } + }}); $opt_L = '/usr/local' unless defined $opt_L; my $state = new OpenBSD::Error; diff --git a/usr.sbin/pkg_add/pkg_delete b/usr.sbin/pkg_add/pkg_delete index 55d2c122802..cf4665278b8 100644 --- a/usr.sbin/pkg_add/pkg_delete +++ b/usr.sbin/pkg_add/pkg_delete @@ -1,6 +1,6 @@ #!/usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: pkg_delete,v 1.77 2004/11/14 11:58:43 espie Exp $ +# $OpenBSD: pkg_delete,v 1.78 2004/11/14 13:20:07 espie Exp $ # # Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org> # @@ -29,12 +29,17 @@ use OpenBSD::PackageInfo; our %forced = (); -our ($opt_v, $opt_D, $opt_d, $opt_n, $opt_f, $opt_q, $opt_p, $opt_c, $opt_L, $opt_B, $opt_I, $opt_x); +our ($opt_v, $opt_D, $opt_d, $opt_n, $opt_q, $opt_p, $opt_c, $opt_L, $opt_B, $opt_I, $opt_x); $opt_v = 0; getopts('vcxDdnf:qpS:L:B:I', - {'v' => sub {++$opt_v;} }); + {'v' => sub {++$opt_v;}, + 'f' => sub { + for my $o (split/,/, shift) { + $forced{$o} = 1; + } + }}); if ($opt_D) { $opt_I = 1; } @@ -54,10 +59,6 @@ if (defined $opt_d) { Fatal "Option d is obsolete"; } -if ($opt_f) { - %forced = map {($_, 1)} split(/,/, $opt_f); -} - my %done; my $removed; |