GNU bug report logs -
#47243
pr lacks -p
Previous Next
Full log
View this message in rfc822 format
Thanks for looking into that. Unfortunately POSIX says -p should be
ignored only if standard output is a terminal, and that newline should
be read from /dev/tty, not from standard input. This is so that users
can pipe into 'pr -p'. So the proposed patch needs some changes. Here
are the issues I found:
> + pr now supports the -p option, to pause upon printing each page until
> + a newline character is read from standard input, as required by POSIX
> + Issue 6. The corresponding long option is --pause.
This should be /dev/tty, not standard input.
> +After printing each page, print an alert (bell) to standard error and
> +wait for a newline to be read from standard input before printing the
Likewise.
> +next page. This option is ignored unless both standard input and
> +standard output are a tty.
This should mention only standard output.
> + if (pause_option)
> + pause_option = isatty (STDOUT_FILENO) && isatty (STDIN_FILENO);
This should check only standard output.
> - if (have_read_stdin && fclose (stdin) == EOF)
> + if ((have_read_stdin || pause_option) && fclose (stdin) == EOF)
> error (EXIT_FAILURE, errno, _("standard input"));
This change should be omitted.
> - while (print_page ())
> - ;
> + for (;;)
> + {
> + if (pause_option)
> + {
> + putc ('\a', stderr);
> + while (getchar () != '\n')
> + ;
> + }
> + if (! print_page ())
> + break;
> + }
This should read from /dev/tty, not from stdin.
> + -p, --pause pause at the beginning of each page until a newline\n\
> + is read from standard input.\n\
This should mention /dev/tty, not standard input.
This bug report was last modified 8 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.