Skip to contentSkip to conversation

Missing commas in SEE ALSO part II

PATCH In review Kir Kolyshkin 2 participants 2 messages May 16, 2020 – May 18, 2020 Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Missing commas in SEE ALSO part II

This is a sequel to commit baf17bc4f2a3f3b02d, addressing the issues with missing commas in the middle of SEE ALSO lists that emerged since.

The awk script from the original commit was not working and had to be slightly modified (s/["]SEE ALSO["]/"?SEE ALSO/), otherwise it works like a charm. Here's the fixed script and its output just before this commit:

for f in man*/*; do
awk '

    /^.SH "?SEE ALSO/ {
	sa=1; print "== " FILENAME " =="; print; next
    }
    /^\.(PP|SH)/ {
	sa=0; no=0; next
    }
    /^\.BR/ {
	if (sa==1) {
	    print;
	    if (no == 1)
		print "Missing comma in " FILENAME " +" FNR-1; no=0
	}
    }
    /^\.BR .*)$/ {
	if (sa==1)
	    no=1;
	next
    }
    /\.\\"/ {next}
    /.*/ {
	if (sa==1) {
	    print; next
	}
    }

' $f; done | grep Missing
Missing comma in man1/memusage.1 +272
Missing comma in man2/adjtimex.2 +597
Missing comma in man2/adjtimex.2 +598
Missing comma in man2/mkdir.2 +252
Missing comma in man2/sigaction.2 +1045
Missing comma in man2/sigaction.2 +1047
Missing comma in man3/mbsnrtowcs.3 +198
Missing comma in man3/ntp_gettime.3 +142
Missing comma in man3/strcmp.3 +219
Missing comma in man3/strtol.3 +302
Missing comma in man3/wcstombs.3 +120
Missing comma in man7/user_namespaces.7 +1378
Missing comma in man7/xattr.7 +198

---
 man1/memusage.1        | 2 +-
 man2/adjtimex.2        | 4 ++--
 man2/mkdir.2           | 2 +-
 man2/sigaction.2       | 4 ++--
 man3/mbsnrtowcs.3      | 2 +-
 man3/ntp_gettime.3     | 2 +-
 man3/strcmp.3          | 2 +-
 man3/strtol.3          | 2 +-
 man3/wcstombs.3        | 2 +-
 man7/user_namespaces.7 | 2 +-
 man7/xattr.7           | 2 +-
 11 files changed, 13 insertions(+), 13 deletions(-)
man1/memusage.1 +1 -1
index 9cc06838b..aa5739eb0 100644
@@ -269,5 +269,5 @@ main(int argc, char *argv[])
 .EE
 .SH SEE ALSO
 .BR memusagestat (1),
-.BR mtrace (1)
+.BR mtrace (1),
 .BR ld.so (8)
man2/adjtimex.2 +2 -2
index 1722369a1..d802d52f9 100644
@@ -594,8 +594,8 @@ is done by the kernel in timer context.
 Thus, it will take one tick into the second
 for the leap second to be inserted or deleted.
 .SH SEE ALSO
-.BR clock_gettime (2)
-.BR clock_settime (2)
+.BR clock_gettime (2),
+.BR clock_settime (2),
 .BR settimeofday (2),
 .BR adjtime (3),
 .BR ntp_gettime (3),
man2/mkdir.2 +1 -1
index 12b131270..959169cad 100644
@@ -249,5 +249,5 @@ argument.
 .BR stat (2),
 .BR umask (2),
 .BR unlink (2),
-.BR acl (5)
+.BR acl (5),
 .BR path_resolution (7)
man2/sigaction.2 +2 -2
index b4e630878..744cdfcc4 100644
@@ -1042,9 +1042,9 @@ See
 .BR kill (1),
 .BR kill (2),
 .BR pause (2),
-.BR pidfd_send_signal (2)
+.BR pidfd_send_signal (2),
 .BR restart_syscall (2),
-.BR seccomp (2)
+.BR seccomp (2),
 .BR sigaltstack (2),
 .BR signal (2),
 .BR signalfd (2),
man3/mbsnrtowcs.3 +1 -1
index 2e5420305..2e447bac8 100644
@@ -195,6 +195,6 @@ Passing NULL as
 is not multithread safe.
 .SH SEE ALSO
 .BR iconv (3),
-.BR mbrtowc (3)
+.BR mbrtowc (3),
 .BR mbsinit (3),
 .BR mbsrtowcs (3)
man3/ntp_gettime.3 +1 -1
index ff54a1ee0..be80b4801 100644
@@ -139,7 +139,7 @@ is described in the NTP Kernel Application Program Interface.
 .BR ntp_gettimex ()
 is a GNU extension.
 .SH SEE ALSO
-.BR adjtimex (2)
+.BR adjtimex (2),
 .BR ntp_adjtime (3),
 .BR time (7)
 .PP
man3/strcmp.3 +1 -1
index dd187be22..f1046f2e3 100644
@@ -216,5 +216,5 @@ main(int argc, char *argv[])
 .BR strncasecmp (3),
 .BR strverscmp (3),
 .BR wcscmp (3),
-.BR wcsncmp (3)
+.BR wcsncmp (3),
 .BR ascii (7)
man3/strtol.3 +1 -1
index 960f61b3e..02598b983 100644
@@ -299,5 +299,5 @@ main(int argc, char *argv[])
 .BR atoi (3),
 .BR atol (3),
 .BR strtod (3),
-.BR strtoimax (3)
+.BR strtoimax (3),
 .BR strtoul (3),
man3/wcstombs.3 +1 -1
index 8b3ca7d6f..749cc7b26 100644
@@ -117,5 +117,5 @@ provides a better interface to the same functionality.
 .BR mblen (3),
 .BR mbstowcs (3),
 .BR mbtowc (3),
-.BR wcsrtombs (3)
+.BR wcsrtombs (3),
 .BR wctomb (3)
man7/user_namespaces.7 +1 -1
index 0f2c89184..1975daf5e 100644
@@ -1375,7 +1375,7 @@ main(int argc, char *argv[])
 .BR subgid (5),         \" From the shadow package
 .BR subuid (5),         \" From the shadow package
 .BR capabilities (7),
-.BR cgroup_namespaces (7)
+.BR cgroup_namespaces (7),
 .BR credentials (7),
 .BR namespaces (7),
 .BR pid_namespaces (7)
man7/xattr.7 +1 -1
index 706dfa344..23a928c1b 100644
@@ -195,5 +195,5 @@ This page was formerly named
 .BR removexattr (2),
 .BR setxattr (2),
 .BR acl (5),
-.BR capabilities (7)
+.BR capabilities (7),
 .BR selinux (8)
Signature · 1 line
2.26.2
#1 lore raw

Hello Kir,

Quoted 34 lines · Kir Kolyshkin

This is a sequel to commit baf17bc4f2a3f3b02d, addressing the issues with missing commas in the middle of SEE ALSO lists that emerged since.

The awk script from the original commit was not working and had to be slightly modified (s/["]SEE ALSO["]/"?SEE ALSO/), otherwise it works like a charm. Here's the fixed script and its output just before this commit:

for f in man*/*; do
awk '

    /^.SH "?SEE ALSO/ {
	sa=1; print "== " FILENAME " =="; print; next
    }
    /^\.(PP|SH)/ {
	sa=0; no=0; next
    }
    /^\.BR/ {
	if (sa==1) {
	    print;
	    if (no == 1)
		print "Missing comma in " FILENAME " +" FNR-1; no=0
	}
    }
    /^\.BR .*)$/ {
	if (sa==1)
	    no=1;
	next
    }
    /\.\\"/ {next}
    /.*/ {
	if (sa==1) {
	    print; next
	}
    }
Quoted 14 lines

' $f; done | grep Missing
Missing comma in man1/memusage.1 +272
Missing comma in man2/adjtimex.2 +597
Missing comma in man2/adjtimex.2 +598
Missing comma in man2/mkdir.2 +252
Missing comma in man2/sigaction.2 +1045
Missing comma in man2/sigaction.2 +1047
Missing comma in man3/mbsnrtowcs.3 +198
Missing comma in man3/ntp_gettime.3 +142
Missing comma in man3/strcmp.3 +219
Missing comma in man3/strtol.3 +302
Missing comma in man3/wcstombs.3 +120
Missing comma in man7/user_namespaces.7 +1378
Missing comma in man7/xattr.7 +198

Thanks for that! Patch applied!

Cheers,

Michael

Quoted 151 lines
---
 man1/memusage.1        | 2 +-
 man2/adjtimex.2        | 4 ++--
 man2/mkdir.2           | 2 +-
 man2/sigaction.2       | 4 ++--
 man3/mbsnrtowcs.3      | 2 +-
 man3/ntp_gettime.3     | 2 +-
 man3/strcmp.3          | 2 +-
 man3/strtol.3          | 2 +-
 man3/wcstombs.3        | 2 +-
 man7/user_namespaces.7 | 2 +-
 man7/xattr.7           | 2 +-
 11 files changed, 13 insertions(+), 13 deletions(-)
man1/memusage.1 +1 -1
index 9cc06838b..aa5739eb0 100644
@@ -269,5 +269,5 @@ main(int argc, char *argv[])
 .EE
 .SH SEE ALSO
 .BR memusagestat (1),
-.BR mtrace (1)
+.BR mtrace (1),
 .BR ld.so (8)
man2/adjtimex.2 +2 -2
index 1722369a1..d802d52f9 100644
@@ -594,8 +594,8 @@ is done by the kernel in timer context.
 Thus, it will take one tick into the second
 for the leap second to be inserted or deleted.
 .SH SEE ALSO
-.BR clock_gettime (2)
-.BR clock_settime (2)
+.BR clock_gettime (2),
+.BR clock_settime (2),
 .BR settimeofday (2),
 .BR adjtime (3),
 .BR ntp_gettime (3),
man2/mkdir.2 +1 -1
index 12b131270..959169cad 100644
@@ -249,5 +249,5 @@ argument.
 .BR stat (2),
 .BR umask (2),
 .BR unlink (2),
-.BR acl (5)
+.BR acl (5),
 .BR path_resolution (7)
man2/sigaction.2 +2 -2
index b4e630878..744cdfcc4 100644
@@ -1042,9 +1042,9 @@ See
 .BR kill (1),
 .BR kill (2),
 .BR pause (2),
-.BR pidfd_send_signal (2)
+.BR pidfd_send_signal (2),
 .BR restart_syscall (2),
-.BR seccomp (2)
+.BR seccomp (2),
 .BR sigaltstack (2),
 .BR signal (2),
 .BR signalfd (2),
man3/mbsnrtowcs.3 +1 -1
index 2e5420305..2e447bac8 100644
@@ -195,6 +195,6 @@ Passing NULL as
 is not multithread safe.
 .SH SEE ALSO
 .BR iconv (3),
-.BR mbrtowc (3)
+.BR mbrtowc (3),
 .BR mbsinit (3),
 .BR mbsrtowcs (3)
man3/ntp_gettime.3 +1 -1
index ff54a1ee0..be80b4801 100644
@@ -139,7 +139,7 @@ is described in the NTP Kernel Application Program Interface.
 .BR ntp_gettimex ()
 is a GNU extension.
 .SH SEE ALSO
-.BR adjtimex (2)
+.BR adjtimex (2),
 .BR ntp_adjtime (3),
 .BR time (7)
 .PP
man3/strcmp.3 +1 -1
index dd187be22..f1046f2e3 100644
@@ -216,5 +216,5 @@ main(int argc, char *argv[])
 .BR strncasecmp (3),
 .BR strverscmp (3),
 .BR wcscmp (3),
-.BR wcsncmp (3)
+.BR wcsncmp (3),
 .BR ascii (7)
man3/strtol.3 +1 -1
index 960f61b3e..02598b983 100644
@@ -299,5 +299,5 @@ main(int argc, char *argv[])
 .BR atoi (3),
 .BR atol (3),
 .BR strtod (3),
-.BR strtoimax (3)
+.BR strtoimax (3),
 .BR strtoul (3),
man3/wcstombs.3 +1 -1
index 8b3ca7d6f..749cc7b26 100644
@@ -117,5 +117,5 @@ provides a better interface to the same functionality.
 .BR mblen (3),
 .BR mbstowcs (3),
 .BR mbtowc (3),
-.BR wcsrtombs (3)
+.BR wcsrtombs (3),
 .BR wctomb (3)
man7/user_namespaces.7 +1 -1
index 0f2c89184..1975daf5e 100644
@@ -1375,7 +1375,7 @@ main(int argc, char *argv[])
 .BR subgid (5),         \" From the shadow package
 .BR subuid (5),         \" From the shadow package
 .BR capabilities (7),
-.BR cgroup_namespaces (7)
+.BR cgroup_namespaces (7),
 .BR credentials (7),
 .BR namespaces (7),
 .BR pid_namespaces (7)
man7/xattr.7 +1 -1
index 706dfa344..23a928c1b 100644
@@ -195,5 +195,5 @@ This page was formerly named
 .BR removexattr (2),
 .BR setxattr (2),
 .BR acl (5),
-.BR capabilities (7)
+.BR capabilities (7),
 .BR selinux (8)
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/