diff options
author | G. Branden Robinson <branden@debian.org> | 2024-01-14 18:59:15 +0100 |
---|---|---|
committer | Alejandro Colomar <alx@kernel.org> | 2024-01-15 15:10:10 +0100 |
commit | 71c25f15dcf36e9d95b42b1befb92c5abf1da577 (patch) | |
tree | 6f1b57b1c1232b4e160c6bc7f4d1494fd145cf4f /man3/tgamma.3 | |
parent | d82ce270c70b49c3dd3558ea81d42ccb65f69eee (diff) |
man*/: ffix (MR.sed)MR
Use the man(7) macro `MR`, new to groff 1.23.0, instead of font style
alternation macros to mark up man-page cross references.
Hi Alex,
All past efforts at submitting a patch for this have met with vger's
wrath and rage--even a diffstat is too much for it tolerate. For those
who don't remember what this proposal is meant to achieve, here's a
backgrounder from October[0].
groff 1.23.0 has been out for over six months[1] and every major
GNU/Linux distribution, plus several non-major ones, is shipping it.[2]
I'm attaching two scripts, "MR-migrate.sh" and "MR.sed". Drop them in
the directory of your man-pages checkout, and run the first with a POSIX
shell.
The migration script doesn't just alter the pages; it also generates
"before.txt" and "after.txt" files containing the man page contents
rendered as (UTF-8) plain text to verify that no changes to page content
(apart from font style change to man page cross references attendant to
the use of a new macro, which is user-configurable[3]) occur.
I get the following output:
$ sh ./MR-migrate.sh
man4/console_codes.4:324: warning: table wider than line length minus indentation
man5/proc_pid_smaps.5:88: warning: table wider than line length minus indentation
troff:man7/ascii.7:28: warning: cannot select font 'CW'
man4/console_codes.4:324: warning: table wider than line length minus indentation
man5/proc_pid_smaps.5:88: warning: table wider than line length minus indentation
troff:man7/ascii.7:28: warning: cannot select font 'CW'
SAME
Thanks again to Brian Inglis for reminding me not to update externally
generated/sourced pages (bpf-helpers and Paul Eggert's tz project).
Regards,
Branden
[0] https://lore.kernel.org/linux-man/20231025185341.mqvn7qlm3iby4zgm@illithid/
[1] https://lists.gnu.org/archive/html/info-gnu/2023-07/msg00001.html
[2] https://repology.org/project/groff/versions
[3] You can of course find out how in groff_man(7).
$ cat MR-migrate.sh
#!/bin/sh
set -e
groff_cmd="groff -t -dAD=l -rHY=0 -m andoc -T utf8 -P -cbou"
pages=$(grep -L '^\.so ' man*/* \
| grep -Ev '(tzfile|tzselect|zdump|zic|time2posix|bpf-helpers)' \
| sort)
$groff_cmd $pages > before.txt
sed -i -f MR.sed $pages
$groff_cmd $pages > after.txt
cmp before.txt after.txt && echo SAME
# git co . # to revert
##############
$ cat MR.sed
# Handle simplest cases: ".BR foo (1)" and ".IR foo (1)".
s/^.[BI]R \(\\%\)*\([.@_[:alnum:]\\-]\+\) (\([1-9a-z]\+\))$/.MR \2 \3/
# Handle case: trailing punctuation, as in ".IR foo (1),".
s/^.[BI]R \(\\%\)*\([.@_[:alnum:]\\-]\+\) (\([1-9a-z]\+\))\([^[:space:]]\+\)$/.MR \2 \3 \4/
# 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/
# Handle case: 3rd+ arguments or trailing comments. This case is rare
# and will require manual fixup if there are 4+ arguments to MR. Use
# groff -man -rCHECKSTYLE=1 to have them automatically reported.
s/^.[BI]R \(\\%\)*\([.@_[:alnum:]\\-]\+\) (\([1-8a-z]\+\))\( .*\)/.MR \2 \3\4/
Link: <https://lore.kernel.org/linux-man/20240114154225.5tyuiqrgwyltqmj3@illithid/T/#u>
Signed-off-by: "G. Branden Robinson" <g.branden.robinson@gmail.com>
Cc: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Diffstat (limited to 'man3/tgamma.3')
-rw-r--r-- | man3/tgamma.3 | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/man3/tgamma.3 b/man3/tgamma.3 index e55e95c35..3fa0f3342 100644 --- a/man3/tgamma.3 +++ b/man3/tgamma.3 @@ -26,7 +26,7 @@ Math library .P .RS -4 Feature Test Macro Requirements for glibc (see -.BR feature_test_macros (7)): +.MR feature_test_macros 7 ): .RE .P .BR tgamma (), @@ -110,7 +110,7 @@ or respectively, with the same sign as the 0. .SH ERRORS See -.BR math_error (7) +.MR math_error 7 for information on how to determine whether an error has occurred when calling these functions. .P @@ -158,7 +158,7 @@ is set to .\" exception for various cases. .SH ATTRIBUTES For an explanation of the terms used in this section, see -.BR attributes (7). +.MR attributes 7 . .TS allbox; lbx lb lb @@ -180,9 +180,9 @@ C99, POSIX.1-2001. .SH NOTES This function had to be called "true gamma function" since there is already a function -.BR gamma (3) +.MR gamma 3 that returns something else (see -.BR gamma (3) +.MR gamma 3 for details). .SH BUGS Before glibc 2.18, the glibc implementation of these functions did not set @@ -212,5 +212,5 @@ and an .B FE_INVALID exception raised), rather than a pole error. .SH SEE ALSO -.BR gamma (3), -.BR lgamma (3) +.MR gamma 3 , +.MR lgamma 3 |