-
Notifications
You must be signed in to change notification settings - Fork 1
/
Detrail
executable file
·48 lines (38 loc) · 1013 Bytes
/
Detrail
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
#! /usr/bin/perl
# This script scans the relevant parts of the xfpt tree and detrails
# all the files. Adapted from my general "detrail" script.
# This subroutine does the work for one file.
sub detrail {
my($file) = $_[0];
my($changed) = 0;
open(FIN, "$file") || die "Can't open $file for input";
@lines = <FIN>;
close(FIN);
foreach (@lines)
{
if (/[ \t]+\n$/)
{
s/[ \t]+\n$/\n/;
$changed = 1;
}
}
if ($changed)
{
print " $file\n";
open(OUT, ">$file") || die "Can't open $file for output";
print OUT @lines;
close(OUT);
}
}
# This is the main program
print "Detrailing ...\n";
$, = ""; # Output field separator
# Individual files
for $file ("README", "Makefile.in", "ChangeLog", "src/Makefile")
{ &detrail($file); }
# Now run "find" to get source files.
open (IN, "find -L src share \\( -name '*.h' -o -name '*.c' \\) -type f -print |") ||
die "Can't run the 'find' command";
while (<IN>) { chomp; &detrail($_); }
close(IN);
# End