summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/OpenBSD
diff options
context:
space:
mode:
authorBernd Ahlers <bernd@cvs.openbsd.org>2006-11-17 09:58:21 +0000
committerBernd Ahlers <bernd@cvs.openbsd.org>2006-11-17 09:58:21 +0000
commit8afdcd4a0d0d6205ead50a2037ffc35783d8505d (patch)
tree4487e8a337620f78cc070c5096bc3f35ba21d8cd /usr.sbin/pkg_add/OpenBSD
parent2c7773167beb4fdd131226e93096728bf323c19e (diff)
Handle EOF in interactive mode. Report and initial diff from Antti Harri
via tech@. Thanks! ok espie@
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Interactive.pm10
1 files changed, 9 insertions, 1 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Interactive.pm b/usr.sbin/pkg_add/OpenBSD/Interactive.pm
index eb16f7673c5..a57e8f86b40 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.3 2006/03/04 11:31:18 espie Exp $
+# $OpenBSD: Interactive.pm,v 1.4 2006/11/17 09:58:20 bernd Exp $
#
# Copyright (c) 2005 Marc Espie <espie@openbsd.org>
#
@@ -35,6 +35,10 @@ sub ask_list
LOOP:
print STDERR "Your choice: ";
my $result = <STDIN>;
+ unless (defined $result) {
+ print STDERR "\n";
+ return $values[0];
+ }
chomp $result;
if ($result eq '') {
return $values[0];
@@ -70,6 +74,10 @@ LOOP2:
print STDERR $prompt, $default ? "? [Y/n$a] " : "? [y/N$a] ";
my $result = <STDIN>;
+ unless(defined $result) {
+ print STDERR "\n";
+ return $default;
+ }
chomp $result;
$result =~ s/\s*//g;
$result =~ tr/A-Z/a-z/;