aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_install/lib/msg.c
diff options
context:
space:
mode:
authorJordan K. Hubbard <jkh@FreeBSD.org>1994-04-05 14:08:47 +0000
committerJordan K. Hubbard <jkh@FreeBSD.org>1994-04-05 14:08:47 +0000
commita4723e41a94c4a1b7000b8651d04308d4f579ab1 (patch)
treeac02b985aac39d049d15cea2a959286212a9b94f /usr.sbin/pkg_install/lib/msg.c
parentceaf47d002980b5462313461987eb861adb7c8d6 (diff)
Notes
Diffstat (limited to 'usr.sbin/pkg_install/lib/msg.c')
-rw-r--r--usr.sbin/pkg_install/lib/msg.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/usr.sbin/pkg_install/lib/msg.c b/usr.sbin/pkg_install/lib/msg.c
index 489fc4767913..12a2ff071257 100644
--- a/usr.sbin/pkg_install/lib/msg.c
+++ b/usr.sbin/pkg_install/lib/msg.c
@@ -1,5 +1,5 @@
#ifndef lint
-static const char *rcsid = "$Id: msg.c,v 1.3 1993/09/04 05:06:50 jkh Exp $";
+static const char *rcsid = "$Id: msg.c,v 1.2 1993/09/03 23:01:15 jkh Exp $";
#endif
/*
@@ -80,14 +80,19 @@ y_or_n(Boolean def, const char *msg, ...)
tty = fopen("/dev/tty", "r");
if (!tty)
barf("Can't open /dev/tty!\n");
- while (ch != 'Y' && ch != 'N') {
+ while (ch != 'Y' && ch != 'N') {
vfprintf(stderr, msg, args);
if (def)
fprintf(stderr, " [yes]? ");
else
fprintf(stderr, " [no]? ");
fflush(stderr);
- ch = toupper(fgetc(tty));
+ if (AutoAnswer) {
+ ch = (AutoAnswer == YES) ? 'Y' : 'N';
+ fprintf(stderr, "%c\n", ch);
+ }
+ else
+ ch = toupper(fgetc(tty));
if (ch == '\n')
ch = (def) ? 'Y' : 'N';
}