GNU bug report logs -
#47243
pr lacks -p
Previous Next
Full log
View this message in rfc822 format
Paul Eggert <eggert <at> cs.ucla.edu> writes:
> On 2025-07-29 21:51, Collin Funk wrote:
>
>> + /* Just exit if the user presses Ctrl-D. */
>> + if (bytes_read == 0)
>> + return;
>
> This needs reworking now that 'pause_maybe' is a separate function, as
> the code no longer exits, it just keeps going.
Yep, I noticed just after I sent it. I figured that we could just do:
if (have_read_stdin && fclose (stdin) == EOF)
error (EXIT_FAILURE, errno, _("standard input"));
exit (EXIT_SUCCESS);
The same as we do before exiting 'main' (probably make the closing of
standard input a static function).
But didn't bother sending a new patch just for that. :)
> One other thought. It may well be better to open /dev/tty lazily, that
> is, inside pause_maybe's 'while (true)' loop, just before the 'read'
> (assuming /dev/tty has not already been opened). That way, pr -p
> needn't unnecessarily fail when printing an empty file (where /dev/tty
> isn't needed after all).
Good idea. That sounds better to me as well.
I'll have to take a look at Pádraig's and your other messages in a bit.
Thanks,
Collin
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.