| @@ -1,17 +1,17 @@ | | | @@ -1,17 +1,17 @@ |
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.35 2013/07/30 18:46:29 wiz Exp $ | | 4 | # $NetBSD: mdoclint,v 1.36 2013/07/30 18:50:07 wiz Exp $ |
5 | # | | 5 | # |
6 | # Copyright (c) 2001-2013 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 | # |
| @@ -36,34 +36,34 @@ $| = 1; | | | @@ -36,34 +36,34 @@ $| = 1; |
36 | package Parser; | | 36 | package Parser; |
37 | use Getopt::Std; | | 37 | use Getopt::Std; |
38 | | | 38 | |
39 | use constant { | | 39 | use constant { |
40 | OPENBSD => 0, | | 40 | OPENBSD => 0, |
41 | NETBSD => 1, | | 41 | NETBSD => 1, |
42 | SECTION_SEE_ALSO => 2, | | 42 | SECTION_SEE_ALSO => 2, |
43 | SECTION_AUTHORS => 3 | | 43 | SECTION_AUTHORS => 3 |
44 | }; | | 44 | }; |
45 | | | 45 | |
46 | use vars qw( | | 46 | use vars qw( |
47 | $opt_A $opt_a $opt_D $opt_d $opt_e $opt_F $opt_f $opt_H $opt_h $opt_l | | 47 | $opt_A $opt_a $opt_D $opt_d $opt_e $opt_F $opt_f $opt_H $opt_h $opt_l |
48 | $opt_m | | 48 | $opt_m |
49 | $opt_n $opt_O $opt_o $opt_P $opt_p $opt_r $opt_S $opt_s $opt_v $opt_w | | 49 | $opt_n $opt_o $opt_P $opt_p $opt_r $opt_S $opt_s $opt_v $opt_w |
50 | $opt_X $opt_x | | 50 | $opt_X $opt_x |
51 | ); | | 51 | ); |
52 | | | 52 | |
53 | | | 53 | |
54 | my $arch=`uname -m`; | | 54 | my $arch=`uname -m`; |
55 | chomp($arch); | | 55 | chomp($arch); |
56 | my $options="AaDdeFfHhlmnOoPprSsvwXx"; | | 56 | my $options="AaDdeFfHhlmnoPprSsvwXx"; |
57 | | | 57 | |
58 | sub usage | | 58 | sub usage |
59 | { | | 59 | { |
60 | my $default = OPENBSD ? "-AaDdfmnoPprSsXx" : "-AaDdeflmnoPprSsXx"; | | 60 | my $default = OPENBSD ? "-AaDdfmnoPprSsXx" : "-AaDdeflmnoPprSsXx"; |
61 | | | 61 | |
62 | print STDERR <<"EOF"; | | 62 | print STDERR <<"EOF"; |
63 | mdoclint: verify man page correctness | | 63 | mdoclint: verify man page correctness |
64 | usage: mdoclint [-$options] file ... | | 64 | usage: mdoclint [-$options] file ... |
65 | -A warn about missing .An in AUTHORS section | | 65 | -A warn about missing .An in AUTHORS section |
66 | -a warn about SEE ALSO section problems | | 66 | -a warn about SEE ALSO section problems |
67 | -D warn about bad casing and archs in .Dt | | 67 | -D warn about bad casing and archs in .Dt |
68 | -d warn about bad date strings (in .Dd only) | | 68 | -d warn about bad date strings (in .Dd only) |
69 | -e warn about unsorted errors (for functions) | | 69 | -e warn about unsorted errors (for functions) |
| @@ -260,31 +260,31 @@ sub forder { | | | @@ -260,31 +260,31 @@ sub forder { |
260 | } | | 260 | } |
261 | return (length($a) <=> length($b)); | | 261 | return (length($a) <=> length($b)); |
262 | } | | 262 | } |
263 | | | 263 | |
264 | | | 264 | |
265 | sub handle_options | | 265 | sub handle_options |
266 | { | | 266 | { |
267 | getopts($options); | | 267 | getopts($options); |
268 | $opt_h and usage(); | | 268 | $opt_h and usage(); |
269 | | | 269 | |
270 | # default to all warnings if no flag is set | | 270 | # default to all warnings if no flag is set |
271 | unless ($opt_A or $opt_a or $opt_D or $opt_d or $opt_e | | 271 | unless ($opt_A or $opt_a or $opt_D or $opt_d or $opt_e |
272 | or $opt_f or $opt_H or $opt_l | | 272 | or $opt_f or $opt_H or $opt_l |
273 | or $opt_m or $opt_n or $opt_O | | 273 | or $opt_m or $opt_n |
274 | or $opt_o or $opt_P or $opt_p or $opt_r | | 274 | or $opt_o or $opt_P or $opt_p or $opt_r |
275 | or $opt_S or $opt_s or $opt_X or $opt_x) { | | 275 | or $opt_S or $opt_s or $opt_X or $opt_x) { |
276 | $opt_A = $opt_a = $opt_D = $opt_d = $opt_f = $opt_m = | | 276 | $opt_A = $opt_a = $opt_D = $opt_d = $opt_f = $opt_m = |
277 | $opt_n = $opt_O = $opt_o = $opt_P = $opt_p = $opt_r = $opt_S = | | 277 | $opt_n = $opt_o = $opt_P = $opt_p = $opt_r = $opt_S = |
278 | $opt_s = $opt_X = $opt_x = 1; | | 278 | $opt_s = $opt_X = $opt_x = 1; |
279 | $opt_e = $opt_l = 1 if NETBSD; | | 279 | $opt_e = $opt_l = 1 if NETBSD; |
280 | } | | 280 | } |
281 | } | | 281 | } |
282 | | | 282 | |
283 | | | 283 | |
284 | sub verify_xref | | 284 | sub verify_xref |
285 | { | | 285 | { |
286 | my ($self, $page, $section, $pre, $post) = @_; | | 286 | my ($self, $page, $section, $pre, $post) = @_; |
287 | if ("$page.$section" eq $self->{fn}) { | | 287 | if ("$page.$section" eq $self->{fn}) { |
288 | $self->warning("Xref to itself (use .Nm instead)") if $opt_x; | | 288 | $self->warning("Xref to itself (use .Nm instead)") if $opt_x; |
289 | } | | 289 | } |
290 | # try to find corresponding man page | | 290 | # try to find corresponding man page |