#!/usr/bin/perl
#
-# $OpenBSD: mdoclint,v 1.69 2017/06/17 19:17:41 schwarze Exp $
+# $OpenBSD: mdoclint,v 1.70 2017/06/23 19:07:25 schwarze Exp $
# $NetBSD: mdoclint,v 1.77 2017/06/08 10:19:56 wiz Exp $
#
# Copyright (c) 2001-2017 Thomas Klausner
use vars qw(
$opt_D $opt_F $opt_h
- $opt_m $opt_o $opt_p $opt_r $opt_S $opt_v $opt_w $opt_x
+ $opt_m $opt_o $opt_p $opt_S $opt_v $opt_w $opt_x
);
my $arch=`uname -m`;
chomp($arch);
-my $options="DFhmoprSvwx";
+my $options="DFhmopSvwx";
sub usage
{
-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 -DmoprSx if no flag is specified.
+Default is -DmopSx if no flag is specified.
EOF
exit(0);
}
$opt_h and usage();
# default to all warnings if no flag is set
- unless ($opt_D or $opt_m
- or $opt_o or $opt_p or $opt_r or $opt_S or $opt_x) {
- $opt_D = $opt_m =
- $opt_o = $opt_p = $opt_r = $opt_S = $opt_x = 1;
+ unless ($opt_D or $opt_m or $opt_o or $opt_p or $opt_S or $opt_x) {
+ $opt_D = $opt_m = $opt_o = $opt_p = $opt_S = $opt_x = 1;
}
}
all => [],
lastline => '',
changes => 0,
- oxrcsidseen => 0,
- nxrcsidseen => 0,
- inliteral => 0,
shseen => {},
current_section_header => '',
sec => '0',
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 (/^\.Bd\b.*-(?:literal|unfilled)\b/o) {
- $s->{inliteral} = 1;
- }
- if ($s->{inliteral} == 1) {
- if (/^\.Ed\b/o) {
- $s->{inliteral} = 0;
- }
- }
-
$s->{lastline} = $_;
return "$_\n";
}
{
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})) {
-.\" $OpenBSD: mdoclint.1,v 1.27 2017/06/17 19:17:41 schwarze Exp $
+.\" $OpenBSD: mdoclint.1,v 1.28 2017/06/23 19:07:25 schwarze Exp $
.\" $NetBSD: mdoclint.1,v 1.23 2017/06/08 10:19:56 wiz Exp $
.\"
.\" Copyright (c) 2001-2013 Thomas Klausner
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: June 17 2017 $
+.Dd $Mdocdate: June 23 2017 $
.Dt MDOCLINT 1
.Os
.Sh NAME
.Nd man page verifier
.Sh SYNOPSIS
.Nm
-.Op Fl DFhmoprSvwx
+.Op Fl DFhmopSvwx
.Ar
.Sh DESCRIPTION
.Nm
It tries to automatically find as many common
errors that occur when writing man pages as possible.
If no flags are given,
-.Fl DmoprSx
+.Fl DmopSx
is assumed (that is, everything except
.Fl Fhvw ) .
.Pp
.It Fl p
Warn about possible punctuation problems at the end of macro arguments
and abuse of .Ns to get punctuation directly next to a word.
-.It Fl r
-Warn about missing RCS Id.
.It Fl S
Warn about any unknown sections or about a section that comes in the
wrong order (see