In the case where we can't open /dev/tty, fall back to -t behaviour.

Submitted by:	fenner
This commit is contained in:
Juli Mallett 2002-04-19 23:58:00 +00:00
parent 5e61dfa3ca
commit 91ae52cb17

View File

@ -392,15 +392,13 @@ run(char **argv)
(void)fprintf(stderr, "%s", *argv);
for (p = argv + 1; *p; ++p)
(void)fprintf(stderr, " %s", *p);
if (pflag) {
if ((ttyfp = fopen("/dev/tty", "r")) != NULL) {
(void)fprintf(stderr, "?");
(void)fflush(stderr);
ch = getc(ttyfp);
fclose(ttyfp);
if (ch != 'y')
return;
}
if (pflag && (ttyfp = fopen("/dev/tty", "r")) != NULL) {
(void)fprintf(stderr, "?");
(void)fflush(stderr);
ch = getc(ttyfp);
fclose(ttyfp);
if (ch != 'y')
return;
} else {
(void)fprintf(stderr, "\n");
(void)fflush(stderr);