man*/: srcfix
PATCH v2 1/1 man*/: srcfix
Clean up in preparation for "MR sed".
Format only one man page cross reference per input line.
Also, since groff 1.23.0 (and Plan 9 from User Space's) MR is not a font style alternation macro, there is no "reversed" form as with BR and RB. So when a man page cross reference must be immediately preceded by punctuation, put that punctuation on the previous text line and use the \c escape sequence to connect them.
--- man2/eventfd.2 | 4 +++- man2/open.2 | 9 +++++++-- man2/perf_event_open.2 | 7 ++++++- man2/signalfd.2 | 4 +++- man2/timerfd_create.2 | 4 +++- man5/proc.5 | 4 +++- man7/credentials.7 | 15 ++++++++++----- man7/pty.7 | 5 ++++- man7/spufs.7 | 6 +++++- 9 files changed, 44 insertions(+), 14 deletions(-)
man2/eventfd.2 +3 -1
@@ -142,7 +142,9 @@ .SH DESCRIPTION if the size of the supplied buffer is less than 8 bytes, or if an attempt is made to write the value 0xffffffffffffffff. .TP -.BR poll "(2), " select "(2) (and similar)" +.BR poll (2),\~\c +.BR select (2)\~\c +(and similar) The returned file descriptor supports .BR poll (2) (and analogously
man2/open.2 +7 -2
@@ -82,8 +82,13 @@ .SH DESCRIPTION to an entry in the process's table of open file descriptors. The file descriptor is used in subsequent system calls -.RB ( read "(2), " write "(2), " lseek "(2), " fcntl (2), -etc.) to refer to the open file. +(\c +.BR read (2), +.BR write (2), +.BR lseek (2), +.BR fcntl (2), +etc.) +to refer to the open file. The file descriptor returned by a successful call will be the lowest-numbered file descriptor not currently open for the process. .PP
man2/perf_event_open.2 +6 -1
@@ -32,7 +32,12 @@ .SH DESCRIPTION Given a list of parameters, .BR perf_event_open () returns a file descriptor, for use in subsequent system calls -.RB ( read "(2), " mmap "(2), " prctl "(2), " fcntl "(2), etc.)." +(\c +.BR read (2), +.BR mmap (2), +.BR prctl (2), +.BR fcntl (2), +etc.). .PP A call to .BR perf_event_open ()
man2/signalfd.2 +3 -1
@@ -131,7 +131,9 @@ .SH DESCRIPTION .B EAGAIN if the file descriptor has been made nonblocking. .TP -.BR poll "(2), " select "(2) (and similar)" +.BR poll (2),\~\c +.BR select (2)\~\c +(and similar) The file descriptor is readable (the .BR select (2)
man2/timerfd_create.2 +3 -1
@@ -317,7 +317,9 @@ .SS Operating on a timer file descriptor .BR read (2) on the file descriptor. .TP -.BR poll "(2), " select "(2) (and similar)" +.BR poll (2),\~\c +.BR select (2)\~\c +(and similar) The file descriptor is readable (the .BR select (2)
man5/proc.5 +3 -1
@@ -3459,7 +3459,9 @@ .SS Files and directories .TP .I /proc/locks This file shows current file locks -.RB ( flock "(2) and " fcntl (2)) +.RB ( flock (2) +and +.BR fcntl (2)) and leases .RB ( fcntl (2)). .IP
man7/credentials.7 +10 -5
@@ -267,21 +267,26 @@ .SS Modifying process user and group IDs Subject to rules described in the relevant manual pages, a process can use the following APIs to modify its user and group IDs: .TP -.BR setuid "(2) (" setgid (2)) +.BR setuid (2)\~(\c +.BR setgid (2)) Modify the process's real (and possibly effective and saved-set) user (group) IDs. .TP -.BR seteuid "(2) (" setegid (2)) +.BR seteuid (2)\~(\c +.BR setegid (2)) Modify the process's effective user (group) ID. .TP -.BR setfsuid "(2) (" setfsgid (2)) +.BR setfsuid (2)\~(\c +.BR setfsgid (2)) Modify the process's filesystem user (group) ID. .TP -.BR setreuid "(2) (" setregid (2)) +.BR setreuid (2)\~(\c +.BR setregid (2)) Modify the process's real and effective (and possibly saved-set) user (group) IDs. .TP -.BR setresuid "(2) (" setresgid (2)) +.BR setresuid (2)\~(\c +.BR setresgid (2)) Modify the process's real, effective, and saved-set user (group) IDs. .TP .BR setgroups (2)
man7/pty.7 +4 -1
@@ -122,7 +122,10 @@ .SH FILES BSD slave devices .SH NOTES Pseudoterminals are used by applications such as network login services -.RB ( ssh "(1), " rlogin "(1), " telnet (1)), +(\c +.BR ssh (1), +.BR rlogin (1), +.BR telnet (1)), terminal emulators such as .BR xterm (1), .BR script (1),
man7/spufs.7 +5 -1
@@ -119,7 +119,11 @@ .SS Files file are: .RS .TP -.BR read "(2), " pread "(2), " write "(2), " pwrite "(2), " lseek (2) +.BR read (2),\~\c +.BR pread (2),\~\c +.BR write (2),\~\c +.BR pwrite (2),\~\c +.BR lseek (2) These operate as usual, with the exception that .BR lseek (2), .BR write (2),
Signature · 3 lines
2.30.2 v2: Fix goof that boldfaced some opening parentheses in credentials(7).
Alejandro Colomar
maintainerQuoted 111 lines · G. Branden Robinson
Clean up in preparation for "MR sed".
Format only one man page cross reference per input line.
Also, since groff 1.23.0 (and Plan 9 from User Space's)
MRis not a font style alternation macro, there is no "reversed" form as withBRandRB. So when a man page cross reference must be immediately preceded by punctuation, put that punctuation on the previous text line and use the\cescape sequence to connect them.Signed-off-by "G. Branden Robinson" <[email protected]>--- man2/eventfd.2 | 4 +++- man2/open.2 | 9 +++++++-- man2/perf_event_open.2 | 7 ++++++- man2/signalfd.2 | 4 +++- man2/timerfd_create.2 | 4 +++- man5/proc.5 | 4 +++- man7/credentials.7 | 15 ++++++++++----- man7/pty.7 | 5 ++++- man7/spufs.7 | 6 +++++- 9 files changed, 44 insertions(+), 14 deletions(-)man2/eventfd.2 +3
-1@@ -142,7 +142,9 @@ .SH DESCRIPTION if the size of the supplied buffer is less than 8 bytes, or if an attempt is made to write the value 0xffffffffffffffff. .TP -.BR poll "(2), " select "(2) (and similar)" +.BR poll (2),\~\c +.BR select (2)\~\c +(and similar) The returned file descriptor supports .BR poll (2) (and analogouslyman2/open.2 +7
-2@@ -82,8 +82,13 @@ .SH DESCRIPTION to an entry in the process's table of open file descriptors. The file descriptor is used in subsequent system calls -.RB ( read "(2), " write "(2), " lseek "(2), " fcntl (2), -etc.) to refer to the open file. +(\c +.BR read (2), +.BR write (2), +.BR lseek (2), +.BR fcntl (2), +etc.) +to refer to the open file. The file descriptor returned by a successful call will be the lowest-numbered file descriptor not currently open for the process. .PPman2/perf_event_open.2 +6
-1@@ -32,7 +32,12 @@ .SH DESCRIPTION Given a list of parameters, .BR perf_event_open () returns a file descriptor, for use in subsequent system calls -.RB ( read "(2), " mmap "(2), " prctl "(2), " fcntl "(2), etc.)." +(\c +.BR read (2), +.BR mmap (2), +.BR prctl (2), +.BR fcntl (2), +etc.). .PP A call to .BR perf_event_open ()man2/signalfd.2 +3
-1@@ -131,7 +131,9 @@ .SH DESCRIPTION .B EAGAIN if the file descriptor has been made nonblocking. .TP -.BR poll "(2), " select "(2) (and similar)" +.BR poll (2),\~\c +.BR select (2)\~\c +(and similar) The file descriptor is readable (the .BR select (2)man2/timerfd_create.2 +3
-1@@ -317,7 +317,9 @@ .SS Operating on a timer file descriptor .BR read (2) on the file descriptor. .TP -.BR poll "(2), " select "(2) (and similar)" +.BR poll (2),\~\c +.BR select (2)\~\c +(and similar) The file descriptor is readable (the .BR select (2)man5/proc.5 +0
-0
man5/proc.5 .SS Files and directories · line 3462
Quoted 5 lines
man5/proc.5 +1
-1@@ -3459,7 +3459,9 @@ .SS Files and directories .TP .I /proc/locks This file shows current file locks -.RB ( flock "(2) and " fcntl (2)) +.RB ( flock (2)
I guess you'll want a \c before flock(2). RM ain't no macro. :)
Cheers,
Alex
Quoted 74 lines
man5/proc.5 +2
-0+and +.BR fcntl (2)) and leases .RB ( fcntl (2)). .IPman7/credentials.7 +10
-5@@ -267,21 +267,26 @@ .SS Modifying process user and group IDs Subject to rules described in the relevant manual pages, a process can use the following APIs to modify its user and group IDs: .TP -.BR setuid "(2) (" setgid (2)) +.BR setuid (2)\~(\c +.BR setgid (2)) Modify the process's real (and possibly effective and saved-set) user (group) IDs. .TP -.BR seteuid "(2) (" setegid (2)) +.BR seteuid (2)\~(\c +.BR setegid (2)) Modify the process's effective user (group) ID. .TP -.BR setfsuid "(2) (" setfsgid (2)) +.BR setfsuid (2)\~(\c +.BR setfsgid (2)) Modify the process's filesystem user (group) ID. .TP -.BR setreuid "(2) (" setregid (2)) +.BR setreuid (2)\~(\c +.BR setregid (2)) Modify the process's real and effective (and possibly saved-set) user (group) IDs. .TP -.BR setresuid "(2) (" setresgid (2)) +.BR setresuid (2)\~(\c +.BR setresgid (2)) Modify the process's real, effective, and saved-set user (group) IDs. .TP .BR setgroups (2)man7/pty.7 +4
-1@@ -122,7 +122,10 @@ .SH FILES BSD slave devices .SH NOTES Pseudoterminals are used by applications such as network login services -.RB ( ssh "(1), " rlogin "(1), " telnet (1)), +(\c +.BR ssh (1), +.BR rlogin (1), +.BR telnet (1)), terminal emulators such as .BR xterm (1), .BR script (1),man7/spufs.7 +5
-1@@ -119,7 +119,11 @@ .SS Files file are: .RS .TP -.BR read "(2), " pread "(2), " write "(2), " pwrite "(2), " lseek (2) +.BR read (2),\~\c +.BR pread (2),\~\c +.BR write (2),\~\c +.BR pwrite (2),\~\c +.BR lseek (2) These operate as usual, with the exception that .BR lseek (2), .BR write (2),
Signature · 2 lines
<http://www.alejandro-colomar.es/> GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5
Hi Alex,
Quoted 4 lines · Alejandro Colomar
Quoted 3 lines · G. Branden Robinson
Clean up in preparation for "MR sed".
Format only one man page cross reference per input line.
[...]
Quoted 10 lines
man5/proc.5 .SS Files and directories · line 3462
Quoted 8 lines
man5/proc.5 +1
-1@@ -3459,7 +3459,9 @@ .SS Files and directories .TP .I /proc/locks This file shows current file locks -.RB ( flock "(2) and " fcntl (2)) +.RB ( flock (2)I guess you'll want a \c before flock(2). RM ain't no macro. :)
Thanks! Another good catch. I was trying to get over the goal line too quickly yesterday, to little effect since the diff "ball" was too large for vger even gzip -9 compressed, and was somehow corrupted in the copy I sent directly to you. Can I just omit the diff entirely when re-submitting? I'll include the (vastly shorter) sed script in the commit message; you said you prefer to run such scripts yourself anyway.
The above scenario is "snaggable" with an additional case in MR.sed.
# Handle case: leading punctuation, as in ".RI ( foo (1)".
s/^.R[BI] \(\\%\)*\([^[:space:]]\+\) \([@_[:alnum:]\\-]\+\) (\([1-9a-z]\+\))\([^[:space:]]\+\)$/\\%\2\\c\n.MR \3 \4 \5/
To anticipate complaints:
The *roff markup produced by this is a bit viscous, exercising two escape sequences that man page authors often neglect to use, or use incorrectly.[1]
man1/localedef.1 +2 -1
@@ -53,7 +53,8 @@ .SH DESCRIPTION files, compiles them to a binary form quickly usable by the locale functions in the C library -.RB ( setlocale (3), +\%(\c +.MR setlocale 3 , .MR localeconv 3 , etc.), and places the output in
On the bright side, this is only about 1% of all uses--and of course the decision to cast a man page cross reference at the beginning of a parenthetical is always(?) at the discretion of the page author.
And when I say "about 1%", I'm not waving my hands. Here is the diffstat summary from application of my "MR.sed" script _without_ the foregoing replacement.
1100 files changed, 15264 insertions(+), 15264 deletions(-)
...and here's what results from the replacement shown above.
56 files changed, 320 insertions(+), 160 deletions(-)
The other complaint that I foresee is that while MR prevents man page names from being hyphenated, that practice gives the formatter less flexibility when performing adjustment, which can make the text "gappy".
Here's an example from my before-and-after diff.
DUMP2 2023-07-31 06:16:03.059756758 -0500 renamed from DUMP1 2023-07-31 06:15:47.059827045 -0500 +2 -2
@@ -2503,2 +2503,2 @@ - This specifies the caller’s session‐specific keyring (ses‐ - sion-keyring(7)). + This specifies the caller’s session‐specific keyring + (session-keyring(7)).
But people who hate this often hate adjustment anyway, and that's what another new groff 1.23.0 feature is for.
groff_man(7):
-dAD=adjustment‐mode
Set line adjustment to adjustment‐mode, which is typically “b” for adjustment to both margins (the default), or “l” for left alignment (ragged right margin). Any valid argument to groff’s “.ad” request may be used. See groff(7) for less‐common choices.
man-db man(1) has also long supported an "--nj" option to do the same thing. In its Git repository it now uses the foregoing means if groff 1.23 or later is the formatter, as opposed to a rougher approach with some side effects.
This problem also will never arise with mandoc(1), since it refuses to perform adjustment (or hyphenation) even if you _do_ want it.
[1] For *roff non-experts, groff_man_style(7) says:
\% Control hyphenation. The location of this escape sequence
within a word marks a hyphenation point, supplementing groff’s automatic hyphenation patterns. At the beginning of a word, it suppresses any hyphenation breaks within except those specified with \%.
\c End a text line without inserting space or attempting a break.
Normally, if filling is enabled, the end of a text line is treated like a space; an output line may be broken there (if not, an adjustable space is inserted); if filling is disabled, the line will be broken there, as in .EX/.EE examples. The next line is interpreted as usual and can include a macro call (contrast with \newline). \c is useful when three font styles are needed in a single word, as in a command synopsis.
Alejandro Colomar
maintainerHi Branden,
Quoted 19 lines · G. Branden Robinson
Hi Alex,
Quoted 4 lines · Alejandro Colomar
Quoted 3 lines · G. Branden Robinson
Clean up in preparation for "MR sed".
Format only one man page cross reference per input line.
[...]
Quoted 10 lines
man5/proc.5 .SS Files and directories · line 3462
Quoted 8 lines
man5/proc.5 +1
-1@@ -3459,7 +3459,9 @@ .SS Files and directories .TP .I /proc/locks This file shows current file locks -.RB ( flock "(2) and " fcntl (2)) +.RB ( flock (2)I guess you'll want a \c before flock(2). RM ain't no macro. :)
Quoted 6 lines
Thanks! Another good catch. I was trying to get over the goal line too quickly yesterday, to little effect since the diff "ball" was too large for vger even gzip -9 compressed, and was somehow corrupted in the copy I sent directly to you. Can I just omit the diff entirely when re-submitting? I'll include the (vastly shorter) sed script in the commit message; you said you prefer to run such scripts yourself anyway.
Sure. If you want to include the first 1 or 2 pages, it might help others have a look at what the patch does without running your script, but for me, the script and the --stat (especially, the count of line modifications, to make sure the script was correctly applied) are enough.
Quoted 2 lines
The above scenario is "snaggable" with an additional case in MR.sed.
While you're probably the most appropriate one to decide that, I suggest to keep it simple, and handle these special cases as separate patches. But whatever you prefer.
Quoted 15 lines
# Handle case: leading punctuation, as in ".RI ( foo (1)".
s/^.R[BI] \(\\%\)*\([^[:space:]]\+\) \([@_[:alnum:]\\-]\+\) (\([1-9a-z]\+\))\([^[:space:]]\+\)$/\\%\2\\c\n.MR \3 \4 \5/To anticipate complaints:
The *roff markup produced by this is a bit viscous, exercising two escape sequences that man page authors often neglect to use, or use incorrectly.[1]
man1/localedef.1 +0
-0
man1/localedef.1 .SH DESCRIPTION · line 56
Quoted 5 lines
man1/localedef.1 +1
-1@@ -53,7 +53,8 @@ .SH DESCRIPTION files, compiles them to a binary form quickly usable by the locale functions in the C library -.RB ( setlocale (3), +\%(\c
Interesting. No problem.
Quoted 9 lines
man1/localedef.1 +1
-0+.MR setlocale 3 , .MR localeconv 3 , etc.), and places the output inOn the bright side, this is only about 1% of all uses--and of course the decision to cast a man page cross reference at the beginning of a parenthetical is always(?) at the discretion of the page author.
Quoted 5 lines
And when I say "about 1%", I'm not waving my hands. Here is the diffstat summary from application of my "MR.sed" script _without_ the foregoing replacement.
1100 files changed, 15264 insertions(+), 15264 deletions(-)
OMG
Quoted 8 lines
...and here's what results from the replacement shown above.
56 files changed, 320 insertions(+), 160 deletions(-)The other complaint that I foresee is that while
MRprevents man page names from being hyphenated, that practice gives the formatter less flexibility when performing adjustment, which can make the text "gappy".
I guess that's inevitable. It's either that or unusable man page references.
Cheers,
Alex
Quoted 47 lines
Here's an example from my before-and-after diff.
DUMP2 2023-07-31 06:16:03.059756758 -0500 renamed from DUMP1 2023-07-31 06:15:47.059827045 -0500 +2
-2@@ -2503,2 +2503,2 @@ - This specifies the caller’s session‐specific keyring (ses‐ - sion-keyring(7)). + This specifies the caller’s session‐specific keyring + (session-keyring(7)).But people who hate this often hate adjustment anyway, and that's what another new groff 1.23.0 feature is for.
groff_man(7):-dAD=adjustment‐mode
Set line adjustment to adjustment‐mode, which is typically “b” for adjustment to both margins (the default), or “l” for left alignment (ragged right margin). Any valid argument to groff’s “.ad” request may be used. See groff(7) for less‐common choices.man-db man(1) has also long supported an "--nj" option to do the same thing. In its Git repository it now uses the foregoing means if groff 1.23 or later is the formatter, as opposed to a rougher approach with some side effects.
This problem also will never arise with mandoc(1), since it refuses to perform adjustment (or hyphenation) even if you _do_ want it.
[1] For *roff non-experts,
groff_man_style(7)says:\% Control hyphenation. The location of this escape sequence
within a word marks a hyphenation point, supplementing groff’s automatic hyphenation patterns. At the beginning of a word, it suppresses any hyphenation breaks within except those specified with \%.\c End a text line without inserting space or attempting a break.
Normally, if filling is enabled, the end of a text line is treated like a space; an output line may be broken there (if not, an adjustable space is inserted); if filling is disabled, the line will be broken there, as in .EX/.EE examples. The next line is interpreted as usual and can include a macro call (contrast with \newline). \c is useful when three font styles are needed in a single word, as in a command synopsis.
Signature · 2 lines
<http://www.alejandro-colomar.es/> GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5