aboutsummaryrefslogtreecommitdiff
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
parentceaf47d002980b5462313461987eb861adb7c8d6 (diff)
Notes
-rw-r--r--usr.sbin/pkg_install/lib/global.c6
-rw-r--r--usr.sbin/pkg_install/lib/lib.h6
-rw-r--r--usr.sbin/pkg_install/lib/msg.c11
3 files changed, 17 insertions, 6 deletions
diff --git a/usr.sbin/pkg_install/lib/global.c b/usr.sbin/pkg_install/lib/global.c
index f5eda0e319178..d411f5e28550c 100644
--- a/usr.sbin/pkg_install/lib/global.c
+++ b/usr.sbin/pkg_install/lib/global.c
@@ -1,5 +1,5 @@
#ifndef lint
-static const char *rcsid = "$Id$";
+static const char *rcsid = "$Id: global.c,v 1.1.1.1 1993/08/26 01:19:55 jkh Exp $";
#endif
/*
@@ -25,7 +25,9 @@ static const char *rcsid = "$Id$";
#include "lib.h"
-/* These two are global for all utils */
+/* These are global for all utils */
Boolean Verbose = FALSE;
Boolean Fake = FALSE;
+int AutoAnswer = FALSE;
+
diff --git a/usr.sbin/pkg_install/lib/lib.h b/usr.sbin/pkg_install/lib/lib.h
index f84c31b92b49d..4796f85873ac4 100644
--- a/usr.sbin/pkg_install/lib/lib.h
+++ b/usr.sbin/pkg_install/lib/lib.h
@@ -1,4 +1,4 @@
-/* $Id: lib.h,v 1.3 1993/09/05 04:54:21 jkh Exp $ */
+/* $Id: lib.h,v 1.4 1993/09/18 03:39:49 jkh Exp $ */
/*
* FreeBSD install - a package for the installation and maintainance
@@ -47,6 +47,9 @@
#define FALSE (0)
#endif
+#define YES 2
+#define NO 1
+
/* Usually "rm", but often "echo" during debugging! */
#define REMOVE_CMD "rm"
@@ -145,5 +148,6 @@ int pkg_perform(char **);
/* Externs */
extern Boolean Verbose;
extern Boolean Fake;
+extern int AutoAnswer;
#endif /* _INST_LIB_LIB_H_ */
diff --git a/usr.sbin/pkg_install/lib/msg.c b/usr.sbin/pkg_install/lib/msg.c
index 489fc4767913a..12a2ff0712578 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';
}