Wed Mar 6 21:26:46 2013 UTC ()
Warn about unknown libraries. Bump version to 1.19.


(wiz)
diff -r1.25 -r1.26 pkgsrc/textproc/mdoclint/Makefile
diff -r1.21 -r1.22 pkgsrc/textproc/mdoclint/files/mdoclint
diff -r1.6 -r1.7 pkgsrc/textproc/mdoclint/files/mdoclint.1

cvs diff -r1.25 -r1.26 pkgsrc/textproc/mdoclint/Attic/Makefile (expand / switch to unified diff)

--- pkgsrc/textproc/mdoclint/Attic/Makefile 2013/01/01 01:42:08 1.25
+++ pkgsrc/textproc/mdoclint/Attic/Makefile 2013/03/06 21:26:45 1.26
@@ -1,16 +1,16 @@ @@ -1,16 +1,16 @@
1# $NetBSD: Makefile,v 1.25 2013/01/01 01:42:08 jnemeth Exp $ 1# $NetBSD: Makefile,v 1.26 2013/03/06 21:26:45 wiz Exp $
2 2
3DISTNAME= mdoclint-1.18 3DISTNAME= mdoclint-1.19
4CATEGORIES= textproc 4CATEGORIES= textproc
5MASTER_SITES= # none 5MASTER_SITES= # none
6DISTFILES= # none 6DISTFILES= # none
7 7
8OWNER= wiz@NetBSD.org 8OWNER= wiz@NetBSD.org
9#HOMEPAGE= # 9#HOMEPAGE= #
10COMMENT= Tool for verifying man pages 10COMMENT= Tool for verifying man pages
11LICENSE= 2-clause-bsd 11LICENSE= 2-clause-bsd
12 12
13INSTALLATION_DIRS= bin ${PKGMANDIR}/man1 13INSTALLATION_DIRS= bin ${PKGMANDIR}/man1
14 14
15CONFLICTS= mdocml<1.6.9 15CONFLICTS= mdocml<1.6.9
16 16

cvs diff -r1.21 -r1.22 pkgsrc/textproc/mdoclint/files/Attic/mdoclint (expand / switch to unified diff)

--- pkgsrc/textproc/mdoclint/files/Attic/mdoclint 2013/01/01 01:42:08 1.21
+++ pkgsrc/textproc/mdoclint/files/Attic/mdoclint 2013/03/06 21:26:45 1.22
@@ -1,19 +1,19 @@ @@ -1,19 +1,19 @@
1#!@PERL5@ 1#!@PERL5@
2# 2#
3# $OpenBSD: mdoclint,v 1.14 2009/04/13 12:40:05 espie Exp $ 3# $OpenBSD: mdoclint,v 1.14 2009/04/13 12:40:05 espie Exp $
4# $NetBSD: mdoclint,v 1.21 2013/01/01 01:42:08 jnemeth Exp $ 4# $NetBSD: mdoclint,v 1.22 2013/03/06 21:26:45 wiz Exp $
5# 5#
6# Copyright (c) 2001-2012 Thomas Klausner 6# Copyright (c) 2001-2013 Thomas Klausner
7# All rights reserved. 7# All rights reserved.
8# 8#
9# Redistribution and use in source and binary forms, with or without 9# Redistribution and use in source and binary forms, with or without
10# modification, are permitted provided that the following conditions 10# modification, are permitted provided that the following conditions
11# are met: 11# are met:
12# 1. Redistributions of source code must retain the above copyright 12# 1. Redistributions of source code must retain the above copyright
13# notice, this list of conditions and the following disclaimer. 13# notice, this list of conditions and the following disclaimer.
14# 2. Redistributions in binary form must reproduce the above copyright 14# 2. Redistributions in binary form must reproduce the above copyright
15# notice, this list of conditions and the following disclaimer in the 15# notice, this list of conditions and the following disclaimer in the
16# documentation and/or other materials provided with the distribution. 16# documentation and/or other materials provided with the distribution.
17# 17#
18# THIS SOFTWARE IS PROVIDED BY THE AUTHOR, THOMAS KLAUSNER, 18# THIS SOFTWARE IS PROVIDED BY THE AUTHOR, THOMAS KLAUSNER,
19# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 19# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
@@ -32,77 +32,132 @@ use strict; @@ -32,77 +32,132 @@ use strict;
32use warnings; 32use warnings;
33 33
34$| = 1; 34$| = 1;
35 35
36package Parser; 36package Parser;
37use Getopt::Std; 37use Getopt::Std;
38 38
39use constant { 39use constant {
40 OPENBSD => 0, 40 OPENBSD => 0,
41 NETBSD => 1 41 NETBSD => 1
42}; 42};
43 43
44use vars qw( 44use vars qw(
45 $opt_A $opt_a $opt_D $opt_d $opt_e $opt_F $opt_f $opt_H $opt_h $opt_m 45 $opt_A $opt_a $opt_D $opt_d $opt_e $opt_F $opt_f $opt_H $opt_h $opt_l
 46 $opt_m
46 $opt_n $opt_O $opt_o $opt_P $opt_p $opt_r $opt_S $opt_s $opt_v $opt_w 47 $opt_n $opt_O $opt_o $opt_P $opt_p $opt_r $opt_S $opt_s $opt_v $opt_w
47 $opt_X $opt_x 48 $opt_X $opt_x
48); 49);
49 50
50 51
51my $arch=`uname -m`; 52my $arch=`uname -m`;
52chomp($arch); 53chomp($arch);
53my $options="AaDdeFfHhmnOoPprSsvwXx"; 54my $options="AaDdeFfHhlmnOoPprSsvwXx";
54 55
55sub usage 56sub usage
56 { 57 {
57 my $default = OPENBSD ? "-aDdfmnoPprSsXx" : "-aDdefmnoPprSsXx"; 58 my $default = OPENBSD ? "-aDdfmnoPprSsXx" : "-aDdefmnoPprSsXx";
58  59
59 print STDERR <<"EOF"; 60 print STDERR <<"EOF";
60mdoclint: verify man page correctness 61mdoclint: verify man page correctness
61usage: mdoclint [-$options] file ... 62usage: mdoclint [-$options] file ...
62 -A warn about missing .An in AUTHORS section 63 -A warn about missing .An in AUTHORS section
63 -a warn about SEE ALSO section problems 64 -a warn about SEE ALSO section problems
64 -D warn about bad casing and archs in .Dt 65 -D warn about bad casing and archs in .Dt
65 -d warn about bad date strings (in .Dd only) 66 -d warn about bad date strings (in .Dd only)
66 -e warn about unsorted errors (for functions) 67 -e warn about unsorted errors (for functions)
67 -F fix whitespace problems (asks before overwriting) 68 -F fix whitespace problems (asks before overwriting)
68 -f warn about possible incorrect .Fn syntax 69 -f warn about possible incorrect .Fn syntax
69 -H warn about characters that produce problems in HTML output 70 -H warn about characters that produce problems in HTML output
70 -h display this help text 71 -h display this help text
 72 -l warn about unknown libraries
71 -m warn about man pages that are not in mdoc(7) format 73 -m warn about man pages that are not in mdoc(7) format
72 -n warn about .Nd's ending in '.' 74 -n warn about .Nd's ending in '.'
73 -O warn about unsorted .It arguments 75 -O warn about unsorted .It arguments
74 -o warn about non-empty .Os strings 76 -o warn about non-empty .Os strings
75 -P warn about paragraph problems 77 -P warn about paragraph problems
76 -p warn about punctuation problems 78 -p warn about punctuation problems
77 -r warn about missing RCS Id 79 -r warn about missing RCS Id
78 -S warn about any .Sh weirdness 80 -S warn about any .Sh weirdness
79 -s warn about whitespace problems 81 -s warn about whitespace problems
80 -v verbose output 82 -v verbose output
81 -w show section header in warnings 83 -w show section header in warnings
82 -X warn about explicit mentions of FreeBSD, NetBSD, or OpenBSD 84 -X warn about explicit mentions of FreeBSD, NetBSD, or OpenBSD
83 -x warn about cross-references with missing targets 85 -x warn about cross-references with missing targets
84Default is $default if no flag is specified. 86Default is $default if no flag is specified.
85EOF 87EOF
86 exit(0); 88 exit(0);
87} 89}
88 90
89 91
90my %short = ( 92my %short = (
91 "Free" => ".Fx", 93 "Free" => ".Fx",
92 "Net" => ".Nx", 94 "Net" => ".Nx",
93 "Open" => ".Ox" 95 "Open" => ".Ox"
94); 96);
95 97
 98my %libraries = (
 99 "libarchive" => 1,
 100 "libarm" => 1,
 101 "libarm32" => 1,
 102 "libbluetooth" => 1,
 103 "libc" => 1,
 104 "libcdk" => 1,
 105 "libcompat" => 1,
 106 "libcrypt" => 1,
 107 "libcurses" => 1,
 108 "libdm" => 1,
 109 "libedit" => 1,
 110 "libelf" => 1,
 111 "libevent" => 1,
 112 "libexecinfo" => 1,
 113 "libfetch" => 1,
 114 "libform" => 1,
 115 "libi386" => 1,
 116 "libintl" => 1,
 117 "libipsec" => 1,
 118 "libiscsi" => 1,
 119 "libisns" => 1,
 120 "libkvm" => 1,
 121 "libm" => 1,
 122 "libm68k" => 1,
 123 "libmagic" => 1,
 124 "libmenu" => 1,
 125 "libnetpgp" => 1,
 126 "libossaudio" => 1,
 127 "libpam" => 1,
 128 "libpcap" => 1,
 129 "libpci" => 1,
 130 "libperfuse" => 1,
 131 "libpmc" => 1,
 132 "libposix" => 1,
 133 "libppath" => 1,
 134 "libprop" => 1,
 135 "libpthread" => 1,
 136 "libpuffs" => 1,
 137 "libquota" => 1,
 138 "librefuse" => 1,
 139 "libresolv" => 1,
 140 "librt" => 1,
 141 "libsaslc" => 1,
 142 "libssp" => 1,
 143 "libtermcap" => 1,
 144 "libterminfo" => 1,
 145 "libusbhid" => 1,
 146 "libutil" => 1,
 147 "libx86_64" => 1,
 148 "libz" => 1
 149);
 150
96# constants to build 151# constants to build
97my %sections; 152my %sections;
98my $arches_re; 153my $arches_re;
99my $sections_re; 154my $sections_re;
100my $esections_re; 155my $esections_re;
101my $valid_date_re; 156my $valid_date_re;
102# and the code that builds them 157# and the code that builds them
103{ 158{
104 my @sections = ( 159 my @sections = (
105 "NAME", 160 "NAME",
106 NETBSD ? "LIBRARY" : undef, 161 NETBSD ? "LIBRARY" : undef,
107 "SYNOPSIS", 162 "SYNOPSIS",
108 "DESCRIPTION", 163 "DESCRIPTION",
@@ -196,33 +251,34 @@ sub forder { @@ -196,33 +251,34 @@ sub forder {
196 if($c){ return $c }; 251 if($c){ return $c };
197 } 252 }
198 return (length($a) <=> length($b)); 253 return (length($a) <=> length($b));
199} 254}
200 255
201 256
202sub handle_options 257sub handle_options
203{ 258{
204 getopts($options); 259 getopts($options);
205 $opt_h and usage(); 260 $opt_h and usage();
206 261
207 # default to all warnings if no flag is set 262 # default to all warnings if no flag is set
208 unless ($opt_A or $opt_a or $opt_D or $opt_d or $opt_e 263 unless ($opt_A or $opt_a or $opt_D or $opt_d or $opt_e
209 or $opt_f or $opt_H or $opt_m or $opt_n or $opt_O 264 or $opt_f or $opt_H or $opt_l
 265 or $opt_m or $opt_n or $opt_O
210 or $opt_o or $opt_P or $opt_p or $opt_r 266 or $opt_o or $opt_P or $opt_p or $opt_r
211 or $opt_S or $opt_s or $opt_X or $opt_x) { 267 or $opt_S or $opt_s or $opt_X or $opt_x) {
212 $opt_A = $opt_a = $opt_D = $opt_d = $opt_f = $opt_m = 268 $opt_A = $opt_a = $opt_D = $opt_d = $opt_f = $opt_m =
213 $opt_n = $opt_O = $opt_o = $opt_P = $opt_p = $opt_r = $opt_S = 269 $opt_n = $opt_O = $opt_o = $opt_P = $opt_p = $opt_r = $opt_S =
214 $opt_s = $opt_X = $opt_x = 1; 270 $opt_s = $opt_X = $opt_x = 1;
215 $opt_e = 1 if NETBSD; 271 $opt_e = $opt_l = 1 if NETBSD;
216 } 272 }
217} 273}
218 274
219 275
220sub verify_xref 276sub verify_xref
221{ 277{
222 my ($self, $page, $section, $pre, $post) = @_; 278 my ($self, $page, $section, $pre, $post) = @_;
223 if ("$page.$section" eq $self->{fn}) { 279 if ("$page.$section" eq $self->{fn}) {
224 $self->warning("Xref to itself (use .Nm instead)") if $opt_x; 280 $self->warning("Xref to itself (use .Nm instead)") if $opt_x;
225 } 281 }
226 # try to find corresponding man page 282 # try to find corresponding man page
227 for my $dir ("/usr/share/man", 283 for my $dir ("/usr/share/man",
228 OPENBSD ? "/usr/X11R6/man" : "/usr/X11R7/man") { 284 OPENBSD ? "/usr/X11R6/man" : "/usr/X11R7/man") {
@@ -451,26 +507,31 @@ sub process_line @@ -451,26 +507,31 @@ sub process_line
451 507
452 if (/\b(Free|Net|Open)BSD\b/o 508 if (/\b(Free|Net|Open)BSD\b/o
453 and not /\b(?:www|ftp)\.(?:Free|Net|Open)BSD\.org\b/o 509 and not /\b(?:www|ftp)\.(?:Free|Net|Open)BSD\.org\b/o
454 and not /\bOpenBSD\::.*3p\b/o 510 and not /\bOpenBSD\::.*3p\b/o
455 and not /\/pub\/OpenBSD\//o 511 and not /\/pub\/OpenBSD\//o
456 and not /\@(?:Free|Net|Open)BSD\.(?i:org)\b/o) { 512 and not /\@(?:Free|Net|Open)BSD\.(?i:org)\b/o) {
457 $s->warning("verbose mention of `$1BSD' instead of " 513 $s->warning("verbose mention of `$1BSD' instead of "
458 . "`$short{$1}': `$_'") if $opt_X; 514 . "`$short{$1}': `$_'") if $opt_X;
459 } 515 }
460 if (/^\./o and (/Bx (Open)/o or /Bx (Free)/o or /Bx (Net)/o)) { 516 if (/^\./o and (/Bx (Open)/o or /Bx (Free)/o or /Bx (Net)/o)) {
461 $s->warning("`.Bx $1' found -- use $short{$1} instead") 517 $s->warning("`.Bx $1' found -- use $short{$1} instead")
462 if $opt_X; 518 if $opt_X;
463 } 519 }
 520 if (/^\.Lb\s+(\S+)/o) {
 521 if (not $libraries{$1}) {
 522 $s->warning("Unknown library `$1' used as Lb argument") if $opt_l;
 523 }
 524 }
464 if (/^\.Os\s+(.+)/o) { 525 if (/^\.Os\s+(.+)/o) {
465 $s->warning(".Os used with argument `$1'") if $opt_o; 526 $s->warning(".Os used with argument `$1'") if $opt_o;
466 } 527 }
467 528
468 if (/^\.Nd.*\.$/o) { 529 if (/^\.Nd.*\.$/o) {
469 $s->warning(".Nd ends with a dot: `$_'") if $opt_n; 530 $s->warning(".Nd ends with a dot: `$_'") if $opt_n;
470 } 531 }
471 532
472 if (/\w\w\.\s+[A-Z]/o) { 533 if (/\w\w\.\s+[A-Z]/o) {
473 $s->warning("new sentence, new line: `$_'") if $opt_p; 534 $s->warning("new sentence, new line: `$_'") if $opt_p;
474 } 535 }
475 if (/^\... .*[^\s][\.();,\[\]\{\}:]$/o 536 if (/^\... .*[^\s][\.();,\[\]\{\}:]$/o
476 and not /\s\.\.\.$/o and not /\\&.$/o) { 537 and not /\s\.\.\.$/o and not /\\&.$/o) {

cvs diff -r1.6 -r1.7 pkgsrc/textproc/mdoclint/files/Attic/mdoclint.1 (expand / switch to unified diff)

--- pkgsrc/textproc/mdoclint/files/Attic/mdoclint.1 2012/02/22 15:31:35 1.6
+++ pkgsrc/textproc/mdoclint/files/Attic/mdoclint.1 2013/03/06 21:26:45 1.7
@@ -1,49 +1,49 @@ @@ -1,49 +1,49 @@
1.\" $OpenBSD: mdoclint.1,v 1.7 2009/04/13 19:06:38 jmc Exp $ 1.\" $OpenBSD: mdoclint.1,v 1.7 2009/04/13 19:06:38 jmc Exp $
2.\" $NetBSD: mdoclint.1,v 1.6 2012/02/22 15:31:35 wiz Exp $ 2.\" $NetBSD: mdoclint.1,v 1.7 2013/03/06 21:26:45 wiz Exp $
3.\" 3.\"
4.\" Copyright (c) 2001-2011 Thomas Klausner 4.\" Copyright (c) 2001-2013 Thomas Klausner
5.\" All rights reserved. 5.\" All rights reserved.
6.\" 6.\"
7.\" Redistribution and use in source and binary forms, with or without 7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions 8.\" modification, are permitted provided that the following conditions
9.\" are met: 9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright 10.\" 1. Redistributions of source code must retain the above copyright
11.\" notice, this list of conditions and the following disclaimer. 11.\" notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\" notice, this list of conditions and the following disclaimer in the 13.\" notice, this list of conditions and the following disclaimer in the
14.\" documentation and/or other materials provided with the distribution. 14.\" documentation and/or other materials provided with the distribution.
15.\" 15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR, THOMAS KLAUSNER, 16.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR, THOMAS KLAUSNER,
17.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 19.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26.\" POSSIBILITY OF SUCH DAMAGE. 26.\" POSSIBILITY OF SUCH DAMAGE.
27.\" 27.\"
28.Dd September 26, 2011 28.Dd March 6, 2013
29.Dt MDOCLINT 1 29.Dt MDOCLINT 1
30.Os 30.Os
31.Sh NAME 31.Sh NAME
32.Nm mdoclint 32.Nm mdoclint
33.Nd man page verifier 33.Nd man page verifier
34.Sh SYNOPSIS 34.Sh SYNOPSIS
35.Nm 35.Nm
36.Op Fl AaDdeFfHhmnOoPprSsvwXx 36.Op Fl AaDdeFfHhlmnOoPprSsvwXx
37.Ar 37.Ar
38.Sh DESCRIPTION 38.Sh DESCRIPTION
39.Nm 39.Nm
40is a man page verifier. 40is a man page verifier.
41It tries to automatically find as many common 41It tries to automatically find as many common
42errors that occur when writing man pages as possible. 42errors that occur when writing man pages as possible.
43If no flags are given, 43If no flags are given,
44.Fl aDdefmnoPprSsXx 44.Fl aDdefmnoPprSsXx
45is assumed (that is, everything except 45is assumed (that is, everything except
46.Fl FHhvw ) . 46.Fl FHhvw ) .
47.Pp 47.Pp
48The options are as follows: 48The options are as follows:
49.Bl -tag -width xxxx -compact 49.Bl -tag -width xxxx -compact
@@ -80,26 +80,28 @@ HTML output: @@ -80,26 +80,28 @@ HTML output:
80.Sq \*[Gt] , 80.Sq \*[Gt] ,
81and 81and
82.Sq \*[Am] . 82.Sq \*[Am] .
83Replace a pair of angle quotes with the .Aq macro. 83Replace a pair of angle quotes with the .Aq macro.
84Otherwise, the replacements are 84Otherwise, the replacements are
85.Dq \e*[Lt] , 85.Dq \e*[Lt] ,
86.Dq \e*[Gt] , 86.Dq \e*[Gt] ,
87and 87and
88.Dq \e*[Am] . 88.Dq \e*[Am] .
89This option is off by default, 89This option is off by default,
90as these characters no longer pose any problems. 90as these characters no longer pose any problems.
91.It Fl h 91.It Fl h
92Display usage. 92Display usage.
 93.It Fl l
 94Warn about unknown libraries used as arguments to Lb.
93.It Fl m 95.It Fl m
94Warn if man page is not in 96Warn if man page is not in
95.Xr mdoc 7 97.Xr mdoc 7
96format. 98format.
97.It Fl n 99.It Fl n
98Warn when the .Nd macro's argument ends in a dot, that is 100Warn when the .Nd macro's argument ends in a dot, that is
99.Sq \&. . 101.Sq \&. .
100.It Fl O 102.It Fl O
101Warn about unsorted 103Warn about unsorted
102.Dq .It 104.Dq .It
103macros. 105macros.
104.It Fl o 106.It Fl o
105Warn when the .Os macro has an argument (it shouldn't have one at 107Warn when the .Os macro has an argument (it shouldn't have one at