| 1 |
#!/usr/bin/perl -w |
| 2 |
# |
| 3 |
# Generate a list of all files under the current directory and dump them |
| 4 |
# to console in the format required by FILES |
| 5 |
|
| 6 |
use strict; |
| 7 |
|
| 8 |
sub listdir { |
| 9 |
my ($curdir) = @_; |
| 10 |
my ($f); |
| 11 |
|
| 12 |
# We can only handle plain files and directories |
| 13 |
foreach $f (glob("*")) { |
| 14 |
# Don't go into CVS directories |
| 15 |
next if ($f eq "CVS"); |
| 16 |
next if ($f =~ /~$/); |
| 17 |
next if ($f eq "autoconf.h"); |
| 18 |
next if ($f =~ /\.o$/); |
| 19 |
if (-d $f) { |
| 20 |
# Recurse all directories with a depth-first traversal |
| 21 |
chdir("$f"); |
| 22 |
if ($curdir ne ".") { |
| 23 |
listdir("$curdir/$f"); |
| 24 |
} else { |
| 25 |
listdir("$f"); |
| 26 |
} |
| 27 |
chdir(".."); |
| 28 |
} else { |
| 29 |
# Print a plain file to console |
| 30 |
if ($curdir ne ".") { |
| 31 |
printf "$curdir/$f\n"; |
| 32 |
} else { |
| 33 |
printf "$f\n"; |
| 34 |
} |
| 35 |
} |
| 36 |
} |
| 37 |
} |
| 38 |
|
| 39 |
listdir("."); |
| 40 |
exit 0; |