diff options
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | src/man.c | 13 |
2 files changed, 12 insertions, 4 deletions
@@ -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) ================================== @@ -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; } |