head 1.78; access; symbols pkgsrc-2017Q2:1.77.0.2 pkgsrc-2017Q2-base:1.77 pkgsrc-2017Q1:1.64.0.2 pkgsrc-2017Q1-base:1.64 pkgsrc-2016Q4:1.62.0.2 pkgsrc-2016Q4-base:1.62 pkgsrc-2016Q3:1.61.0.2 pkgsrc-2016Q3-base:1.61 pkgsrc-2016Q2:1.58.0.2 pkgsrc-2016Q2-base:1.58 pkgsrc-2016Q1:1.57.0.2 pkgsrc-2016Q1-base:1.57 pkgsrc-2015Q4:1.54.0.2 pkgsrc-2015Q4-base:1.54 pkgsrc-2015Q3:1.52.0.4 pkgsrc-2015Q3-base:1.52 pkgsrc-2015Q2:1.52.0.2 pkgsrc-2015Q2-base:1.52 pkgsrc-2015Q1:1.51.0.2 pkgsrc-2015Q1-base:1.51 pkgsrc-2014Q4:1.50.0.2 pkgsrc-2014Q4-base:1.50 pkgsrc-2014Q3:1.49.0.4 pkgsrc-2014Q3-base:1.49 pkgsrc-2014Q2:1.49.0.2 pkgsrc-2014Q2-base:1.49 pkgsrc-2014Q1:1.47.0.2 pkgsrc-2014Q1-base:1.47 pkgsrc-2013Q4:1.43.0.2 pkgsrc-2013Q4-base:1.43 pkgsrc-2013Q3:1.42.0.2 pkgsrc-2013Q3-base:1.42 pkgsrc-2013Q2:1.33.0.2 pkgsrc-2013Q2-base:1.33 pkgsrc-2013Q1:1.32.0.2 pkgsrc-2013Q1-base:1.32 pkgsrc-2012Q4:1.21.0.2 pkgsrc-2012Q4-base:1.21 pkgsrc-2012Q3:1.20.0.2 pkgsrc-2012Q3-base:1.20 pkgsrc-2012Q2:1.19.0.2 pkgsrc-2012Q2-base:1.19 pkgsrc-2012Q1:1.18.0.2 pkgsrc-2012Q1-base:1.18 pkgsrc-2011Q4:1.17.0.2 pkgsrc-2011Q4-base:1.17 pkgsrc-2011Q3:1.16.0.8 pkgsrc-2011Q3-base:1.16 pkgsrc-2011Q2:1.16.0.6 pkgsrc-2011Q2-base:1.16 pkgsrc-2011Q1:1.16.0.4 pkgsrc-2011Q1-base:1.16 pkgsrc-2010Q4:1.16.0.2 pkgsrc-2010Q4-base:1.16 pkgsrc-2010Q3:1.13.0.2 pkgsrc-2010Q3-base:1.13 pkgsrc-2010Q2:1.9.0.2 pkgsrc-2010Q2-base:1.9 pkgsrc-2010Q1:1.8.0.2 pkgsrc-2010Q1-base:1.8 pkgsrc-2009Q4:1.5.0.2 pkgsrc-2009Q4-base:1.5 pkgsrc-2009Q3:1.4.0.4 pkgsrc-2009Q3-base:1.4 pkgsrc-2009Q2:1.4.0.2 pkgsrc-2009Q2-base:1.4 pkgsrc-2009Q1:1.2.0.2 pkgsrc-2009Q1-base:1.2 pkgsrc-20090301:1.1.1.1 TNF:1.1.1; locks; strict; comment @# @; 1.78 date 2017.08.01.15.11.59; author wiz; state dead; branches; next 1.77; commitid PvYj7YddYbFcqw1A; 1.77 date 2017.06.08.10.19.56; author wiz; state Exp; branches; next 1.76; commitid ChBjXFPseLxyxyUz; 1.76 date 2017.06.07.19.17.29; author wiz; state Exp; branches; next 1.75; commitid 5pDmZ3Fp1FEJxtUz; 1.75 date 2017.06.07.19.09.55; author wiz; state Exp; branches; next 1.74; commitid 4st2Ma128cpnvtUz; 1.74 date 2017.06.01.14.38.50; author wiz; state Exp; branches; next 1.73; commitid AA5cRcwSaWjocGTz; 1.73 date 2017.06.01.14.33.28; author wiz; state Exp; branches; next 1.72; commitid CbCuTFs0aIFjaGTz; 1.72 date 2017.05.16.13.27.39; author wiz; state Exp; branches; next 1.71; commitid fQsmqcUVxPrJjCRz; 1.71 date 2017.05.15.09.33.03; author wiz; state Exp; branches; next 1.70; commitid XRQs08ffzAob3tRz; 1.70 date 2017.05.14.18.04.23; author wiz; state Exp; branches; next 1.69; commitid FQbAoC7fzGEHUnRz; 1.69 date 2017.05.14.18.00.12; author wiz; state Exp; branches; next 1.68; commitid ORLcQlAsG3NjTnRz; 1.68 date 2017.05.02.13.59.10; author wiz; state Exp; branches; next 1.67; commitid F9MKDl1mnxOpWOPz; 1.67 date 2017.05.02.13.53.14; author wiz; state Exp; branches; next 1.66; commitid HooNiWj2hZ9sUOPz; 1.66 date 2017.04.28.13.43.57; author wiz; state Exp; branches; next 1.65; commitid MOYosJN6VdigZiPz; 1.65 date 2017.04.25.13.17.38; author wiz; state Exp; branches; next 1.64; commitid s3235dY3tLXaWUOz; 1.64 date 2017.01.25.09.17.06; author wiz; state Exp; branches 1.64.2.1; next 1.63; commitid hhm15eBym1gbvkDz; 1.63 date 2017.01.01.12.30.37; author wiz; state Exp; branches; next 1.62; commitid wGduqBAjdExolgAz; 1.62 date 2016.11.24.12.09.14; author wiz; state Exp; branches; next 1.61; commitid W0cSdiqCosdMrnvz; 1.61 date 2016.09.03.18.19.40; author wiz; state Exp; branches; next 1.60; commitid c2cNJArmVwTh8Skz; 1.60 date 2016.09.01.16.18.59; author wiz; state Exp; branches; next 1.59; commitid me2fvDjWxm3QwBkz; 1.59 date 2016.08.19.21.58.47; author wiz; state Exp; branches; next 1.58; commitid quNEz3E1I6QiPXiz; 1.58 date 2016.05.18.16.35.19; author wiz; state Exp; branches; next 1.57; commitid QcEuMbB0bW4E1Z6z; 1.57 date 2016.03.10.13.15.04; author wiz; state Exp; branches; next 1.56; commitid GocbogxYVift86Yy; 1.56 date 2016.01.25.15.57.24; author wiz; state Exp; branches; next 1.55; commitid a1mZJ3poD1mJtkSy; 1.55 date 2016.01.03.21.56.01; author wiz; state Exp; branches; next 1.54; commitid nzlNyNcY7hiJaxPy; 1.54 date 2015.12.11.14.24.35; author wiz; state Exp; branches; next 1.53; commitid pQAqKzT0e4mtpxMy; 1.53 date 2015.12.02.17.31.24; author wiz; state Exp; branches; next 1.52; commitid 37cUxSUC5eWHJoLy; 1.52 date 2015.05.04.07.43.41; author wiz; state Exp; branches; next 1.51; commitid 7vLw4aaz9M8Ei6ky; 1.51 date 2015.01.01.05.54.21; author jnemeth; state Exp; branches; next 1.50; commitid 1LzZy7ZNNR4gEh4y; 1.50 date 2014.10.26.22.20.14; author wiz; state Exp; branches; next 1.49; commitid v5axINlQOeYXfLVx; 1.49 date 2014.06.23.18.10.21; author wiz; state Exp; branches; next 1.48; commitid DQEd4sSiCfPmTFFx; 1.48 date 2014.03.31.08.40.47; author wiz; state Exp; branches; next 1.47; commitid Nwxq9PFzCLqirPux; 1.47 date 2014.03.19.07.34.10; author wiz; state Exp; branches; next 1.46; commitid xl8ulWuzSFakshtx; 1.46 date 2014.02.24.09.37.48; author wiz; state Exp; branches; next 1.45; commitid Y78JLbJUSReFSkqx; 1.45 date 2014.01.04.16.50.38; author wiz; state Exp; branches; next 1.44; commitid Ep8k5nXChT3KUOjx; 1.44 date 2014.01.01.03.58.19; author jnemeth; state Exp; branches; next 1.43; commitid bIcXEtAZmjRRJmjx; 1.43 date 2013.09.30.09.36.45; author wiz; state Exp; branches; next 1.42; commitid Wcq8PfYazkjgBr7x; 1.42 date 2013.09.05.09.13.23; author wiz; state Exp; branches; next 1.41; commitid RfPWm3z0TtjWge4x; 1.41 date 2013.08.21.11.22.15; author wiz; state Exp; branches; next 1.40; commitid VrunfPll3IM4tj2x; 1.40 date 2013.08.05.10.08.25; author wiz; state Exp; branches; next 1.39; commitid 14iG7dfLCQOIzf0x; 1.39 date 2013.08.02.13.16.54; author wiz; state Exp; branches; next 1.38; commitid CAWtoUM3McioISZw; 1.38 date 2013.07.30.19.07.23; author wiz; state Exp; branches; next 1.37; commitid rquoBhOyVEuCKwZw; 1.37 date 2013.07.30.18.51.15; author wiz; state Exp; branches; next 1.36; commitid l8o0J9YAJOH5FwZw; 1.36 date 2013.07.30.18.50.07; author wiz; state Exp; branches; next 1.35; commitid kF9BbKEbKGbCEwZw; 1.35 date 2013.07.30.18.46.29; author wiz; state Exp; branches; next 1.34; commitid yG2Phc2c2baoDwZw; 1.34 date 2013.07.30.18.37.56; author wiz; state Exp; branches; next 1.33; commitid FKKPN1NRxqIrAwZw; 1.33 date 2013.06.02.11.58.36; author wiz; state Exp; branches; next 1.32; commitid iIQLJbxzZMt4f2Sw; 1.32 date 2013.03.26.20.26.18; author wiz; state Exp; branches; next 1.31; 1.31 date 2013.03.14.19.37.33; author wiz; state Exp; branches; next 1.30; 1.30 date 2013.03.14.18.01.13; author wiz; state Exp; branches; next 1.29; 1.29 date 2013.03.10.22.14.40; author wiz; state Exp; branches; next 1.28; 1.28 date 2013.03.08.08.28.41; author wiz; state Exp; branches; next 1.27; 1.27 date 2013.03.07.21.54.24; author wiz; state Exp; branches; next 1.26; 1.26 date 2013.03.07.06.38.43; author wiz; state Exp; branches; next 1.25; 1.25 date 2013.03.06.22.21.36; author wiz; state Exp; branches; next 1.24; 1.24 date 2013.03.06.22.09.01; author wiz; state Exp; branches; next 1.23; 1.23 date 2013.03.06.21.43.43; author wiz; state Exp; branches; next 1.22; 1.22 date 2013.03.06.21.26.45; author wiz; state Exp; branches; next 1.21; 1.21 date 2013.01.01.01.42.08; author jnemeth; state Exp; branches; next 1.20; 1.20 date 2012.08.23.20.22.13; author wiz; state Exp; branches; next 1.19; 1.19 date 2012.06.20.23.27.36; author wiz; state Exp; branches; next 1.18; 1.18 date 2012.02.22.15.31.35; author wiz; state Exp; branches; next 1.17; 1.17 date 2012.01.02.18.01.00; author wiz; state Exp; branches; next 1.16; 1.16 date 2011.01.02.12.40.37; author wiz; state Exp; branches; next 1.15; 1.15 date 2010.12.03.20.06.42; author wiz; state Exp; branches; next 1.14; 1.14 date 2010.12.03.00.33.44; author wiz; state Exp; branches; next 1.13; 1.13 date 2010.09.26.15.20.10; author wiz; state Exp; branches; next 1.12; 1.12 date 2010.08.30.12.20.44; author wiz; state Exp; branches; next 1.11; 1.11 date 2010.08.27.21.13.11; author wiz; state Exp; branches; next 1.10; 1.10 date 2010.08.07.18.57.52; author wiz; state Exp; branches; next 1.9; 1.9 date 2010.05.26.08.31.59; author wiz; state Exp; branches; next 1.8; 1.8 date 2010.03.22.09.18.40; author wiz; state Exp; branches; next 1.7; 1.7 date 2010.02.24.22.09.53; author joerg; state Exp; branches; next 1.6; 1.6 date 2010.02.10.11.20.12; author wiz; state Exp; branches; next 1.5; 1.5 date 2010.01.01.11.40.49; author wiz; state Exp; branches; next 1.4; 1.4 date 2009.05.18.09.10.03; author wiz; state Exp; branches; next 1.3; 1.3 date 2009.04.13.22.18.13; author wiz; state Exp; branches; next 1.2; 1.2 date 2009.03.02.10.24.54; author wiz; state Exp; branches; next 1.1; 1.1 date 2009.03.01.21.25.39; author wiz; state Exp; branches 1.1.1.1; next ; 1.64.2.1 date 2017.05.06.15.12.53; author bsiegert; state Exp; branches; next ; commitid KGKJLPXTiQHWdlQz; 1.1.1.1 date 2009.03.01.21.25.39; author wiz; state Exp; branches; next ; desc @@ 1.78 log @Remove mdoclint. It has been integrated into mandoc -Tlint. Thanks, Ingo! @ text @#!@@PERL5@@ # # $OpenBSD: mdoclint,v 1.48 2016/01/24 20:10:48 schwarze Exp $ # $NetBSD: mdoclint,v 1.77 2017/06/08 10:19:56 wiz Exp $ # # Copyright (c) 2001-2017 Thomas Klausner # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR, THOMAS KLAUSNER, # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # use strict; use warnings; $| = 1; package Parser; use Getopt::Std; use constant { OPENBSD => 0, NETBSD => 1, }; use vars qw( $opt_D $opt_d $opt_F $opt_h $opt_m $opt_o $opt_p $opt_r $opt_S $opt_v $opt_w $opt_x ); my $arch=`uname -m`; chomp($arch); my $options="DdFhmoprSvwx"; sub usage { print STDERR <<"EOF"; mdoclint: verify man page correctness usage: mdoclint [-$options] file ... -D warn about bad casing and archs in .Dt -d warn about bad date strings (in .Dd only) -F fix whitespace problems (asks before overwriting) -h display this help text -m warn about man pages that are not in mdoc(7) format -o warn about non-empty .Os strings -p warn about punctuation problems -r warn about missing RCS Id -S warn about any .Sh weirdness -v verbose output -w show section header in warnings -x warn about cross-references with missing targets Default is -DdmoprSx if no flag is specified. EOF exit(0); } # constants to build my %sections; my $arches_re; my $sections_re; my $esections_re; my $valid_date_re; # and the code that builds them { my @@sections = ( "NAME", NETBSD ? "LIBRARY" : undef, "SYNOPSIS", "DESCRIPTION", OPENBSD ? "CONTEXT" : undef , NETBSD ? "IMPLEMENTATION NOTES" : undef, "RETURN VALUES", "ENVIRONMENT", "FILES", "EXIT STATUS", "EXAMPLES", "DIAGNOSTICS", NETBSD ? "COMPATIBILITY" : undef, "ERRORS", NETBSD ? "CODE REFERENCES" : undef, "SEE ALSO", "STANDARDS", "HISTORY", "AUTHORS", "CAVEATS", "BUGS", NETBSD ? "SECURITY CONSIDERATIONS" : undef ); my $i = 1; for my $sh (@@sections) { if (defined $sh) { $sections{$sh} = $i++; } } my @@arches; if (OPENBSD) { @@arches = (qw(alpha amd64 arm64 armv7 hppa i386 landisk loongson luna88k macppc mips64 octeon sgi socppc sparc64)); } if (NETBSD) { @@arches = (qw(acorn26 acorn32 algor alpha amiga arc atari bebox cats cesfic cobalt dreamcast emips evbarm evbmips evbppc evbsh3 evbsh5 hp300 hpcarm hpcmips hpcsh hppa i386 ibmnws luna68k mac68k macppc mipsco mmeye mvme68k mvmeppc netwinder news68k newsmips next68k pc532 playstation2 pmax pmppc prep sandpoint sbmips sgimips shark sparc sparc64 sun2 sun3 vax walnut x68k x86 x86_64 xen)); } my $a = join('|', @@arches); $arches_re = qr{(?:$a)}o; if (OPENBSD) { $sections_re = qr{(?:3p|[1-9])}o; $esections_re = qr{(?:3p|[0-9])}o; } if (NETBSD) { $sections_re = qr{[1-9](?:lua)?}o; $esections_re = qr{[0-9](?:lua)?}o; } if (OPENBSD) { $valid_date_re = qr{\$Mdocdate\b}; } if (NETBSD) { $valid_date_re = qr{(?:January|February|March|April|May|June|July|August|September|October|November|December)\s*[1-9][0-9]*,\s*(?:198[0-9]|199[0-9]|200[0-9]|201[0-7])$}o; } } sub debug { my $self = shift; print STDOUT "debug: $self->{fn}:$self->{ln}: @@_\n" if $opt_v; } sub warning { my $self = shift; my $extra = ""; if ($opt_w) { $extra = $self->{current_section_header}.":"; } print STDOUT "$self->{fn}:$extra$self->{ln}: ", join('', @@_), "\n"; } sub handle_options { getopts($options); $opt_h and usage(); # default to all warnings if no flag is set unless ($opt_D or $opt_d or $opt_m or $opt_o or $opt_p or $opt_r or $opt_S or $opt_x) { $opt_D = $opt_d = $opt_m = $opt_o = $opt_p = $opt_r = $opt_S = $opt_x = 1; } } sub verify_xref { my ($self, $page, $section, $pre, $post) = @@_; if ($self->{names}{$page.$section}) { $self->warning("Xref to itself (use .Nm instead)") if $opt_x; } # try to find corresponding man page if (OPENBSD) { open my $saveout, '>&', STDOUT; open my $saveerr, '>&', STDERR; open STDOUT, '>', '/dev/null'; open STDERR, '>', '/dev/null'; my $irc = system 'man', '-M', '/usr/share/man:/usr/X11R6/man', '-s', $section, '-f', $page; open STDOUT, '>&', $saveout; open STDERR, '>&', $saveerr; return 1 unless $irc; } else { for my $dir ('/usr/share/man', '/usr/X11R7/man') { for my $a ('', $arch) { for my $page ("man$section/$a/$page.$section") { return 1 if -f "$dir/$page"; } } } } return 1 if -f "./$page.$section"; return 1 if -f "./$page.mdoc"; $self->warning($pre."trailing Xref to $page($section)$post") if $opt_x; return 0; } sub new { my ($class, $fn) = @@_; my $o = { mandoc_p => 1, all => [], lastline => '', changes => 0, oxrcsidseen => 0, nxrcsidseen => 0, inliteral => 0, shseen => {}, 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; bless $o, $class; } sub next_line { my ($self) = @@_; my $l = readline($self->{file}); if (defined $l) { $self->{ln}++; } return $l; } sub close { my ($self) = @@_; close($self->{file}); } sub parse_macro_args { my ($s, $string) = @@_; $_ = $string; my @@params = (); while (!/^$/) { if (s/^\"(.*?)\"\s*//) { push(@@params, $1); } elsif (s/^(\S+)\s*//) { push(@@params, $1); } } return @@params; } sub set_section_header { my ($s, $section_header) = @@_; $section_header = join(' ', $s->parse_macro_args($section_header)); if (not $sections{$section_header}) { $s->warning("unknown section header: ", "`$section_header'") if $opt_S; } else { $s->{shseen}->{$section_header} = 1; } $s->{current_section_header} = $section_header; } sub process_and_save_line { my ($s, $input) = @@_; my $result = $s->process_line($input); # note that process_line chomps \n, then re-adds it, # so we detect a change on last lines without a \n. if ($result ne "$input") { $s->{changes} = 1; } push(@@{$s->{all}}, $result); } sub process_line { my $s; ($s, $_) = @@_; chomp; # always cut trailing spaces s/\s+$//o; if (/\$OpenBSD\b.*\$/o) { $s->{oxrcsidseen}++; if (OPENBSD and ($s->{oxrcsidseen} > 1)) { $s->warning("RCS Id seen twice") if $opt_r; } return "$_\n"; } if (/[\$]NetBSD\b.*\$/o) { $s->{nxrcsidseen}++; if (NETBSD and ($s->{nxrcsidseen} > 1)) { $s->warning("RCS Id seen twice") if $opt_r; } return "$_\n"; } # comments if (/^\.\\\"/) { return "$_\n"; } if (/^\.TH\s+/o) { $s->warning("not mandoc") if $opt_m; $s->{mandoc_p} = 0; # /^.TH\s*[\w-_".]+\s*([1-9])/; # $section = $1; return "$_\n"; } # if (/^.Dt\s*[\w-_".]+\s*([1-9])/) { # $section = $1; # } if (/^\.Dt\s+/o) { 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}) { if (/^\.Sh\s+(.*)$/o) { my $line = $_; $s->set_section_header($1); return "$line\n"; } } else { if (/^\.SH\s+(.*)$/o) { my $line = $_; $s->set_section_header($1); return "$line\n"; } } if ($s->{current_section_header} eq "NAME") { if (/^\.Nm\s+(\S+)/o) { $s->{names}{$1.$s->{sec}} = 1; } } if (/^\.Os\s+(.+)/o) { $s->warning(".Os used with argument `$1'") if $opt_o; } if (/^\... .*[^\s][\.();,\[\]\{\}:]$/o and not /\s\.\.\.$/o and not /\\&.$/o) { $s->warning("punctuation in format string ", "without space: `$_'") if $opt_p; } if (/^\./o and /Ns [\.();,\[\]\{\}:]/o) { $s->warning("possible Ns abuse: `$_'") if $opt_p; } if ((/^([^\.]\w+)\(\)/o or /^[^\.].*\s(\w+)\(\)/o) and not $s->{inliteral}) { $s->warning("use .Fn or .Xr for functions: `$1()'") if $opt_p; } my $destruct = $_; if ($s->{mandoc_p}) { $destruct =~ s/\\\&([\w\.])/$1/o; if ($destruct =~ /^\.Xr\s+([\w\:\.\-\+\/]+)\s+($esections_re)(.*)/o) { $s->debug("Xref to $1($2) found: `$_'"); $s->verify_xref($1, $2, "", ""); if ($3 =~ /^\S/o) { $s->warning("No space after section number in Xref: `$_'") if $opt_x; } } elsif ($destruct =~ /^\.Xr/o) { $s->warning("Weird Xref found: `$_'") if $opt_x; } } else { $destruct =~ s/\\f.//go; if ($destruct !~ /^\.\\\"/o) { while ($destruct =~ s/([-\w.]+)\s*\(($esections_re)\)//o) { $s->debug("possible Xref to $1($2) found: `$_'"); $s->verify_xref($1, $2, "possible ", ": `$_'"); # so that we have a chance to find more than one # per line $destruct =~ s/(\w+)\s*\(($sections_re)\)//o; } } } if (/^\.Dd/o and not /^\.Dd\s+$valid_date_re/o) { $s->warning("Invalid date found: `$_'") if $opt_d; } if (/^\.Bd\b.*-(?:literal|unfilled)\b/o) { $s->{inliteral} = 1; } if ($s->{inliteral} == 1) { if (/^\.Ed\b/o) { $s->{inliteral} = 0; } } $s->{lastline} = $_; return "$_\n"; } sub finish { my ($s) = @@_; if (NETBSD and not $s->{nxrcsidseen}) { $s->warning("Missing RCS Id") if $opt_r; } if (OPENBSD and not $s->{oxrcsidseen}) { $s->warning("Missing RCS Id") if $opt_r; } if ($s->{mandoc_p}) { foreach my $i (qw(NAME SYNOPSIS DESCRIPTION)) { if (not ($s->{shseen}{$i})) { $s->warning("missing $i section") if $opt_S; } } } } package main; sub handle_file { my $parser = Parser->new($_[0]); while ($_ = $parser->next_line) { $parser->process_and_save_line($_); } $parser->finish; $parser->close; if ($Parser::opt_F and $parser->{changes}) { open OUT, ">$_[0].new" or die "can't open output file `$_[0].new'"; for my $l (@@{$parser->{all}}) { print OUT $l } close OUT; system("mv -i $_[0].new $_[0]"); } } Parser->handle_options; foreach my $file (@@ARGV) { handle_file($file); } @ 1.77 log @Remove -e and -l; both now supported by mandoc. From Ingo Schwarze. Bump version. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.76 2017/06/07 19:17:29 wiz Exp $ @ 1.76 log @Remove new sentence, new line warning. mandoc learned it. From Ingo Schwarze. Ride bump. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.75 2017/06/07 19:09:55 wiz Exp $ d45 1 a45 1 $opt_D $opt_d $opt_e $opt_F $opt_h $opt_l d52 1 a52 1 my $options="DdeFhlmoprSvwx"; d55 1 a55 3 { my $default = OPENBSD ? "-DdmoprSx" : "-DdelmoprSx"; a60 1 -e warn about unsorted errors (for functions) a62 1 -l warn about unknown libraries d71 1 a71 1 Default is $default if no flag is specified. a75 60 my %libraries = ( "libarchive" => 1, "libarm" => 1, "libarm32" => 1, "libbluetooth" => 1, "libc" => 1, "libcdk" => 1, "libcompat" => 1, "libcrypt" => 1, "libcurses" => 1, "libdm" => 1, "libedit" => 1, "libelf" => 1, "libevent" => 1, "libexecinfo" => 1, "libfetch" => 1, "libform" => 1, "libi386" => 1, "libintl" => 1, "libipsec" => 1, "libiscsi" => 1, "libisns" => 1, "libkvm" => 1, "libm" => 1, "libm68k" => 1, "libmagic" => 1, "libmandoc" => 1, "libmenu" => 1, "libmj" => 1, "libnetpgp" => 1, "libnetpgpverify" => 1, "libnpf" => 1, "libossaudio" => 1, "libpam" => 1, "libpcap" => 1, "libpci" => 1, "libperfuse" => 1, "libpmc" => 1, "libposix" => 1, "libppath" => 1, "libprop" => 1, "libpthread" => 1, "libpthread_dbg" => 1, "libpuffs" => 1, "libquota" => 1, "librefuse" => 1, "libresolv" => 1, "librt" => 1, "librumpclient" => 1, "libsaslc" => 1, "libssp" => 1, "libtermcap" => 1, "libterminfo" => 1, "libusbhid" => 1, "libutil" => 1, "libx86_64" => 1, "libz" => 1 ); d174 1 a174 1 unless ($opt_D or $opt_d or $opt_e or $opt_l or $opt_m a177 1 $opt_e = $opt_l = 1 if NETBSD; a227 1 last_error_name => '', a361 6 if (/^\.Lb\s+(\S+)/o) { if (not $libraries{$1}) { $s->warning("Unknown library `$1' used as Lb argument") if $opt_l; } } a414 23 # Check whether the list of possible errors for a function is # sorted alphabetically. # # Error names should not be sorted across different lists. # (see bind(2) for an example.) # /^\.Bl\s+/o and $s->{last_error_name} = ""; if ($s->{current_section_header} eq "ERRORS" and /^\.It\s+(Bq\s+)?(Er\s+)?(E[\w_]+)$/o) { my $current_error_name = $3; if ($s->{last_error_name} eq $current_error_name) { $s->warning("Duplicate item for ", $current_error_name, ".") if $opt_e; } elsif ($current_error_name lt $s->{last_error_name}) { $s->warning("$s->{last_error_name} and ", "$current_error_name are not in ", "alphabetical order.") if $opt_e; } $s->{last_error_name} = $current_error_name; } @ 1.75 log @Remove -n, mandoc now has a warning for this case. From Ingo Schwarze. Bump version. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.74 2017/06/01 14:38:50 wiz Exp $ a436 6 if (/(\w\w)\.\s+[A-Z]/o and not /^.%T/ and not $s->{inliteral}) { if ("$1" ne "St") { $s->warning("new sentence, new line: `$_'") if $opt_p; } } @ 1.74 log @Remove -f. From Ingo Schwarze. Similar check already in mandoc. Bump version. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.73 2017/06/01 14:33:28 wiz Exp $ d46 1 a46 1 $opt_m $opt_n $opt_o $opt_p $opt_r $opt_S $opt_v $opt_w $opt_x d52 1 a52 1 my $options="aDdeFfHhlmnoprSvwXx"; d56 1 a56 1 my $default = OPENBSD ? "-DdmnoprSx" : "-DdelmnoprSx"; a67 1 -n warn about .Nd's ending in '.' d238 2 a239 3 unless ($opt_D or $opt_d or $opt_e or $opt_l or $opt_m or $opt_n or $opt_o or $opt_p or $opt_r or $opt_S or $opt_x) { d241 1 a241 2 $opt_n = $opt_o = $opt_p = $opt_r = $opt_S = $opt_x = 1; a437 4 if (/^\.Nd.*\.$/o) { $s->warning(".Nd ends with a dot: `$_'") if $opt_n; } @ 1.73 log @Remove -X option, now a style warning in mandoc. From Ingo Schwarze. Bump version. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.72 2017/05/16 13:27:39 wiz Exp $ d45 1 a45 1 $opt_D $opt_d $opt_e $opt_F $opt_f $opt_h $opt_l d56 1 a56 1 my $default = OPENBSD ? "-DdfmnoprSx" : "-DdeflmnoprSx"; a64 1 -f warn about possible incorrect .Fn syntax d239 1 a239 1 unless ($opt_D or $opt_d or $opt_e or $opt_f or $opt_l d242 1 a242 1 $opt_D = $opt_d = $opt_f = $opt_m = a431 3 if (/^\.Fn.*,.+/o) { $s->warning("possible .Fn misuse: `$_'") if $opt_f; } @ 1.72 log @Remove -H, it was only needed for mdoc2html when we were still using groff. From Ingo Schwarze. Mention Ingo in man page. Bump version. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.71 2017/05/15 09:33:03 wiz Exp $ d46 1 a46 2 $opt_m $opt_n $opt_o $opt_p $opt_r $opt_S $opt_v $opt_w $opt_X $opt_x d56 1 a56 1 my $default = OPENBSD ? "-DdfmnoprSXx" : "-DdeflmnoprSXx"; a75 1 -X warn about explicit mentions of the *BSD system names a82 7 my %short = ( "Free" => ".Fx", "Net" => ".Nx", "DragonFly" => ".Dx", "Open" => ".Ox" ); d242 1 a242 1 or $opt_S or $opt_X or $opt_x) { d245 1 a245 1 $opt_X = $opt_x = 1; a435 14 if (/\b(Free|Net|DragonFly|Open)BSD\b/o and not /\b(?:www|ftp)\.(?:Free|Net|DragonFly|Open)BSD\.org\b/o and not /\bOpenBSD\::.*3p\b/o and not /\/pub\/OpenBSD\//o and not /\@@(?:Free|Net|Open)BSD\.(?i:org)\b/o) { $s->warning("verbose mention of `$1BSD' instead of " . "`$short{$1}': `$_'") if $opt_X; } if (/^\./o and (/Bx (Open)/o or /Bx (Free)/o or /Bx (DragonFly)/o or /Bx (Net)/o)) { $s->warning("`.Bx $1' found -- use $short{$1} instead") if $opt_X; } @ 1.71 log @More cleanup from Ingo Schwarze. Remove -a remnants, simplify section header code, delete 9-argument check - OpenBSD does not use groff for quite some time now. Bump version. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.70 2017/05/14 18:04:23 wiz Exp $ d45 1 a45 1 $opt_D $opt_d $opt_e $opt_F $opt_f $opt_H $opt_h $opt_l a66 1 -H warn about characters that produce problems in HTML output d249 1 a249 1 unless ($opt_D or $opt_d or $opt_e or $opt_f or $opt_H or $opt_l a444 12 if (OPENBSD) { if (/^(?:[<>])/o or /[^\\][<>]/o) { $s->warning("use \*(Lt \*(Gt (or .Aq) ", "instead of < >: `$_'") if $opt_H; } } if (NETBSD) { if (/^(?:[<>&])/o or /[^\\][<>&]/o) { $s->warning("use \*[Lt] \*[Gt] (or .Aq) \*[Am] ", "instead of < > &: `$_'") if $opt_H; } } @ 1.70 log @The -a checks are covered by mandoc -Tlint as well, remove the option. From Ingo Schwarze. Bump version. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.69 2017/05/14 18:00:12 wiz Exp $ a41 1 SECTION_NAME => 2, d57 1 a57 1 my $default = OPENBSD ? "-aDdfmnoprSXx" : "-aDdeflmnoprSXx"; a61 1 -a warn about SEE ALSO section problems a304 2 lastsh => 0, in_section => 0, a349 3 if (@@params > 9 and OPENBSD) { $s->warning("$string holds >9 parameters"); } a357 6 if ($section_header eq 'NAME') { $s->{in_section} = SECTION_NAME; } else { $s->{in_section} = 0; } a361 4 if ($s->{lastsh} >= $sections{$section_header}) { $s->warning("section header ", "`$section_header' in wrong order") if $opt_S; } a362 1 $s->{lastsh} = $sections{$section_header}; d437 1 a437 1 if ($s->{in_section} == SECTION_NAME) { @ 1.69 log @Remove -s option. mandoc already warns about trailing whitespace. From Ingo Schwarze. Bump version. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.68 2017/05/02 13:59:10 wiz Exp $ a42 1 SECTION_SEE_ALSO => 3, d46 1 a46 1 $opt_a $opt_D $opt_d $opt_e $opt_F $opt_f $opt_H $opt_h $opt_l d252 1 a252 2 unless ($opt_a or $opt_D or $opt_d or $opt_e or $opt_f or $opt_H or $opt_l d255 1 a255 1 $opt_a = $opt_D = $opt_d = $opt_f = $opt_m = a307 3 sasection => 0, saname => '', sarest => ',', a359 12 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} = ""; } } a364 2 end_of_section($s); a366 2 } elsif ($section_header eq 'SEE ALSO') { $s->{in_section} = SECTION_SEE_ALSO; a458 27 } 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; if ($s->{sasection} gt $sasection or ($s->{sasection} eq $sasection and (lc($s->{saname}) gt lc($saname)))) { $s->warning("SEE ALSO: `.Xr $s->{saname} ", "$s->{sasection}' should be after ", "`.Xr $saname $sasection'") if $opt_a; } if ($s->{sarest} ne ",") { $s->warning("SEE ALSO: .Xr not separated ", "by comma, but `$s->{sarest}'") if $opt_a; } $s->{saname} = $saname; $s->{sasection} = $sasection; $s->{sarest} = $sarest; } if (/^\.Rs(?:\s+|$)/o) { if ($s->{sarest} ne "") { $s->warning("SEE ALSO: Not necessary to ", "separate .Xr from .Rs by ", "`$s->{sarest}'") if $opt_a; } $s->{sarest} = ""; } a594 6 end_of_section($s); # if (not ($fn =~ /$section$/)) { # $s->warning("section doesn't match (internal value: $section)"); # } @ 1.68 log @1.48: remove -P option; mandoc does most of these checks already and the remaining ones were recently added. From Ingo Schwarze. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.67 2017/05/02 13:53:14 wiz Exp $ d48 1 a48 1 $opt_m $opt_n $opt_o $opt_p $opt_r $opt_S $opt_s $opt_v $opt_w d55 1 a55 1 my $options="aDdeFfHhlmnoprSsvwXx"; d59 1 a59 1 my $default = OPENBSD ? "-aDdfmnoprSsXx" : "-aDdeflmnoprSsXx"; a78 1 -s warn about whitespace problems d256 1 a256 1 or $opt_S or $opt_s or $opt_X or $opt_x) { d259 1 a259 1 $opt_s = $opt_X = $opt_x = 1; d425 1 a425 4 if (/\s+$/o) { $s->warning("trailing space: `$_'") if $opt_s; s/\s+$//o; } @ 1.67 log @Bug fix from Ingo Schwarze: also look for empty lines in unfilled blocks. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.66 2017/04/28 13:43:57 wiz Exp $ d48 1 a48 2 $opt_m $opt_n $opt_o $opt_P $opt_p $opt_r $opt_S $opt_s $opt_v $opt_w d55 1 a55 1 my $options="aDdeFfHhlmnoPprSsvwXx"; d59 1 a59 1 my $default = OPENBSD ? "-aDdfmnoPprSsXx" : "-aDdeflmnoPprSsXx"; a75 1 -P warn about paragraph problems d256 1 a256 2 or $opt_m or $opt_n or $opt_o or $opt_P or $opt_p or $opt_r d259 1 a259 1 $opt_n = $opt_o = $opt_P = $opt_p = $opt_r = $opt_S = a404 5 if ($s->{lastline} =~ /^\.Pp/o) { $s->warning("Paragraph problem: section header after .Pp") if $opt_P; } a607 9 } elsif (/^$/o) { $s->warning("Paragraph problem: empty line -- ", "use .Pp for paragraphs") if $opt_P; } if ($s->{lastline} =~ /^\.Pp/o and /^(\.Ss|\.Pp)/o) { $s->warning("Paragraph problem: $1 after .Pp") if $opt_P; } if (/^\.Pp/o and $s->{lastline} =~ /^(\.S[Ssh])/o) { $s->warning("Paragraph problem: .Pp after $1") if $opt_P; a647 4 if ($s->{lastline} =~ /^\.Pp/o) { $s->warning("Paragraph problem: .Pp at EOF") if $opt_P; } @ 1.66 log @Remove -A option; mandoc -Tlint complains about this as well. From Ingo Schwarze. Bump version. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.65 2017/04/25 13:17:38 wiz Exp $ d609 1 a609 1 if (/^\.Bd\b.*-literal\b/o) { @ 1.65 log @Detect links to itself by parsing Nm in SYNOPSIS. From Ingo Schwarze . Bump version. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.64 2017/01/25 09:17:06 wiz Exp $ a43 1 SECTION_AUTHORS => 4 d47 1 a47 1 $opt_A $opt_a $opt_D $opt_d $opt_e $opt_F $opt_f $opt_H $opt_h $opt_l d56 1 a56 1 my $options="AaDdeFfHhlmnoPprSsvwXx"; d60 1 a60 1 my $default = OPENBSD ? "-AaDdfmnoPprSsXx" : "-AaDdeflmnoPprSsXx"; a64 1 -A warn about missing .An in AUTHORS section d256 1 a256 1 unless ($opt_A or $opt_a or $opt_D or $opt_d or $opt_e d261 1 a261 1 $opt_A = $opt_a = $opt_D = $opt_d = $opt_f = $opt_m = a316 1 inauthors => 0, a378 6 if ($s->{in_section} == SECTION_AUTHORS) { if (!$s->{an_found}) { $s->warning("missing .An in AUTHORS section") if $opt_A; } } a391 2 } elsif ($section_header eq 'AUTHORS') { $s->{in_section} = SECTION_AUTHORS; a518 4 } elsif ($s->{in_section} == SECTION_AUTHORS) { if (/^\.An / && not /^\.An -(no|)split/) { $s->{an_found} = 1; } @ 1.64 log @Add arm64 for OpenBSD. From jmc@@OpenBSD. Bump version. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.63 2017/01/01 12:30:37 wiz Exp $ d42 3 a44 2 SECTION_SEE_ALSO => 2, SECTION_AUTHORS => 3 d274 1 a274 1 if ("$page.$section" eq $self->{fn}) { d325 2 d329 1 d397 3 a399 1 if ($section_header eq 'SEE ALSO') { d478 5 a482 3 if (! /^\.Dt\s+(?:[A-Z\d._-]+)\s+$sections_re(?:\s+$arches_re)?$/o) { $s->warning("bad .Dt: `$_'") if $opt_D; } d499 5 a503 1 if ($s->{in_section} == SECTION_SEE_ALSO) { d530 1 a530 2 } if ($s->{in_section} == SECTION_AUTHORS) { @ 1.64.2.1 log @Pullup ticket #5394 - requested by sevan textproc/mdoclint: bugfix Revisions pulled up: - textproc/mdoclint/files/mdoclint 1.67 --- Module Name: pkgsrc Committed By: wiz Date: Tue May 2 13:53:14 UTC 2017 Modified Files: pkgsrc/textproc/mdoclint/files: mdoclint Log Message: Bug fix from Ingo Schwarze: also look for empty lines in unfilled blocks. @ text @d4 1 a4 1 # $NetBSD$ d613 1 a613 1 if (/^\.Bd\b.*-(?:literal|unfilled)\b/o) { @ 1.63 log @Allow 2017. Bump version. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.62 2016/11/24 12:09:14 wiz Exp $ d201 1 a201 1 (qw(alpha amd64 armv7 hppa i386 @ 1.62 log @Recognize libpthread_dbg. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.61 2016/09/03 18:19:40 wiz Exp $ d6 1 a6 1 # Copyright (c) 2001-2013 Thomas Klausner d231 1 a231 1 $valid_date_re = qr{(?:January|February|March|April|May|June|July|August|September|October|November|December)\s*[1-9][0-9]*,\s*(?:198[0-9]|199[0-9]|200[0-9]|201[0-6])$}o; @ 1.61 log @OpenBSD does not support zaurus any longer. Bump version. From jmc@@OpenBSD.org. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.60 2016/09/01 16:18:59 wiz Exp $ d142 1 @ 1.60 log @No more sparc on OpenBSD. From jmc@@OpenBSD. Bump version. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.59 2016/08/19 21:58:47 wiz Exp $ d202 1 a202 1 socppc sparc64 zaurus)); @ 1.59 log @No more armish in OpenBSD. From jmc@@OpenBSD Bump version. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.58 2016/05/18 16:35:19 wiz Exp $ d202 1 a202 1 socppc sparc sparc64 zaurus)); @ 1.58 log @mdoclint-1.39: OpenBSD removed hppa64. From jmc@@OpenBSD. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.57 2016/03/10 13:15:04 wiz Exp $ d200 1 a200 1 (qw(alpha amd64 armish armv7 hppa i386 @ 1.57 log @No more vax on OpenBSD. From jmc@@OpenBSD. Bump version. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.56 2016/01/25 15:57:24 wiz Exp $ d200 1 a200 1 (qw(alpha amd64 armish armv7 hppa hppa64 i386 @ 1.56 log @OpenBSD v1.48 from Ingo Schwarze: RCS file: /cvs/src/regress/usr.bin/mdoclint/mdoclint,v revision 1.48 date: 2016/01/24 20:10:48; author: schwarze; state: Exp; lines: +4 -1; commitid: IHgJFdt538B2OF26; In the OpenBSD-specific part of verify_xref(), discard the standard error output from man -f: Messages "man: nothing appropriate" are not helpful. If no matching manual exists anywhere, a more specific message follows right afterwards. If a matching manual exists in the current directory, such messages are just wrong. Issue reported by jmc@@. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.55 2016/01/03 21:56:01 wiz Exp $ d202 1 a202 1 socppc sparc sparc64 vax zaurus)); @ 1.55 log @It's 2016, allow it in man pages. Bump version. @ text @d3 2 a4 2 # $OpenBSD: mdoclint,v 1.42 2014/03/18 22:36:30 miod Exp $ # $NetBSD: mdoclint,v 1.54 2015/12/11 14:24:35 wiz Exp $ d278 1 d280 1 d284 1 @ 1.54 log @OpenBSD will remove man page symlinks and let man(1) find them via a database. Adapt code for that case using a patch from Ingo Schwarze. Bump version. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.53 2015/12/02 17:31:24 wiz Exp $ d230 1 a230 1 $valid_date_re = qr{(?:January|February|March|April|May|June|July|August|September|October|November|December)\s*[1-9][0-9]*,\s*(?:198[0-9]|199[0-9]|200[0-9]|201[0-5])$}o; @ 1.53 log @Update OpenBSD architectures. From jmc@@OpenBSD. Bump version. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.52 2015/05/04 07:43:41 wiz Exp $ d276 13 a288 5 for my $dir ("/usr/share/man", OPENBSD ? "/usr/X11R6/man" : "/usr/X11R7/man") { for my $a ("", $arch) { for my $page ("man$section/$a/$page.$section") { return 1 if -f "$dir/$page"; @ 1.52 log @Add emips architecture for NetBSD. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.51 2015/01/01 05:54:21 jnemeth Exp $ d200 3 a202 4 (qw(alpha amd64 arm armish armv7 aviion cats hppa hppa64 i386 landisk loongson luna88k macppc mips64 octeon sgi socppc sparc sparc64 vax zaurus)); @ 1.51 log @add 2015 to valid_date_re @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.50 2014/10/26 22:20:14 wiz Exp $ d208 2 a209 1 bebox cats cesfic cobalt dreamcast evbarm evbmips evbppc @ 1.50 log @Look for *.mdoc files when checking Xrefs. Some projects distribute *.mdoc files and this helps. Bump version. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.49 2014/06/23 18:10:21 wiz Exp $ d230 1 a230 1 $valid_date_re = qr{(?:January|February|March|April|May|June|July|August|September|October|November|December)\s*[1-9][0-9]*,\s*(?:198[0-9]|199[0-9]|200[0-9]|201[0-4])$}o; @ 1.49 log @Fix a bug in -F. Bump version. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.48 2014/03/31 08:40:47 wiz Exp $ d285 1 @ 1.48 log @OpenBSD added CONTEXT section to man9. Update library list. From jmc@@openbsd. Bump version. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.47 2014/03/19 07:34:10 wiz Exp $ d410 2 a411 3 my $s; ($s, $_) = @@_; my $result = $s->process_line($_); d414 1 a414 1 if ($result ne $_) { d466 1 a466 1 my $line = $_; @ 1.47 log @As of yesterday, OpenBSD stopped supported hp300, mvme68k, and mvme88k. Update patterns. From jmc@@OpenBSD. Bump version. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.46 2014/02/24 09:37:48 wiz Exp $ d171 1 @ 1.46 log @hp700 port was renamed to hppa. Bump version. @ text @d3 2 a4 2 # $OpenBSD: mdoclint,v 1.38 2013/09/04 19:39:19 patrick Exp $ # $NetBSD: mdoclint,v 1.45 2014/01/04 16:50:38 wiz Exp $ d199 1 a199 1 (qw(alpha amd64 arm armish armv7 aviion cats hp300 hppa d201 1 a201 1 mvme68k mvme88k octeon sgi socppc sparc sparc64 vax @ 1.45 log @Accept [0-9]lua as section name. Bump version. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.44 2014/01/01 03:58:19 jnemeth Exp $ d208 1 a208 1 evbsh3 evbsh5 hp300 hp700 hpcarm hpcmips hpcsh @ 1.44 log @add 2014 to valid_date_re @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.43 2013/09/30 09:36:45 wiz Exp $ d222 2 a223 2 $sections_re = qr{[1-9]}o; $esections_re = qr{[0-9]}o; @ 1.43 log @1.24: Add default location for CODE REFERENCES. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.42 2013/09/05 09:13:23 wiz Exp $ d229 1 a229 1 $valid_date_re = qr{(?:January|February|March|April|May|June|July|August|September|October|November|December)\s*[1-9][0-9]*,\s*(?:198[0-9]|199[0-9]|200[0-9]|201[0-3])$}o; @ 1.42 log @OpenBSD renamed beagle to armv7. From patrick@@openbsd via jmc@@openbsd. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.41 2013/08/21 11:22:15 wiz Exp $ d180 1 @ 1.41 log @Recognize DragonFlyBSD. From Jan Stary . Bump version. @ text @d3 2 a4 2 # $OpenBSD: mdoclint,v 1.14 2009/04/13 12:40:05 espie Exp $ # $NetBSD: mdoclint,v 1.40 2013/08/05 10:08:25 wiz Exp $ d198 1 a198 1 (qw(alpha amd64 arm armish aviion beagle cats hp300 hppa @ 1.40 log @Remove more traces of unfinished -O support. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.39 2013/08/02 13:16:54 wiz Exp $ d85 1 a85 1 -X warn about explicit mentions of FreeBSD, NetBSD, or OpenBSD d96 1 d527 2 a528 2 if (/\b(Free|Net|Open)BSD\b/o and not /\b(?:www|ftp)\.(?:Free|Net|Open)BSD\.org\b/o d535 2 a536 1 if (/^\./o and (/Bx (Open)/o or /Bx (Free)/o or /Bx (Net)/o)) { @ 1.39 log @Whitespace, from jmc@@openbsd. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.38 2013/07/30 19:07:23 wiz Exp $ a76 1 -O warn about unsorted .It arguments a246 4 my $order = " !\"#\$\%&'()*+,-./:;<=>?[\\]^_{|}~". "0123456789". "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz"; @ 1.38 log @Fix -F. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.37 2013/07/30 18:51:15 wiz Exp $ d47 1 a47 1 $opt_A $opt_a $opt_D $opt_d $opt_e $opt_F $opt_f $opt_H $opt_h $opt_l d61 1 a61 1 d381 1 a381 1 @ 1.37 log @Remove unused function. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.36 2013/07/30 18:50:07 wiz Exp $ d469 1 d471 1 a471 1 return "$_\n"; d475 1 d477 1 a477 1 return "$_\n"; @ 1.36 log @Remove mentions of -O, noone's implemented it yet or will soon. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.35 2013/07/30 18:46:29 wiz Exp $ a251 13 sub forder { my ($a, $b, $c, $len, $i); $a = $_[0]; $b = $_[1]; $len = (length($a) < length($b))? length($a) : length($b); for($i = 0; $i<=$len; $i++) { $c = (index($order,substr($a,$i,1)) <=> index($order,substr($b,$i,1))); if($c){ return $c }; } return (length($a) <=> length($b)); } @ 1.35 log @Make Bq and Er optional for errors. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.34 2013/07/30 18:37:56 wiz Exp $ d49 1 a49 1 $opt_n $opt_O $opt_o $opt_P $opt_p $opt_r $opt_S $opt_s $opt_v $opt_w d56 1 a56 1 my $options="AaDdeFfHhlmnOoPprSsvwXx"; d273 1 a273 1 or $opt_m or $opt_n or $opt_O d277 1 a277 1 $opt_n = $opt_O = $opt_o = $opt_P = $opt_p = $opt_r = $opt_S = @ 1.34 log @Fix -A support. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.33 2013/06/02 11:58:36 wiz Exp $ d640 2 a641 2 /^\.It\s+Bq\s+Er\s+(E[\w_]+)$/o) { my $current_error_name = $1; @ 1.33 log @Remove "my" before $_, since perl 5.18 complains about it. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.32 2013/03/26 20:26:18 wiz Exp $ d41 3 a43 1 NETBSD => 1 d60 1 a60 1 my $default = OPENBSD ? "-aDdfmnoPprSsXx" : "-aDdeflmnoPprSsXx"; d320 2 a321 1 insa => 0, d370 18 d393 2 d396 5 a400 10 $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; d492 1 a492 1 if ($s->{insa} == 1) { d520 5 d673 1 a673 4 if ($s->{insa} > 0 and not $s->{sarest} eq "") { $s->warning("unneeded characters at end of SEE ALSO: ", "`$s->{sarest}'") if $opt_a; } @ 1.32 log @Keep in sync with OpenBSD: add octeon port. From jmc@@openbsd. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.31 2013/03/14 19:37:33 wiz Exp $ d352 1 a352 1 my $_ = $string; d407 2 a408 1 my ($s, $_) = @@_; d420 2 a421 1 my ($s, $_) = @@_; d673 1 a673 1 while (my $_ = $parser->next_line) { @ 1.31 log @Add -l in another place. Found by jmc@@openbsd. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.30 2013/03/14 18:01:13 wiz Exp $ d198 2 a199 1 mvme68k mvme88k sgi socppc sparc sparc64 vax zaurus)); @ 1.30 log @Report correct line for duplicate RCS Ids. Noted by jmc@@openbsd.org. Bump version. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.29 2013/03/10 22:14:40 wiz Exp $ d58 1 a58 1 my $default = OPENBSD ? "-aDdfmnoPprSsXx" : "-aDdefmnoPprSsXx"; @ 1.29 log @Stop looking at cat pages. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.28 2013/03/08 08:28:41 wiz Exp $ d427 3 a429 1 # nothing else to do d434 3 a436 1 # nothing else to do a638 3 if (NETBSD and ($s->{nxrcsidseen} > 1)) { $s->warning("RCS Id seen twice") if $opt_r; } a641 3 if (OPENBSD and ($s->{oxrcsidseen} > 1)) { $s->warning("RCS Id seen twice") if $opt_r; } @ 1.28 log @Add librumpclient. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.27 2013/03/07 21:54:24 wiz Exp $ d291 1 a291 2 for my $page ("cat$section/$a/$page.0", "man$section/$a/$page.$section") { @ 1.27 log @+ libpnf. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.26 2013/03/07 06:38:43 wiz Exp $ d145 1 @ 1.26 log @Add libmj and libnetpgpverify. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.25 2013/03/06 22:21:36 wiz Exp $ d129 1 @ 1.25 log @Fix some incorrect warnings about 'new sentence, new line'. Ride bump. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.24 2013/03/06 22:09:01 wiz Exp $ d126 1 d128 1 @ 1.24 log @Do not warn about () in literal strings or when used as macro argument. Ride bump. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.23 2013/03/06 21:43:43 wiz Exp $ d534 4 a537 2 if (/\w\w\.\s+[A-Z]/o) { $s->warning("new sentence, new line: `$_'") if $opt_p; @ 1.23 log @Add libmandoc. Ride bump. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.22 2013/03/06 21:26:45 wiz Exp $ d545 1 a545 1 if (/(\w+)\(\)/o) { @ 1.22 log @Warn about unknown libraries. Bump version to 1.19. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.21 2013/01/01 01:42:08 jnemeth Exp $ d124 1 @ 1.21 log @allow 2013 in man pages @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.20 2012/08/23 20:22:13 wiz Exp $ d6 1 a6 1 # Copyright (c) 2001-2012 Thomas Klausner d45 2 a46 1 $opt_A $opt_a $opt_D $opt_d $opt_e $opt_F $opt_f $opt_H $opt_h $opt_m d54 1 a54 1 my $options="AaDdeFfHhmnOoPprSsvwXx"; d72 1 d98 53 d264 2 a265 1 or $opt_f or $opt_H or $opt_m or $opt_n or $opt_O d271 1 a271 1 $opt_e = 1 if NETBSD; d520 5 @ 1.20 log @Recognize OpenBSD's beagle platform. From Jason McIntyre . Bump version. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.19 2012/06/20 23:27:36 wiz Exp $ d165 1 a165 1 $valid_date_re = qr{(?:January|February|March|April|May|June|July|August|September|October|November|December)\s*[1-9][0-9]*,\s*(?:198[0-9]|199[0-9]|200[0-9]|201[0-2])$}o; @ 1.19 log @openbsd just removed mac68k support. From jmc@@openbsd. Bump version. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.18 2012/02/22 15:31:35 wiz Exp $ d136 1 a136 1 (qw(alpha amd64 arm armish aviion cats hp300 hppa @ 1.18 log @Mention putty-devel successor. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.17 2012/01/02 18:01:00 wiz Exp $ d137 2 a138 3 hppa64 i386 landisk loongson luna88k mac68k macppc mips64 mvme68k mvme88k sgi socppc sparc sparc64 vax zaurus)); @ 1.17 log @Allow 2012 in man page dates. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.16 2011/01/02 12:40:37 wiz Exp $ d45 2 a46 2 $opt_a $opt_D $opt_d $opt_e $opt_F $opt_f $opt_H $opt_h $opt_m $opt_n $opt_o $opt_P $opt_p $opt_r $opt_S $opt_s $opt_v $opt_w d53 1 a53 1 my $options="aDdeFfHhmnoPprSsvwXx"; d62 1 d73 1 d186 17 d209 6 a214 5 unless ($opt_a or $opt_D or $opt_d or $opt_e or $opt_f or $opt_H or $opt_m or $opt_n or $opt_o or $opt_P or $opt_p or $opt_r or $opt_S or $opt_s or $opt_X or $opt_x) { $opt_a = $opt_D = $opt_d = $opt_f = $opt_m = $opt_n = $opt_o = $opt_P = $opt_p = $opt_r = $opt_S = d216 1 a216 1 $opt_e = 1 if NETBSD; d338 1 a338 1 $s->warning("Paragraph problem: section header after .Pp") d367 1 a367 1 $s->{oxrcsidseen} = 1; d372 1 a372 1 $s->{nxrcsidseen} = 1; d462 1 a462 1 $s->warning("`.Bx $1' found -- use $short{$1} instead") d569 3 d575 3 d616 1 a616 1 print OUT $l @ 1.16 log @Accept 2011. Bump version. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.15 2010/12/03 20:06:42 wiz Exp $ d6 1 a6 1 # Copyright (c) 2001-2010 Thomas Klausner d164 1 a164 1 $valid_date_re = qr{(?:January|February|March|April|May|June|July|August|September|October|November|December)\s*[1-9][0-9]*,\s*(?:198[0-9]|199[0-9]|200[0-9]|201[01])$}o; @ 1.15 log @Really disable -H. From jmc@@openbsd. Bump version. While here, set LICENSE. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.14 2010/12/03 00:33:44 wiz Exp $ d164 1 a164 1 $valid_date_re = qr{(?:January|February|March|April|May|June|July|August|September|October|November|December)\s*[1-9][0-9]*,\s*(?:198[0-9]|199[0-9]|200[0-9]|2010)$}o; @ 1.14 log @Remove -H from default flags, not needed any longer with mandoc(1). Bump version to 1.11. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.13 2010/09/26 15:20:10 wiz Exp $ d193 1 a193 1 $opt_a = $opt_D = $opt_d = $opt_f = $opt_H = $opt_m = @ 1.13 log @Add mips64 for OpenBSD, from jmc@@openbsd. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.12 2010/08/30 12:20:44 wiz Exp $ d57 1 a57 1 my $default = OPENBSD ? "-aDdfHmnoPprSsXx" : "-aDdefHmnoPprSsXx"; @ 1.12 log @Mark "IMPLEMENTATION NOTES" and "COMPATIBILITY" as NetBSD only. Bump version. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.11 2010/08/27 21:13:11 wiz Exp $ d136 2 a137 1 mvme68k mvme88k sgi socppc sparc sparc64 vax zaurus)); @ 1.11 log @OpenBSD has added EXIT STATUS as standard section. Bump version. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.10 2010/08/07 18:57:52 wiz Exp $ d107 1 a107 1 "IMPLEMENTATION NOTES", d114 1 a114 1 "COMPATIBILITY", @ 1.10 log @Update to 1.8: Recognize xen and x86 as architectures. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.9 2010/05/26 08:31:59 wiz Exp $ d111 1 a111 1 NETBSD ? "EXIT STATUS" : undef, @ 1.9 log @Prefer same section order as mdocml. Bump version. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.8 2010/03/22 09:18:40 wiz Exp $ d147 1 a147 1 x68k x86_64)); @ 1.8 log @Fix previous (hi joerg!). Bump version. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.7 2010/02/24 22:09:53 joerg Exp $ d107 1 a107 1 NETBSD ? "EXIT STATUS" : undef, d111 1 d114 1 @ 1.7 log @Escape RCS ID correctly, so that the +BUILD_INFO processing doesn't pick it up. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.6 2010/02/10 11:20:12 wiz Exp $ d348 1 a348 1 if (/\[$]NetBSD\b.*\$/o) { @ 1.6 log @1.5: Add loongson to recognized OpenBSD architectures. From Jason McIntyre . @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.5 2010/01/01 11:40:49 wiz Exp $ d348 1 a348 1 if (/\$NetBSD\b.*\$/o) { @ 1.5 log @Recognize 2010, bump version to 1.4. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.4 2009/05/18 09:10:03 wiz Exp $ d133 2 a134 2 hppa64 i386 landisk luna88k mac68k macppc mvme68k mvme88k sgi socppc sparc sparc64 vax zaurus)); @ 1.4 log @Recognize evbppc. Bump version to 1.3. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.3 2009/04/13 22:18:13 wiz Exp $ d6 1 a6 1 # Copyright (c) 2001-2009 Thomas Klausner d161 1 a161 1 $valid_date_re = qr{(?:January|February|March|April|May|June|July|August|September|October|November|December)\s*[1-9][0-9]*,\s*(?:198[0-9]|199[0-9]|200[0-9])$}o; @ 1.3 log @Update to 1.2: Fix -F; add -w to show section in warnings, default off (was new in 1.1 with default on). Functional diff provided by Marc Espie, man page by Jason McIntyre. @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.26 2008/11/22 14:47:28 wiz Exp $ d139 1 a139 1 bebox cats cesfic cobalt dreamcast evbarm evbmips @ 1.2 log @Recognize 2009 in Dd. @ text @d3 2 a4 2 # $OpenBSD: mdoclint,v 1.13 2008/12/31 10:55:11 espie Exp $ # $NetBSD: mdoclint,v 1.1.1.1 2009/03/01 21:25:39 wiz Exp $ d46 1 a46 1 $opt_n $opt_o $opt_P $opt_p $opt_r $opt_S $opt_s $opt_v d53 1 a53 1 my $options="aDdeFfHhmnoPprSsvXx"; d79 1 d174 5 a178 1 print STDOUT "$self->{fn}:$self->{current_section_header}:$self->{ln}: ", join('', @@_), "\n"; d202 1 a202 1 $self->warning("Xref to itself (use .Nm instead)"); d216 1 a216 1 $self->warning($pre."trailing Xref to $page($section)$post"); d226 1 a226 1 all => '', d288 1 d290 1 a290 1 $s->{insa} = 1; d292 17 a308 20 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; } if ($opt_S) { if (not $sections{$section_header}) { $s->warning("unknown section header: ", "`$section_header'"); } else { if ($s->{lastsh} >= $sections{$section_header}) { $s->warning("section header ", "`$section_header' in wrong order"); } $s->{shseen}->{$section_header} = 1; $s->{lastsh} = $sections{$section_header}; d310 2 d313 1 d315 2 a316 1 $s->warning("Paragraph problem: section header after .Pp"); d322 12 a341 1 $s->{changes} = 1; d346 1 a346 1 return; d351 1 a351 1 return; d355 1 a355 1 return; d362 1 a362 1 return; d367 1 a367 1 if ($opt_D and /^\.Dt\s+/o) { d369 1 a369 1 $s->warning("bad .Dt: `$_'"); d376 1 a376 1 return; d381 1 a381 1 return; d385 1 a385 2 if ($opt_a) { if ($s->{insa} == 1) { d387 16 a402 15 my ($saname, $sasection, $sarest) = ($1, $2, $3); $saname =~ s/^\\&//o; if ($s->{sasection} gt $sasection or ($s->{sasection} eq $sasection and ($s->{saname} cmp $saname) > 0)) { $s->warning("SEE ALSO: `.Xr $s->{saname} $s->{sasection}' should " . "be after `.Xr $saname $sasection'"); } if ($s->{sarest} ne ",") { $s->warning("SEE ALSO: .Xr not separated by ". "comma, but `$s->{sarest}'"); } $s->{saname} = $saname; $s->{sasection} = $sasection; $s->{sarest} = $sarest; d405 6 a410 5 if ($s->{sarest} ne "") { $s->warning("SEE ALSO: Not necessary to separate". " .Xr from .Rs by `$s->{sarest}'"); } $s->{sarest} = ""; a411 1 } d414 2 a415 2 if ($opt_f and /^\.Fn.*,.+/o) { $s->warning("possible .Fn misuse: `$_'"); d418 1 a418 1 if ($opt_H and (/^(?:[<>])/o or /[^\\][<>]/o)) { d420 1 a420 1 "instead of < >: `$_'"); d424 1 a424 1 if ($opt_H and (/^(?:[<>&])/o or /[^\\][<>&]/o)) { d426 1 a426 1 "instead of < > &: `$_'"); d430 14 a443 12 if ($opt_X) { if (/\b(Free|Net|Open)BSD\b/o and not /\b(?:www|ftp)\.(?:Free|Net|Open)BSD\.org\b/o and not /\bOpenBSD\::.*3p\b/o and not /\/pub\/OpenBSD\//o and not /\@@(?:Free|Net|Open)BSD\.(?i:org)\b/o) { $s->warning("verbose mention of `$1BSD' instead of " . "`$short{$1}': `$_'"); } if (/^\./o and (/Bx (Open)/o or /Bx (Free)/o or /Bx (Net)/o)) { $s->warning("`.Bx $1' found -- use $short{$1} instead"); } d445 3 a447 4 if ($opt_o) { if (/^\.Os\s+(.+)/o) { $s->warning(".Os used with argument `$1'"); } d450 10 a459 4 if ($opt_n) { if (/^\.Nd.*\.$/o) { $s->warning(".Nd ends with a dot: `$_'"); } d461 2 a462 15 if ($opt_p) { if (/\w\w\.\s+[A-Z]/o) { $s->warning("new sentence, new line: `$_'"); } if (/^\... .*[^\s][\.();,\[\]\{\}:]$/o and not /\s\.\.\.$/o and not /\\&.$/o) { $s->warning("punctuation in format string ", "without space: `$_'"); } if (/^\./o and /Ns [\.();,\[\]\{\}:]/o) { $s->warning("possible Ns abuse: `$_'"); } if (/(\w+)\(\)/o) { $s->warning("use .Fn or .Xr for functions: `$1()'"); } d464 3 a466 3 if ($opt_x) { if ($s->{mandoc_p}) { my $destruct = $_; d469 5 a473 5 $s->debug("Xref to $1($2) found: `$_'"); $s->verify_xref($1, $2, "", ""); if ($3 =~ /^\S/o) { $s->warning("No space after section number in Xref: `$_'"); } d475 1 a475 1 $s->warning("Weird Xref found: `$_'"); d477 1 a477 2 } else { my $destruct = $_; d480 7 a486 7 while ($destruct =~ s/([-\w.]+)\s*\(($esections_re)\)//o) { $s->debug("possible Xref to $1($2) found: `$_'"); $s->verify_xref($1, $2, "possible ", ": `$_'"); # so that we have a chance to find more than one # per line $destruct =~ s/(\w+)\s*\(($sections_re)\)//o; } a487 1 } d489 3 a491 4 if ($opt_d) { if (/^\.Dd/o and not /^\.Dd\s+$valid_date_re/o) { $s->warning("Invalid date found: `$_'"); } d494 6 a499 17 if ($opt_P) { if (/^\.Bd\b.*-literal\b/o) { $s->{inliteral} = 1; } if ($s->{inliteral} == 1) { if (/^\.Ed\b/o) { $s->{inliteral} = 0; } } elsif (/^$/o) { $s->warning("Paragraph problem: empty line -- ", "use .Pp for paragraphs"); } if ($s->{lastline} =~ /^\.Pp/o and /^(\.Ss|\.Pp)/o) { $s->warning("Paragraph problem: $1 after .Pp"); } if (/^\.Pp/o and $s->{lastline} =~ /^(\.S[Ssh])/o) { $s->warning("Paragraph problem: .Pp after $1"); d501 9 d515 16 a530 19 if ($opt_e) { # Error names should not be sorted across different lists. # (see bind(2) for an example.) # /^\.Bl\s+/o and $s->{last_error_name} = ""; if ($s->{current_section_header} eq "ERRORS" and /^\.It\s+Bq\s+Er\s+(E[\w_]+)$/o) { my $current_error_name = $1; if ($s->{last_error_name} eq $current_error_name) { $s->warning("Duplicate item for " . "$current_error_name."); } elsif ($current_error_name lt $s->{last_error_name}) { $s->warning("$s->{last_error_name} and " . "$current_error_name are not in " . "alphabetical order."); } $s->{last_error_name} = $current_error_name; d532 1 d536 1 a536 1 $s->{all} .= "$_\n"; d544 1 a544 1 $s->warning("Missing RCS Id") if $opt_r; d547 1 a547 1 $s->warning("Missing RCS Id") if $opt_r; d550 2 a551 2 if ($opt_P and $s->{lastline} =~ /^\.Pp/o) { $s->warning("Paragraph problem: .Pp at EOF"); d554 3 a556 2 if ($opt_a and $s->{insa} > 0 and not $s->{sarest} eq "") { $s->warning("unneeded characters at end of SEE ALSO: `$s->{sarest}'"); d562 5 a566 4 if ($s->{mandoc_p} and $opt_S) { foreach my $i (qw (NAME SYNOPSIS DESCRIPTION)) { if (not ($s->{shseen}{$i})) { $s->warning("missing $i section"); a567 1 } d578 1 a578 1 $parser->process_line($_); d586 3 a588 1 print OUT $parser->{all}; d596 1 a596 1 handle_file($file); @ 1.1 log @Initial revision @ text @d4 1 a4 1 # $NetBSD: mdoclint,v 1.29 2009/03/01 17:52:35 wiz Exp $ d160 1 a160 1 $valid_date_re = qr{(?:January|February|March|April|May|June|July|August|September|October|November|December)\s*[1-9][0-9]*,\s*(?:198[0-9]|199[0-9]|200[012345678])$}o; @ 1.1.1.1 log @Initial import of mdoclint-1.0: mdoclint is a tool to verify that man pages follow the conventions for NetBSD (and most other BSDs) regarding structure and macro usage. @ text @@