]>
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 |
bc19f2cf | 16 | ken |
17 | ky00te | |
0652168f | 18 | rasterman |
dc17484a | 19 | ); |
20 | ||
21 | @nonfree= qw( | |
7e3afbba | 22 | newspeak |
7e3afbba | 23 | ); |
24 | ||
dc17484a | 25 | # Test to see if non-free filters are here, if so, add them to @all. |
26 | foreach (@nonfree) { | |
27 | if (-x "/usr/games/$_") { | |
28 | push @all, $_; | |
29 | } | |
30 | } | |
31 | ||
7e3afbba | 32 | # shuffle order |
33 | srand; | |
34 | for (0..$#all) { | |
35 | my $n= @all*rand; | |
36 | my $was= $all[$_]; | |
37 | $all[$_]= $all[$n]; | |
38 | $all[$n]= $was; | |
39 | } | |
40 | ||
41 | # start the pipe... | |
42 | my $pipe= join '|', @all; | |
43 | open FILTER, "$pipe|" | |
44 | or die ""Never mind...\n";; | |
45 | ||
46 | # display the results | |
47 | while (<FILTER>) { | |
48 | print $_ | |
49 | } | |
50 | ||
51 | # This could be optimized: take the last program off the pipeline, | |
52 | # open the pipeline as standard input, then exec that last program. | |
53 | # | |
54 | # But you have to ask yourself: how important is it to optimize | |
55 | # the generation of jibberish? |