summaryrefslogtreecommitdiffstats
path: root/share/man/man0/xrs.pl
diff options
context:
space:
mode:
authorwosch <wosch@FreeBSD.org>1997-09-29 12:41:35 +0000
committerwosch <wosch@FreeBSD.org>1997-09-29 12:41:35 +0000
commit31f0560e23509dd3eda781f63521d51913dd8fd6 (patch)
tree6e84dde4b6c7200105f7948a7dba82cdb4878211 /share/man/man0/xrs.pl
parent21cce1494d4867ab116a5584ed2ebec131e4f380 (diff)
downloadFreeBSD-src-31f0560e23509dd3eda781f63521d51913dd8fd6.zip
FreeBSD-src-31f0560e23509dd3eda781f63521d51913dd8fd6.tar.gz
Case insensitive sort. Ignore troff comments. Bugfixes.
Diffstat (limited to 'share/man/man0/xrs.pl')
-rwxr-xr-xshare/man/man0/xrs.pl15
1 files changed, 12 insertions, 3 deletions
diff --git a/share/man/man0/xrs.pl b/share/man/man0/xrs.pl
index 147c748..cbdbdbf 100755
--- a/share/man/man0/xrs.pl
+++ b/share/man/man0/xrs.pl
@@ -1,5 +1,6 @@
#!/usr/bin/perl
# Copyright (c) 1996 Wolfram Schneider <wosch@FreeBSD.org>. Berlin.
+# All rights reserved.
#
# xrs - detect unsorted cross references in section SEE ALSO
#
@@ -33,6 +34,8 @@ sub mysort {
return $c[1] cmp $d[1];
}
+sub usage { die "usage: xrs manpages ...\n"; }
+
sub compare {
local(*a, *b) = @_;
@@ -46,29 +49,35 @@ sub compare {
for ($i = 0; $i < $#a; $i++) {
return 1 if $a[$i] !~ /\s,\s*$/;
}
+
return 1 if $a[$#a] =~ /\s,\s*$/;
- return 1 if $a[$#a] =~ /^.Xr\s+\S+\s+\S+\s+[^.]$/;
+ return 1 if $a[$#a] =~ /^.Xr\s+\S+\s+\S+\s+[^.\s]/;
return 0;
}
+&usage if $#ARGV >= 0 && $ARGV[0] =~ /^-\?|h/;
while(<>) {
- if (/^\.Sh\s/ && /SEE\s+ALSO/) {
+ if (/^\.Sh\s/ && /"?SEE\s+ALSO"?/) {
$file = $ARGV;
@a = ();
while(<>) {
+ last if $file ne $ARGV;
+
+ next if /^\.\\"\s/; # " ignore comments
+ # next if m%^/[^/]+/%; # ignore absolute path names
if (!/^\.(Xr|Fn)\s/) {
if (!/^\.(Sh|Rs|\\"|Pp|br)\s*/ && !/^\s*$/) {
warn "Oops: $ARGV $_";
}
last;
}
+ tr/A-Z/a-z/;
push(@a, $_);
}
@b = sort mysort @a;
if (&compare(*a,*b)) {
print "$file\n";
- #print "@a\n@b\n";
}
}
last if eof();
OpenPOWER on IntegriCloud