diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2004-10-11 12:34:00 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2004-10-11 12:34:00 +0000 |
commit | b0ff629f2834e83a0309018979574d37f2d67449 (patch) | |
tree | 540e52b2f50632dd46c927db388acda919a233eb /usr.sbin | |
parent | e01ed23847fd75c91b2ff5f1f857439fdc66315d (diff) |
store opt_n and opt_v inside state.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pkg_add/pkg_add | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add index 9fd1eb17439..40b3d6c11e5 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.66 2004/10/11 12:25:18 espie Exp $ +# $OpenBSD: pkg_add,v 1.67 2004/10/11 12:33:59 espie Exp $ # # Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org> # @@ -361,6 +361,9 @@ if ($< && !$forced{nonroot}) { } $state->{conflict_list} = {}; +$state->{not} = $opt_n; +$state->{verbose} = $opt_v; +$state->{beverbose} = $opt_n || $opt_v; # first, find all possible potential conflicts for my $pkg (installed_packages()) { @@ -392,11 +395,11 @@ sub can_install($$) # This does pre_add a package: finding it and reading its package information -sub pre_add($$$) +sub pre_add($$) { - my ($pkg, $state, $not) = @_; + my ($pkg, $state) = @_; my $pkgname1; - my $operation = $not ? "Pretending to add" : "Adding"; + my $operation = $state->{not} ? "Pretending to add" : "Adding"; if ($pkg ne '-') { print "$operation $pkg\n"; @@ -769,7 +772,7 @@ sub install_package my $cache = $state->{cache}; if (!defined $cache->{$pkg}) { - $cache->{$pkg} = pre_add($pkg, $state, $opt_n); + $cache->{$pkg} = pre_add($pkg, $state); } my $handle = $cache->{$pkg}; @@ -835,7 +838,7 @@ my $dielater = @_; OpenBSD::PackingElement::Fontdir::finish_fontdirs(); ensure_ldconfig($opt_v) unless $opt_n; -if ($opt_n or $opt_v) { +if ($state->{beverbose}) { OpenBSD::Vstat::tally(); } if ($dielater) { |