pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/textproc/mdoclint Detect links to itself by parsing Nm...
details: https://anonhg.NetBSD.org/pkgsrc/rev/fa3f0c1ad3ca
branches: trunk
changeset: 361694:fa3f0c1ad3ca
user: wiz <wiz%pkgsrc.org@localhost>
date: Tue Apr 25 13:17:38 2017 +0000
description:
Detect links to itself by parsing Nm in SYNOPSIS.
>From Ingo Schwarze <schwarze%usta.de@localhost>.
Bump version.
diffstat:
textproc/mdoclint/Makefile | 4 ++--
textproc/mdoclint/files/mdoclint | 33 ++++++++++++++++++++++-----------
2 files changed, 24 insertions(+), 13 deletions(-)
diffs (106 lines):
diff -r 14baee2514dc -r fa3f0c1ad3ca textproc/mdoclint/Makefile
--- a/textproc/mdoclint/Makefile Tue Apr 25 12:45:02 2017 +0000
+++ b/textproc/mdoclint/Makefile Tue Apr 25 13:17:38 2017 +0000
@@ -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 -r 14baee2514dc -r fa3f0c1ad3ca textproc/mdoclint/files/mdoclint
--- a/textproc/mdoclint/files/mdoclint Tue Apr 25 12:45:02 2017 +0000
+++ b/textproc/mdoclint/files/mdoclint Tue Apr 25 13:17:38 2017 +0000
@@ -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 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 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 @@
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 @@
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 @@
# $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 @@
}
}
- 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 @@
}
$s->{sarest} = "";
}
- }
- if ($s->{in_section} == SECTION_AUTHORS) {
+ } elsif ($s->{in_section} == SECTION_AUTHORS) {
if (/^\.An / && not /^\.An -(no|)split/) {
$s->{an_found} = 1;
}
Home |
Main Index |
Thread Index |
Old Index