aboutsummaryrefslogtreecommitdiff
path: root/gnu/usr.bin/man/makewhatis/makewhatis.perl
diff options
context:
space:
mode:
authorJoerg Wunsch <joerg@FreeBSD.org>1995-02-26 19:35:06 +0000
committerJoerg Wunsch <joerg@FreeBSD.org>1995-02-26 19:35:06 +0000
commitdef5a1b108486dfcc5f1f2d27d84e2987afcdf7f (patch)
tree70a4874668e64fa7ef16ecfc18459f3c4eb565f0 /gnu/usr.bin/man/makewhatis/makewhatis.perl
parenta44078d03f321fc18343fa5515c6205ba8926b2c (diff)
downloadsrc-def5a1b108486dfcc5f1f2d27d84e2987afcdf7f.tar.gz
src-def5a1b108486dfcc5f1f2d27d84e2987afcdf7f.zip
Patch bei Wolfram to avoid processing duplicate directories.
Submitted by: wosch@cs.tu-berlin.de (Wolfram Schneider)
Notes
Notes: svn path=/head/; revision=6739
Diffstat (limited to 'gnu/usr.bin/man/makewhatis/makewhatis.perl')
-rw-r--r--gnu/usr.bin/man/makewhatis/makewhatis.perl26
1 files changed, 23 insertions, 3 deletions
diff --git a/gnu/usr.bin/man/makewhatis/makewhatis.perl b/gnu/usr.bin/man/makewhatis/makewhatis.perl
index ff1100220929..3fd88521d9b2 100644
--- a/gnu/usr.bin/man/makewhatis/makewhatis.perl
+++ b/gnu/usr.bin/man/makewhatis/makewhatis.perl
@@ -10,6 +10,11 @@
# 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.
+# 3. All advertising materials mentioning features or use of this software
+# must display the following acknowledgement:
+# This product includes software developed by Wolfram Schneider
+# 4. The name of the author may not be used to endorse or promote products
+# derived from this software without specific prior written permission
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -186,6 +191,18 @@ EOF
return 1;
}
+sub dir_redundant {
+ local($dir) = @_;
+
+ local ($dev,$ino) = (stat($dir))[0..1];
+
+ if ($dir_redundant{"$dev.$ino"}) {
+ warn "$dir is equal to: $dir_redundant{\"$dev.$ino\"}\n" if $debug;
+ return 0;
+ }
+ $dir_redundant{"$dev.$ino"} = $dir;
+ return 1;
+}
# ``/usr/man/man1/foo.l'' -> ``l''
@@ -345,6 +362,7 @@ $whatisdb = '';
$counter_all = 0;
$err = 0;
$format = 24;
+$dir_redundant = ''; #
while ($_ = $ARGV[0], /^-/) {
@@ -363,15 +381,17 @@ while ($_ = $ARGV[0], /^-/) {
@argv = split($", join($", (split(/:/, join($", @ARGV))))); #"
if ($outfile) {
- &open_output($outfile) && &find_manuals(@argv);
+ if(&open_output($outfile)){
+ foreach $dir (@argv) { &dir_redundant($dir) && &find_manuals($dir); }
+ }
&close_output(1);
} else {
foreach $dir (@argv) {
- &close_output(&open_output($dir) && &find_manuals($dir));
+ &dir_redundant($dir) &&
+ &close_output(&open_output($dir) && &find_manuals($dir));
}
}
warn "Total entries: $counter_all\n" if $debug && ($#argv > 0 || $outfile);
exit $err;
-