On 2025-07-28 07:41, Stan Marsh wrote:
Paul Eggert <egg...@cs.ucla.edu> writes:
Thanks for looking into that. Unfortunately POSIX says -p should be
ignored only if standard output is a terminal, and that newline should
-----------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Shouldn't this be "ignored unless standard output is a terminal" ?
Yes, sorry.
Then Pádraig Brady wrote:
Reading POSIX more closely I see there is also pause logic for the first page
only:
-f [XSI] [Option Start] Use a <form-feed> for new pages, instead of the
default
behavior that uses a sequence of <newline> characters.
Pause before beginning the first page if the standard output is
associated with a terminal. [Option End]
How can it be both?
If neither -p nor -f is specified, pr doesn't pause.
If -p is specified, pr pauses before every output page, regardless of
whether -f is also specified.
If -f but not -p is specified, pr pauses only before the first output page.
The motivation for -p is that you are using something like a Teletype
Model 37[1] to log in, i.e., you are logged in via a printing terminal.
But you want to print something out using special paper that you need to
load by hand, one sheet at a time, and you don't want your interactive
session to appear on that paper.
The -f option is also motivated for a device like the Model 37, except
you merely want to use the existing multi-sheet paper and tear off the
interactive session.
Although devices like the Model 37 became obsolete for logins in the
1970s (I last used one for that purpose in 1975), apparently enough of
them were still being used in older installations that the -p option was
added by some well-meaning engineer at AT&T around 1980. (The -p option
was not present in 7th edition UNIX, released in 1979.) And POSIX
standardized -p - which has not been needed for at least three decades,
probably four - and we are now spending time implementing -p for
coreutils, time that would be more usefully spent elsewhere.
[1]: https://en.wikipedia.org/wiki/Teletype_Model_37