| @@ -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.38 2013/07/30 19:07:23 wiz Exp $ | | 4 | # $NetBSD: mdoclint,v 1.39 2013/08/02 13:16:54 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 | # |
| @@ -34,41 +34,41 @@ use warnings; | | | @@ -34,41 +34,41 @@ use warnings; |
34 | $| = 1; | | 34 | $| = 1; |
35 | | | 35 | |
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_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="AaDdeFfHhlmnoPprSsvwXx"; | | 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) |
70 | -F fix whitespace problems (asks before overwriting) | | 70 | -F fix whitespace problems (asks before overwriting) |
71 | -f warn about possible incorrect .Fn syntax | | 71 | -f warn about possible incorrect .Fn syntax |
72 | -H warn about characters that produce problems in HTML output | | 72 | -H warn about characters that produce problems in HTML output |
73 | -h display this help text | | 73 | -h display this help text |
74 | -l warn about unknown libraries | | 74 | -l warn about unknown libraries |
| @@ -368,27 +368,27 @@ sub end_of_section | | | @@ -368,27 +368,27 @@ sub end_of_section |
368 | if ($s->{in_section} == SECTION_AUTHORS) { | | 368 | if ($s->{in_section} == SECTION_AUTHORS) { |
369 | if (!$s->{an_found}) { | | 369 | if (!$s->{an_found}) { |
370 | $s->warning("missing .An in AUTHORS section") if $opt_A; | | 370 | $s->warning("missing .An in AUTHORS section") if $opt_A; |
371 | } | | 371 | } |
372 | } | | 372 | } |
373 | } | | 373 | } |
374 | | | 374 | |
375 | sub set_section_header | | 375 | sub set_section_header |
376 | { | | 376 | { |
377 | my ($s, $section_header) = @_; | | 377 | my ($s, $section_header) = @_; |
378 | $section_header = join(' ', $s->parse_macro_args($section_header)); | | 378 | $section_header = join(' ', $s->parse_macro_args($section_header)); |
379 | | | 379 | |
380 | end_of_section($s); | | 380 | end_of_section($s); |
381 | | | 381 | |
382 | if ($section_header eq 'SEE ALSO') { | | 382 | if ($section_header eq 'SEE ALSO') { |
383 | $s->{in_section} = SECTION_SEE_ALSO; | | 383 | $s->{in_section} = SECTION_SEE_ALSO; |
384 | } elsif ($section_header eq 'AUTHORS') { | | 384 | } elsif ($section_header eq 'AUTHORS') { |
385 | $s->{in_section} = SECTION_AUTHORS; | | 385 | $s->{in_section} = SECTION_AUTHORS; |
386 | } else { | | 386 | } else { |
387 | $s->{in_section} = 0; | | 387 | $s->{in_section} = 0; |
388 | } | | 388 | } |
389 | | | 389 | |
390 | if (not $sections{$section_header}) { | | 390 | if (not $sections{$section_header}) { |
391 | $s->warning("unknown section header: ", | | 391 | $s->warning("unknown section header: ", |
392 | "`$section_header'") if $opt_S; | | 392 | "`$section_header'") if $opt_S; |
393 | } else { | | 393 | } else { |
394 | if ($s->{lastsh} >= $sections{$section_header}) { | | 394 | if ($s->{lastsh} >= $sections{$section_header}) { |