4 # Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved.
6 # This program is free software; you can redistribute it and/or modify it
7 # under the terms of version 2 of the GNU General Public License as
8 # published by the Free Software Foundation.
10 # This program is distributed in the hope that it would be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 # Further, this software is distributed without any warranty that it is
15 # free of the rightful claim of any third person regarding infringement
16 # or the like. Any license provided herein, whether implied or
17 # otherwise, applies only to this software file. Patent licenses, if
18 # any, provided herein do not apply to combinations of this program with
19 # other software, or any other product whatsoever.
21 # You should have received a copy of the GNU General Public License along
22 # with this program; if not, write the Free Software Foundation, Inc., 59
23 # Temple Place - Suite 330, Boston MA 02111-1307, USA.
25 # Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
26 # Mountain View, CA 94043, or:
30 # For further information regarding this notice, see:
32 # http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
36 # traverse the entire filesystem dumping info.
50 unless (@stat=lstat("$file")) {
51 printf("%-" . ($opt{v}?65:32) . "s $file\n", "!!! could not lstat");
55 $stat[0]=$stat[8]=""; # wipe the device and access time
57 $md5->add(join(" ",@stat));
59 print join(" ",@stat), "\n";
62 print $md5->hexdigest . " ";
67 if (!defined($link = readlink $file)) {
68 printf("%-32s $file\n", "!!! could not readlink");
72 } elsif (-f "$file") {
73 if (!open(FILE, "$file")) {
74 printf("%-32s $file\n", "!!! could not read");
80 print $md5->hexdigest . " $file\n";
85 die "Usage: $0 <dir>\n" unless (@ARGV == 1);
88 die "can't read $dir\n" unless (-r $dir);
89 die "$dir is not a directory\n" unless (-d _);
91 chomp($HOST = `hostname -s`);
93 print "*** fs-walk host $HOST dir $dir\n";
96 while ($dir = shift @todo) {
98 unless (opendir(DIR,$dir)) {
99 printf("%-" . ($opt{v}?65:32) . "s $dir\n", "!!! could not opendir");
102 unless (@all=readdir(DIR)) {
103 printf("%-" . ($opt{v}?65:32) . "s $dir\n", "!!! could not readdir");
107 @dirs=grep(-d "$dir/$_" && !-l "$dir/$_", @all);
113 foreach (grep(!/^\.\.?$/, @dirs)) {
114 push (@todo,"$dir/$_");