GNU bug report logs -
#47243
pr lacks -p
Previous Next
Full log
Message #46 received at 47243 <at> debbugs.gnu.org (full text, mbox):
On 2025-07-27 19:21, Collin Funk wrote:
> I think that v3 attached should cover everything.
In addition to Pádraig's comments, I would add:
> + a newline character is read from /dev/tty, as required by POSIX Issue
> + 6. The corresponding long option is --pause.
Don't say "Issue 6" as almost nobody knows what that means and it's
obsolete anyway. Just say "POSIX".
> + if (ch == EOF)
> + {
> + /* Just exit if the user presses Ctrl-D. */
> + if (feof (tty_fp))
> + goto finish;
> + error (EXIT_FAILURE, errno, _("error reading %s"),
> + quoteaf ("/dev/tty"));
> + }
'goto finish;' should be 'return;'. That way, we don't need the 'finish'
label.
It's possible for feof and ferror to both be true. In that case, pr
should report the error. So, this code should call ferror instead of
calling feof.
Come to think of it, why use stdio here? Plain 'open' and 'read' work
just as well for this, and avoid possible stdio glitches. There's no
real need for stdio's buffering.
This bug report was last modified 49 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.