File: prcs-clean

package info (click to toggle)
prcs 1.2.15-6
  • links: PTS
  • area: main
  • in suites: potato
  • size: 2,928 kB
  • ctags: 3,129
  • sloc: cpp: 16,742; ansic: 5,725; sh: 2,545; lisp: 1,812; perl: 642; lex: 351; makefile: 165; pascal: 85
file content (42 lines) | stat: -rwxr-xr-x 760 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/perl

%allfiles = ( );

if ($#ARGV != 0) {
    die ("One argument please");
}

$project = $ARGV[0];
($progname = $0) =~ s/.*\///;

print $progname,": cleaning project ",$project,"\n";

open(ALLFILES, "find . -type f -print|") || die ("find failed");

while (<ALLFILES>) {
    chop;
    $allfiles{$_} = 1;
}

wait;

die ("find failed") if ($? != 0);

open(PRCSFILES, "prcs execute ./ |") || die ("prcs failed");

while (<PRCSFILES>) {
    chop;
    delete $allfiles{"./" . $_};
}

wait;

die ("prcs failed") if ($? != 0);

delete $allfiles{"./" . $project . ".prj"};
delete $allfiles{"./." . $project . ".prcs_aux"};

foreach $key (keys %allfiles) {
    print $progname,": deleting ",$key,"\n";
    unlink ($key) || warn ("unlink failed on $key");
}