summaryrefslogtreecommitdiff
path: root/web/glasgow/lit2x-0.16/grasp-utils/scripts/moan-if-old.prl
blob: 9b7c0b98bc26465e2eb031b65c1381df23c0f181 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#   "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 (<F>) {
    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);
    }
}