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