summaryrefslogtreecommitdiff
path: root/textproc/mdoclint
diff options
context:
space:
mode:
authorwiz <wiz>2013-07-30 18:37:56 +0000
committerwiz <wiz>2013-07-30 18:37:56 +0000
commit60f595f8ea0fbe6c50d5f789a88a7ad6fc6e99a7 (patch)
treebd4a6451bbd7b064ef085e2a82d29291f6a5701b /textproc/mdoclint
parente5723bb70e44977052451980c7beca99a48b40f4 (diff)
downloadpkgsrc-60f595f8ea0fbe6c50d5f789a88a7ad6fc6e99a7.tar.gz
Fix -A support.
Diffstat (limited to 'textproc/mdoclint')
-rwxr-xr-xtextproc/mdoclint/files/mdoclint58
-rwxr-xr-xtextproc/mdoclint/files/mdoclint.14
2 files changed, 41 insertions, 21 deletions
diff --git a/textproc/mdoclint/files/mdoclint b/textproc/mdoclint/files/mdoclint
index 364c2fa2178..4a29a3383d0 100755
--- a/textproc/mdoclint/files/mdoclint
+++ b/textproc/mdoclint/files/mdoclint
@@ -1,7 +1,7 @@
#!@PERL5@
#
# $OpenBSD: mdoclint,v 1.14 2009/04/13 12:40:05 espie Exp $
-# $NetBSD: mdoclint,v 1.33 2013/06/02 11:58:36 wiz Exp $
+# $NetBSD: mdoclint,v 1.34 2013/07/30 18:37:56 wiz Exp $
#
# Copyright (c) 2001-2013 Thomas Klausner
# All rights reserved.
@@ -38,7 +38,9 @@ use Getopt::Std;
use constant {
OPENBSD => 0,
- NETBSD => 1
+ NETBSD => 1,
+ SECTION_SEE_ALSO => 2,
+ SECTION_AUTHORS => 3
};
use vars qw(
@@ -55,7 +57,7 @@ my $options="AaDdeFfHhlmnOoPprSsvwXx";
sub usage
{
- my $default = OPENBSD ? "-aDdfmnoPprSsXx" : "-aDdeflmnoPprSsXx";
+ my $default = OPENBSD ? "-AaDdfmnoPprSsXx" : "-AaDdeflmnoPprSsXx";
print STDERR <<"EOF";
mdoclint: verify man page correctness
@@ -315,7 +317,8 @@ sub new
sasection => 0,
saname => '',
sarest => ',',
- insa => 0,
+ inauthors => 0,
+ in_section => 0,
inliteral => 0,
shseen => {},
last_error_name => '',
@@ -364,22 +367,37 @@ sub parse_macro_args
return @params;
}
+sub end_of_section
+{
+ my ($s) = @_;
+
+ if ($s->{in_section} == SECTION_SEE_ALSO and not $s->{sarest} eq "") {
+ $s->warning("unneeded characters at end of SEE ALSO: ",
+ "`$s->{sarest}'") if $opt_a;
+ # to avoid a second warning at EOF
+ $s->{sarest} = "";
+ }
+
+ if ($s->{in_section} == SECTION_AUTHORS) {
+ if (!$s->{an_found}) {
+ $s->warning("missing .An in AUTHORS section") if $opt_A;
+ }
+ }
+}
+
sub set_section_header
{
my ($s, $section_header) = @_;
$section_header = join(' ', $s->parse_macro_args($section_header));
+ end_of_section($s);
+
if ($section_header eq 'SEE ALSO') {
- $s->{insa} = 1;
- } elsif ($s->{insa} == 1) {
- if (not $s->{sarest} eq "") {
- $s->warning("unneeded characters at end of ",
- "SEE ALSO: ", "`$s->{sarest}'") if $opt_a;
- # to avoid a second warning at EOF
- $s->{sarest} = "";
- }
- # finished SEE ALSO section
- $s->{insa} = 2;
+ $s->{in_section} = SECTION_SEE_ALSO;
+ } elsif ($section_header eq 'AUTHORS') {
+ $s->{in_section} = SECTION_AUTHORS;
+ } else {
+ $s->{in_section} = 0;
}
if (not $sections{$section_header}) {
@@ -471,7 +489,7 @@ sub process_line
}
}
- if ($s->{insa} == 1) {
+ if ($s->{in_section} == SECTION_SEE_ALSO) {
if (/^\.Xr\s+(\S+)\s+($sections_re)\s?(.*)?$/o) {
my ($saname, $sasection, $sarest) = ($1, $2, $3);
$saname =~ s/^\\&//o;
@@ -499,6 +517,11 @@ sub process_line
$s->{sarest} = "";
}
}
+ if ($s->{in_section} == SECTION_AUTHORS) {
+ if (/^\.An / && not /^\.An -(no|)split/) {
+ $s->{an_found} = 1;
+ }
+ }
if (/^\.Fn.*,.+/o) {
$s->warning("possible .Fn misuse: `$_'") if $opt_f;
@@ -647,10 +670,7 @@ sub finish
$s->warning("Paragraph problem: .Pp at EOF") if $opt_P;
}
- if ($s->{insa} > 0 and not $s->{sarest} eq "") {
- $s->warning("unneeded characters at end of SEE ALSO: ",
- "`$s->{sarest}'") if $opt_a;
- }
+ end_of_section($s);
# if (not ($fn =~ /$section$/)) {
# $s->warning("section doesn't match (internal value: $section)");
diff --git a/textproc/mdoclint/files/mdoclint.1 b/textproc/mdoclint/files/mdoclint.1
index 243d606bf86..8498fa0fcde 100755
--- a/textproc/mdoclint/files/mdoclint.1
+++ b/textproc/mdoclint/files/mdoclint.1
@@ -1,5 +1,5 @@
.\" $OpenBSD: mdoclint.1,v 1.7 2009/04/13 19:06:38 jmc Exp $
-.\" $NetBSD: mdoclint.1,v 1.8 2013/03/14 19:24:54 wiz Exp $
+.\" $NetBSD: mdoclint.1,v 1.9 2013/07/30 18:37:56 wiz Exp $
.\"
.\" Copyright (c) 2001-2013 Thomas Klausner
.\" All rights reserved.
@@ -25,7 +25,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd March 14, 2013
+.Dd July 30, 2013
.Dt MDOCLINT 1
.Os
.Sh NAME