| @@ -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.39 2013/08/02 13:16:54 wiz Exp $ | | 4 | # $NetBSD: mdoclint,v 1.40 2013/08/05 10:08:25 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 | # |
| @@ -64,27 +64,26 @@ mdoclint: verify man page correctness | | | @@ -64,27 +64,26 @@ 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 |
75 | -m warn about man pages that are not in mdoc(7) format | | 75 | -m warn about man pages that are not in mdoc(7) format |
76 | -n warn about .Nd's ending in '.' | | 76 | -n warn about .Nd's ending in '.' |
77 | -O warn about unsorted .It arguments | | | |
78 | -o warn about non-empty .Os strings | | 77 | -o warn about non-empty .Os strings |
79 | -P warn about paragraph problems | | 78 | -P warn about paragraph problems |
80 | -p warn about punctuation problems | | 79 | -p warn about punctuation problems |
81 | -r warn about missing RCS Id | | 80 | -r warn about missing RCS Id |
82 | -S warn about any .Sh weirdness | | 81 | -S warn about any .Sh weirdness |
83 | -s warn about whitespace problems | | 82 | -s warn about whitespace problems |
84 | -v verbose output | | 83 | -v verbose output |
85 | -w show section header in warnings | | 84 | -w show section header in warnings |
86 | -X warn about explicit mentions of FreeBSD, NetBSD, or OpenBSD | | 85 | -X warn about explicit mentions of FreeBSD, NetBSD, or OpenBSD |
87 | -x warn about cross-references with missing targets | | 86 | -x warn about cross-references with missing targets |
88 | Default is $default if no flag is specified. | | 87 | Default is $default if no flag is specified. |
89 | EOF | | 88 | EOF |
90 | exit(0); | | 89 | exit(0); |
| @@ -235,30 +234,26 @@ sub debug | | | @@ -235,30 +234,26 @@ sub debug |
235 | print STDOUT "debug: $self->{fn}:$self->{ln}: @_\n" if $opt_v; | | 234 | print STDOUT "debug: $self->{fn}:$self->{ln}: @_\n" if $opt_v; |
236 | } | | 235 | } |
237 | | | 236 | |
238 | sub warning | | 237 | sub warning |
239 | { | | 238 | { |
240 | my $self = shift; | | 239 | my $self = shift; |
241 | my $extra = ""; | | 240 | my $extra = ""; |
242 | if ($opt_w) { | | 241 | if ($opt_w) { |
243 | $extra = $self->{current_section_header}.":"; | | 242 | $extra = $self->{current_section_header}.":"; |
244 | } | | 243 | } |
245 | print STDOUT "$self->{fn}:$extra$self->{ln}: ", join('', @_), "\n"; | | 244 | print STDOUT "$self->{fn}:$extra$self->{ln}: ", join('', @_), "\n"; |
246 | } | | 245 | } |
247 | | | 246 | |
248 | my $order = " !\"#\$\%&'()*+,-./:;<=>?[\\]^_{|}~". | | | |
249 | "0123456789". | | | |
250 | "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz"; | | | |
251 | | | | |
252 | sub handle_options | | 247 | sub handle_options |
253 | { | | 248 | { |
254 | getopts($options); | | 249 | getopts($options); |
255 | $opt_h and usage(); | | 250 | $opt_h and usage(); |
256 | | | 251 | |
257 | # default to all warnings if no flag is set | | 252 | # default to all warnings if no flag is set |
258 | unless ($opt_A or $opt_a or $opt_D or $opt_d or $opt_e | | 253 | unless ($opt_A or $opt_a or $opt_D or $opt_d or $opt_e |
259 | or $opt_f or $opt_H or $opt_l | | 254 | or $opt_f or $opt_H or $opt_l |
260 | or $opt_m or $opt_n | | 255 | or $opt_m or $opt_n |
261 | or $opt_o or $opt_P or $opt_p or $opt_r | | 256 | or $opt_o or $opt_P or $opt_p or $opt_r |
262 | or $opt_S or $opt_s or $opt_X or $opt_x) { | | 257 | or $opt_S or $opt_s or $opt_X or $opt_x) { |
263 | $opt_A = $opt_a = $opt_D = $opt_d = $opt_f = $opt_m = | | 258 | $opt_A = $opt_a = $opt_D = $opt_d = $opt_f = $opt_m = |
264 | $opt_n = $opt_o = $opt_P = $opt_p = $opt_r = $opt_S = | | 259 | $opt_n = $opt_o = $opt_P = $opt_p = $opt_r = $opt_S = |