]> git.donarmstrong.com Git - lilypond.git/blob - bin/wild-perl
release: 0.1.49
[lilypond.git] / bin / wild-perl
1 # -*- perl -*-
2 ##! @PERL@
3
4 @ignorestuff = ();
5
6 sub ignore_query
7 {
8     my ($testfile) = @_;
9     return !grep(/$testfile/, @ignorestuff);
10 }
11
12 while (<>) {
13         $line = $_;
14         if ($line =~ /^ *nowildcard: *(.*)$/) {
15             $ignore = $1;
16             @ignorelist = split (/ +/, $ignore);
17             foreach $i (@ignorelist) {
18                 print "# ignoring wildcards for \`$i\'\n";
19                 push @ignorestuff, $i; # concat ? uh?
20             }
21
22             
23         } elsif ($line =~ /(.*)\$\(wildcard(.*)\)(.*)/) {
24             $wild = $2;
25             
26             @expanded = glob ($wild);
27
28             @expanded = grep {ignore_query($_);}  @expanded;
29             
30             print $1 . join (' ', @expanded) . $3 . "\n";
31         } else {
32             print $line;
33         }
34 }