# "moan" if files in this directory tree appear to be out-of-date # with respect to a given "master directory". # # a utility to use with link trees! # # usage: # % moan-if-old /src/ghc-master-copy $Verbose = 1; $Usage = "usage: moan-if-old master-dir\n"; if ($#ARGV != 0) { die $Usage; } else { $Master_dir = $ARGV[0]; die "no such dir: $Master_dir\n$Usage" if ! -d $Master_dir; } open(F,"find . -type f -print |") || die "Cannot open find ($!)"; while () { chop; if (! -f "$Master_dir/$_" && ! &junk_file($_) ) { print STDERR "$_ : not in master directory\n"; } elsif (-f "$Master_dir/$_") { $f1 = "$Master_dir/$_"; $f2 = $_; @m_dope = stat($f1); @s_dope = stat($f2); if ($m_dope[9] > $s_dope[9]) { # those are modification times... print STDERR "$f1 ($m_dope[9]) > $f2 ($s_dope[9])\n" if $Verbose; print STDERR "$_ : older\n"; } } } close(F); sub junk_file { local($_) = @_; if ( /~$/ || /\.bak$/ || /-(PREV|OLD|SAVE|NEW)$/ ) { return(1); } else { return(0); } }