diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2010-06-25 10:54:29 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2010-06-25 10:54:29 +0000 |
commit | 71b82eb4879f94f0187a7a24674dbb1f4ebb26e3 (patch) | |
tree | 0e102a4eb72233cd38d27ea95e4371d8412a30b9 /usr.sbin | |
parent | 878bae102aaad6480ad00ac249a10286ef5c763d (diff) |
move handle_options in state, as should be.
fix a buglet in vsystem
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/AddDelete.pm | 53 |
1 files changed, 29 insertions, 24 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/AddDelete.pm b/usr.sbin/pkg_add/OpenBSD/AddDelete.pm index d9e2a78b6c2..74c75a549fd 100644 --- a/usr.sbin/pkg_add/OpenBSD/AddDelete.pm +++ b/usr.sbin/pkg_add/OpenBSD/AddDelete.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: AddDelete.pm,v 1.27 2010/06/18 10:55:58 espie Exp $ +# $OpenBSD: AddDelete.pm,v 1.28 2010/06/25 10:54:28 espie Exp $ # # Copyright (c) 2007-2010 Marc Espie <espie@openbsd.org> # @@ -29,34 +29,13 @@ use OpenBSD::Paths; use OpenBSD::PackageInfo; use OpenBSD::AddCreateDelete; -our @ISA = qw(OpenBSD::AddCreateDelete); - sub handle_options { my ($self, $opt_string, $hash, $cmd, @usage) = @_; my $state = $self->new_state($cmd); $state->{opt} = $hash; - $hash->{F} = sub { - for my $o (split /\,/o, shift) { - $state->{subst}->add($o, 1); - } - }; - $self->SUPER::handle_options($opt_string.'ciInqsB:F:', - $state, @usage); - - if ($state->opt('s')) { - $state->{not} = 1; - } - # XXX RequiredBy - $main::not = $state->{not}; - $state->{interactive} = $state->opt('i'); - $state->{localbase} = $state->opt('L') // OpenBSD::Paths->localbase; - $state->{size_only} = $state->opt('s'); - $state->{quick} = $state->opt('q'); - $state->{extra} = $state->opt('c'); - $state->{dont_run_scripts} = $state->opt('I'); - $ENV{'PKG_DELETE_EXTRA'} = $state->{extra} ? "Yes" : "No"; + $state->handle_options($opt_string, @usage); return $state; } @@ -157,6 +136,32 @@ use OpenBSD::Vstat; use OpenBSD::Log; our @ISA = qw(OpenBSD::AddCreateDelete::State); +sub handle_options +{ + my ($state, $opt_string, @usage) = @_; + + # backward compatibility + $state->{opt}{F} = sub { + for my $o (split /\,/o, shift) { + $state->{subst}->add($o, 1); + } + }; + $state->SUPER::handle_options($opt_string.'ciInqsB:F:', @usage); + + if ($state->opt('s')) { + $state->{not} = 1; + } + # XXX RequiredBy + $main::not = $state->{not}; + $state->{interactive} = $state->opt('i'); + $state->{localbase} = $state->opt('L') // OpenBSD::Paths->localbase; + $state->{size_only} = $state->opt('s'); + $state->{quick} = $state->opt('q'); + $state->{extra} = $state->opt('c'); + $state->{dont_run_scripts} = $state->opt('I'); + $ENV{'PKG_DELETE_EXTRA'} = $state->{extra} ? "Yes" : "No"; +} + sub init { my $self = shift; @@ -210,7 +215,7 @@ sub vsystem if ($r != 0) { $self->say("... failed: #1", $self->child_error); } else { - $self->say; + $self->say(""); } } } |