diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2015-12-06 08:55:10 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2015-12-06 08:55:10 +0000 |
commit | 088fe9d2b8960a37da54c62ffc66ee5b53869929 (patch) | |
tree | a02f5f9897457c2aa0e233c84931cd3e388f854b | |
parent | 72db89765c17e6cb7880c421a157fbbdcebe1b63 (diff) |
Check .Xr links by forking "man -f" rather than manually looking
through manual page directories. It's slower but more robust
because it doesn't require MLINKS.
Fragility noticed and patch OK'ed by jmc@.
-rw-r--r-- | regress/usr.bin/mdoclint/mdoclint | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/regress/usr.bin/mdoclint/mdoclint b/regress/usr.bin/mdoclint/mdoclint index 617df2a9da6..11ed090db38 100644 --- a/regress/usr.bin/mdoclint/mdoclint +++ b/regress/usr.bin/mdoclint/mdoclint @@ -1,6 +1,6 @@ #!/usr/bin/perl # -# $OpenBSD: mdoclint,v 1.46 2015/12/01 22:27:28 jmc Exp $ +# $OpenBSD: mdoclint,v 1.47 2015/12/06 08:55:09 schwarze Exp $ # $NetBSD: mdoclint,v 1.49 2014/06/23 18:10:21 wiz Exp $ # # Copyright (c) 2001-2013 Thomas Klausner @@ -272,11 +272,19 @@ sub verify_xref $self->warning("Xref to itself (use .Nm instead)") if $opt_x; } # try to find corresponding man page - 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"; + if (OPENBSD) { + open my $saveout, '>&', STDOUT; + open STDOUT, '>', '/dev/null'; + my $irc = system 'man', '-M', '/usr/share/man:/usr/X11R6/man', + '-s', $section, '-f', $page; + open STDOUT, '>&', $saveout; + 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"; + } } } } |