GNU bug report logs -
#47243
pr lacks -p
Previous Next
Full log
View this message in rfc822 format
On 30/07/2025 05:51, Collin Funk wrote:
> Paul Eggert <eggert <at> cs.ucla.edu> writes:
>
>>> +After printing each page, print an alert (bell) to standard error and
>>> +wait for a newline to be read from @file{/dev/tty} before printing the
>>> +next page.
>>
>> This sentence should start "Before" not "After", with the rest of the
>> sentence changed accordingly. There is no bell printed after the last
>> page.
>>
>> Looking at the code, it seems that this mistake has leaked into the
>> code as well, in that sometimes 'pr' will print an alert and wait for
>> '\n' at end of file, when there is no page to print. If I'm right,
>> that needs to be fixed; pr should wait for '\n' only if it will
>> actually print something afterward.
>
> Fixing this required a bit more understanding of the code on my part,
> but I think the attached patch should address it.
>
> The existing code uses a 'pad_vertically' variable to keep track of
> whether the current page has text or a header that needs to be
> printed. Therefore, any time we set it to true, we must also pause. But
> only once, at the start of the page.
Looking good. A few tweaks...
The NEWS for -p should be in a "New Features" section.
The texinfo for --pause should:
s/before printing the next page/before printing the page/
I'd have a slight preference for _not_ gating the isatty(STDOUT) check on $POSIXLY_CORRECT.
We generally only use $POSIXLY_CORRECT to gate incompatible behavior.
The write_error() after the putc('\a') should be a plain error (EXIT_FAILURE, ...)
thanks,
Padraig
This bug report was last modified 9 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.