Subject: bug#47243: pr lacks -p

From: Paul Eggert <[email-masked]>
Date: Tue, 29 Jul 2025 12:10:26 -0700

On 2025-07-29 10:11, Collin Funk wrote:

>> And that wasn't the worst device I used to write programs!
> I'm curious, what is the worst?

The IBM 029 card punch, introduced in 1964, was worse.

https://en.wikipedia.org/wiki/Keypunch#IBM_029_Card_Punch

Also, the Qume QVT-102, introduced in 1983. Terrible keyboard. Gave me 
carpal tunnel syndrome.

https://terminals-wiki.org/wiki/index.php/Qume_QVT-102

>>> +  if (pause_option && close (tty_fd) < 0)
>>> +    error (EXIT_FAILURE, errno, "%s", quotef ("/dev/tty"));
>>
>> Why are these lines useful? As far as I can see they merely add
>> complexity for no benefit. How about removing them? (If we kept them
>> we would need to fix the bug in them; but let's remove them.)
> 
> I assume we would want to close the file descriptors that we open at the
> end of the program. If so, I guess there is no point in checking for
> errors from 'close'. Or is the close not nessecary, similar to calling
> 'free' on memory just before exit?

Yes, the latter. Files are automatically closed on exit.

We check for error when closing output fds because some filesystems 
delay error reporting until close. There's less of a reason to check for 
closing input fds just before exit. Here, I can't think of any reason.