summaryrefslogtreecommitdiff
path: root/textproc
diff options
context:
space:
mode:
authorwiz <wiz>2017-04-25 13:17:38 +0000
committerwiz <wiz>2017-04-25 13:17:38 +0000
commit2f62aa80d740da86929e49adbc43bc83be86c89f (patch)
tree5017cb46b44e4cb45082cb118e46938c273f4f5e /textproc
parent602f874f515e2fbbccc762ace97852f3928379e4 (diff)
downloadpkgsrc-2f62aa80d740da86929e49adbc43bc83be86c89f.tar.gz
Detect links to itself by parsing Nm in SYNOPSIS.
From Ingo Schwarze <schwarze@usta.de>. Bump version.
Diffstat (limited to 'textproc')
-rw-r--r--textproc/mdoclint/Makefile4
-rwxr-xr-xtextproc/mdoclint/files/mdoclint33
2 files changed, 24 insertions, 13 deletions
diff --git a/textproc/mdoclint/Makefile b/textproc/mdoclint/Makefile
index 7b52bcc1210..6fc6dd65ff0 100644
--- a/textproc/mdoclint/Makefile
+++ b/textproc/mdoclint/Makefile
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.56 2017/01/25 09:17:06 wiz Exp $
+# $NetBSD: Makefile,v 1.57 2017/04/25 13:17:38 wiz Exp $
-DISTNAME= mdoclint-1.45
+DISTNAME= mdoclint-1.46
CATEGORIES= textproc
MASTER_SITES= # none
DISTFILES= # none
diff --git a/textproc/mdoclint/files/mdoclint b/textproc/mdoclint/files/mdoclint
index ec9edbac989..7c8d7bc1fde 100755
--- a/textproc/mdoclint/files/mdoclint
+++ b/textproc/mdoclint/files/mdoclint
@@ -1,7 +1,7 @@
#!@PERL5@
#
# $OpenBSD: mdoclint,v 1.48 2016/01/24 20:10:48 schwarze Exp $
-# $NetBSD: mdoclint,v 1.64 2017/01/25 09:17:06 wiz Exp $
+# $NetBSD: mdoclint,v 1.65 2017/04/25 13:17:38 wiz Exp $
#
# Copyright (c) 2001-2017 Thomas Klausner
# All rights reserved.
@@ -39,8 +39,9 @@ use Getopt::Std;
use constant {
OPENBSD => 0,
NETBSD => 1,
- SECTION_SEE_ALSO => 2,
- SECTION_AUTHORS => 3
+ SECTION_NAME => 2,
+ SECTION_SEE_ALSO => 3,
+ SECTION_AUTHORS => 4
};
use vars qw(
@@ -270,7 +271,7 @@ sub handle_options
sub verify_xref
{
my ($self, $page, $section, $pre, $post) = @_;
- if ("$page.$section" eq $self->{fn}) {
+ if ($self->{names}{$page.$section}) {
$self->warning("Xref to itself (use .Nm instead)") if $opt_x;
}
# try to find corresponding man page
@@ -321,8 +322,11 @@ sub new
shseen => {},
last_error_name => '',
current_section_header => '',
+ sec => '0',
+ names => { $fn => 1 },
fn => $fn
};
+ $o->{sec} = $1 if $fn =~ /\.(.+?)$/;
open my $input, '<', $fn or die "can't open input file $fn";
$o->{file} = $input;
$o->{ln} = 0;
@@ -390,7 +394,9 @@ sub set_section_header
end_of_section($s);
- if ($section_header eq 'SEE ALSO') {
+ if ($section_header eq 'NAME') {
+ $s->{in_section} = SECTION_NAME;
+ } elsif ($section_header eq 'SEE ALSO') {
$s->{in_section} = SECTION_SEE_ALSO;
} elsif ($section_header eq 'AUTHORS') {
$s->{in_section} = SECTION_AUTHORS;
@@ -469,9 +475,11 @@ sub process_line
# $section = $1;
# }
if (/^\.Dt\s+/o) {
- if (! /^\.Dt\s+(?:[A-Z\d._-]+)\s+$sections_re(?:\s+$arches_re)?$/o) {
- $s->warning("bad .Dt: `$_'") if $opt_D;
- }
+ if (/^\.Dt\s+(?:[A-Z\d._-]+)\s+($sections_re)(?:\s+$arches_re)?$/o) {
+ $s->{sec} = $1;
+ } else {
+ $s->warning("bad .Dt: `$_'") if $opt_D;
+ }
}
if ($s->{mandoc_p}) {
@@ -488,7 +496,11 @@ sub process_line
}
}
- if ($s->{in_section} == SECTION_SEE_ALSO) {
+ if ($s->{in_section} == SECTION_NAME) {
+ if (/^\.Nm\s+(\S+)/o) {
+ $s->{names}{$1.$s->{sec}} = 1;
+ }
+ } elsif ($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;
@@ -515,8 +527,7 @@ sub process_line
}
$s->{sarest} = "";
}
- }
- if ($s->{in_section} == SECTION_AUTHORS) {
+ } elsif ($s->{in_section} == SECTION_AUTHORS) {
if (/^\.An / && not /^\.An -(no|)split/) {
$s->{an_found} = 1;
}