summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/OpenBSD
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2016-06-24 14:20:50 +0000
committerMarc Espie <espie@cvs.openbsd.org>2016-06-24 14:20:50 +0000
commit66434e167d927b947bd58ad2b522727b51b3f4a0 (patch)
tree3405739e11bd759bc7f5278668186f938712d1e0 /usr.sbin/pkg_add/OpenBSD
parent02a2dbc385d4e7eb1326144e2f4e0e6b8d2b5c03 (diff)
make use of former changes. If list is higher than display go thru more.
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Interactive.pm16
1 files changed, 13 insertions, 3 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Interactive.pm b/usr.sbin/pkg_add/OpenBSD/Interactive.pm
index 0f8fcfe9e08..b5b7b76e613 100644
--- a/usr.sbin/pkg_add/OpenBSD/Interactive.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Interactive.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Interactive.pm,v 1.20 2015/01/30 11:42:55 espie Exp $
+# $OpenBSD: Interactive.pm,v 1.21 2016/06/24 14:20:49 espie Exp $
#
# Copyright (c) 2005-2007 Marc Espie <espie@openbsd.org>
#
@@ -35,14 +35,24 @@ sub ask_list
if ($self->{always}) {
return $values[0];
}
+ my ($fh, $pid);
+ if ($self->{state}->height <= @values + 1) {
+ $pid = open($fh, "|-", "more", "-ce");
+ }
+
+ $fh //= \*STDERR;
- $self->{state}->errsay('#1', $prompt);
+ $self->{state}->fhsay($fh, '#1', $prompt);
my $i = 0;
for my $v (@values) {
- $self->{state}->errsay("#1\t#2: #3",
+ $self->{state}->fhsay($fh, "#1\t#2: #3",
$i == 0 ? "a" : "", $i, $v);
$i++;
}
+ if (defined $pid) {
+ close($fh);
+ waitpid $pid, 0;
+ }
LOOP:
$self->{state}->errprint("Your choice: ");
my $result = <STDIN>;