pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/textproc/mdoclint



Module Name:    pkgsrc
Committed By:   wiz
Date:           Tue Apr 25 13:17:38 UTC 2017

Modified Files:
        pkgsrc/textproc/mdoclint: Makefile
        pkgsrc/textproc/mdoclint/files: mdoclint

Log Message:
Detect links to itself by parsing Nm in SYNOPSIS.

>From Ingo Schwarze <schwarze%usta.de@localhost>.

Bump version.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 pkgsrc/textproc/mdoclint/Makefile
cvs rdiff -u -r1.64 -r1.65 pkgsrc/textproc/mdoclint/files/mdoclint

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/textproc/mdoclint/Makefile
diff -u pkgsrc/textproc/mdoclint/Makefile:1.56 pkgsrc/textproc/mdoclint/Makefile:1.57
--- pkgsrc/textproc/mdoclint/Makefile:1.56      Wed Jan 25 09:17:06 2017
+++ pkgsrc/textproc/mdoclint/Makefile   Tue Apr 25 13:17:38 2017
@@ -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

Index: pkgsrc/textproc/mdoclint/files/mdoclint
diff -u pkgsrc/textproc/mdoclint/files/mdoclint:1.64 pkgsrc/textproc/mdoclint/files/mdoclint:1.65
--- pkgsrc/textproc/mdoclint/files/mdoclint:1.64        Wed Jan 25 09:17:06 2017
+++ pkgsrc/textproc/mdoclint/files/mdoclint     Tue Apr 25 13:17:38 2017
@@ -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;
                }



Home | Main Index | Thread Index | Old Index