# $dev < 0 &&
# ($prune = 1);
# }
+#
+# Set the variable $dont_use_nlink if you're using AFS, since AFS cheats.
sub find {
chop($cwd = `pwd`);
($dir,$_) = ($topdir,'.');
$name = $topdir;
&wanted;
- $topdir =~ s,/$,, ;
- &finddir($topdir,$topnlink);
+ ($fixtopdir = $topdir) =~ s,/$,, ;
+ &finddir($fixtopdir,$topnlink);
}
else {
warn "Can't cd to $topdir: $!\n";
unless (($dir,$_) = $topdir =~ m#^(.*/)(.*)$#) {
($dir,$_) = ('.', $topdir);
}
+ $name = $topdir;
chdir $dir && &wanted;
}
chdir $cwd;
# Get the list of files in the current directory.
- opendir(DIR,'.') || warn "Can't open $dir: $!\n";
+ opendir(DIR,'.') || (warn "Can't open $dir: $!\n", return);
local(@filenames) = readdir(DIR);
closedir(DIR);
- if ($nlink == 2) { # This dir has no subdirectories.
+ if ($nlink == 2 && !$dont_use_nlink) { # This dir has no subdirectories.
for (@filenames) {
next if $_ eq '.';
next if $_ eq '..';
$nlink = $prune = 0;
$name = "$dir/$_";
&wanted;
- if ($subcount > 0) { # Seen all the subdirs?
+ if ($subcount > 0 || $dont_use_nlink) { # Seen all the subdirs?
# Get link count and check for directoriness.