summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS3
-rw-r--r--src/man.c13
2 files changed, 12 insertions, 4 deletions
diff --git a/NEWS b/NEWS
index 9321b019..c504646c 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,9 @@ Major changes since man-db 2.7.0.2:
deleted. (As a result of this fix, man-db now requires
libpipeline >= 1.4.0.)
+ o 'man -a' sends its prompts to /dev/tty rather than to stderr, and
+ likewise reads replies from /dev/tty rather than from stdin.
+
man-db 2.7.0.2 (28 September 2014)
==================================
diff --git a/src/man.c b/src/man.c
index 730f118c..e4515468 100644
--- a/src/man.c
+++ b/src/man.c
@@ -1969,30 +1969,35 @@ static void locale_macros (void *data)
static inline int do_prompt (const char *name)
{
int ch;
+ FILE *tty = NULL;
skip = 0;
- if (!isatty (STDOUT_FILENO) || !isatty (STDIN_FILENO))
+ tty = fopen ("/dev/tty", "r+");
+ if (!tty)
return 0;
- fprintf (stderr, _(
+ fprintf (tty, _(
"--Man-- next: %s "
"[ view (return) | skip (Ctrl-D) | quit (Ctrl-C) ]\n"),
name);
- fflush (stderr);
+ fflush (tty);
do {
- ch = getchar ();
+ ch = getc (tty);
switch (ch) {
case '\n':
+ fclose (tty);
return 0;
case EOF:
skip = 1;
+ fclose (tty);
return 1;
default:
break;
}
} while (1);
+ fclose (tty);
return 0;
}