Also, I think the line: ttyinf = stdin; is almost certainly unnecessary. But I'd like someone else more versed in programming to confirm this. I don't think ttyinf's value of stdin is ever used, as it gets set next to /dev/tty
On Fri, Dec 11, 2020 at 9:54 PM Andras Farkas <deepbluemist...@gmail.com> wrote: > > Hi! > > After seeing the diff for cat -n earlier today, and just browsing Unix > stuff on my own, I noticed OpenBSD's pr(1) command has no -p option > despite pr.1 stating: > > The pr utility is compliant with the IEEE Std 1003.1-2008 ("POSIX.1") > > specification. > https://man.openbsd.org/pr.1 > This part of the man page was added in this diff: > https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/pr/pr.1.diff?r1=1.16&r2=1.17 > https://github.com/openbsd/src/commit/7c5a075bb35c9874ed6ed8040f78870dae704a20 > and was never correct. -p has been a mandatory (it's neither XSI nor > optional) part of POSIX since 2001. > It's also not merely a SysVism or POSIXism, as -p exists in Unix 8th > and 10th editions: > http://man.cat-v.org/unix_8th/1/pr > http://man.cat-v.org/unix_10th/1/pr > > In case the -p option is not desired, I have a small diff attached > (no-p.txt) that fixes the man page, and fixes a typo in pr.c > But I also have a bigger diff (pr-p.txt) adding -p to pr. > It's inspired by the FreeBSD and NetBSD diffs, but mostly the NetBSD one: > https://github.com/freebsd/freebsd/commit/cace3f9d081619c267182e7e1c926cafabc283e2 > https://svnweb.freebsd.org/base?view=revision&revision=93481 > https://github.com/NetBSD/src/commit/a19c45064f8d362783a3e36c2820544bc05d644a > http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.bin/pr/pr.c > > I did not touch -f or -F, though those can easily be changed later if desired. > I also did not touch -n and its numbering limit. > Implementation note: while POSIX says a "<carriage-return>", i.e. > '\r', should be waited for, FreeBSD, NetBSD, OpenSolaris, and Unix > 10th edition wait for '\n' and I followed them rather than POSIX. It > would be easy to make pr wait for either '\n' or '\r' though. > > I don't know whether to add a new date or name to the > copyright/license text at the top. A whole new flag was added, but > it's adapted from another implementation. > I mostly imitated pr's pre-existing non-style(9) style, except for > using proper style(9) inside the new prpause() function. > > Thanks for reading!