]>
Commit | Line | Data |
---|---|---|
7e3afbba | 1 | #!/usr/bin/perl |
2 | # jibberish -- run all filters in random order | |
3 | ||
4 | $ENV{PATH}.=":/usr/games"; | |
5 | ||
6 | @all= qw( | |
dc17484a | 7 | eleet |
8 | b1ff | |
9 | chef | |
10 | jethro | |
11 | upside-down | |
12 | kraut | |
13 | cockney | |
7e3afbba | 14 | jive |
7e3afbba | 15 | nyc |
dc17484a | 16 | ); |
17 | ||
18 | @nonfree= qw( | |
19 | kyoote | |
7e3afbba | 20 | newspeak |
7e3afbba | 21 | ); |
22 | ||
dc17484a | 23 | # Test to see if non-free filters are here, if so, add them to @all. |
24 | foreach (@nonfree) { | |
25 | if (-x "/usr/games/$_") { | |
26 | push @all, $_; | |
27 | } | |
28 | } | |
29 | ||
7e3afbba | 30 | # shuffle order |
31 | srand; | |
32 | for (0..$#all) { | |
33 | my $n= @all*rand; | |
34 | my $was= $all[$_]; | |
35 | $all[$_]= $all[$n]; | |
36 | $all[$n]= $was; | |
37 | } | |
38 | ||
39 | # start the pipe... | |
40 | my $pipe= join '|', @all; | |
41 | open FILTER, "$pipe|" | |
42 | or die ""Never mind...\n";; | |
43 | ||
44 | # display the results | |
45 | while (<FILTER>) { | |
46 | print $_ | |
47 | } | |
48 | ||
49 | # This could be optimized: take the last program off the pipeline, | |
50 | # open the pipeline as standard input, then exec that last program. | |
51 | # | |
52 | # But you have to ask yourself: how important is it to optimize | |
53 | # the generation of jibberish? |