blob: 0503f1085226cee1f8232d3d80fbf956c8e118cb (
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
#!/usr/bin/perl
#/*@@
# @file ThornList.pl
# @date March 2001
# @author Ian Kelley
# @desc
# Either creates a stripped down thornlist of all thorns in the arrangments
# directory, or prints out the full paths to each thorn on a single line
#
# Used primary by the ThornGuide Makefile
# @enddesc
# @version
#@@*/
# give help
if ($h || $help) {
print <<EOC;
--> ThornList.pl <--
Either creates a stripped down thornlist of all thorns in the arrangments directory, or prints out the full paths to each thorn on a single line
Usage:
\t\$ perl -s ThornList.pl -arrangements_dir=/home/ikelley/Cactus/WaveToyC_Dev/arrangements > allthorns.th
\t\$ perl -s ThornList.pl -arrangements_dir=/home/ikelley/Cactus/WaveToyC_Dev/arrangements -thornlist=allthorns.th
EOC
exit 0;
}
if (! defined $arrangements_dir) {
die "\nArrangements directory not defined (-arrangments_dir)";
} elsif ($arrangments_dir !~ /\/$/) {
$arrangements_dir .= '/';
}
# if we are building a thornlist from thorns in $arrangements_dir
if (! defined $thornlist)
{
@arrangements = &FindDirectories($arrangements_dir);
foreach $arrangement (@arrangements)
{
@thorns = &FindDirectories("$arrangements_dir$arrangement");
foreach $thorn (@thorns) {
print "\n$arrangement/$thorn" if ($thorn ne "doc");
}
}
}
# if we are printing all the thorn directories on one line
# for use by the ThornGuide makefile
else
{
$thorn_paths = "";
open (THORNLIST, "<$thornlist") || die "\nCannot open thornlist ($thornlist): $!";
while (<THORNLIST>)
{
next if /\s*?\!/; # bypass any directives
s/(.*?)#.*/\1/; # read up to the first "#"
s/\s+//g; # replace any spaces with nothing
next if ! /\w/; # nothing on this line?
$thorn_paths .= "$arrangements_dir$_ ";
}
close (THORNLIST);
print $thorn_paths;
}
## END: MAIN ##
#/*@@
# @routine FindDirectories
# @date Sun Mar 3 01:54:37 CET 2002
# @author Ian Kelley
# @desc
# Grabs all directories within a given directory, minus the ones created by CVS
# @enddesc
# @version
#@@*/
sub FindDirectories
{
my (@good_directories);
chdir ("$start_directory") || die "\nCannot chdir to $start_directory: $!";
chdir("$_[0]") || die "\nCannot change directory to $_[0] : $!";
open(LS, "ls -F|");
while(chomp($name = <LS>))
{
next if (! -d $name);
if (($name ne "History/") && ($name ne "CVS/"))
{
$name =~ s#/##;
push(@good_directories, $name);
}
}
close(LS);
chdir ($start_directory);
return (@good_directories);
} ## END :Find_Directories:
|