-frob() {
-
- w_h=`head -2 $tmp_ppm1 | tail -1`
- width=`echo $w_h | awk '{print $1}'`
- height=`echo $w_h | awk '{print $2}'`
-
- N=`rand 17`
-
- if [ "$verbose" = true ]; then
- echo "mode $N..." >&2
- fi
-
- if [ $N = 0 ]; then
- ppmtopgm $tmp_ppm1 | pgmedge | pgmtoppm `randcolor` | ppmnorm
-
- elif [ $N = 1 ]; then
- ppmtopgm $tmp_ppm1 |
- pgmenhance |
- pgmtoppm `randcolor`
-
- elif [ $N = 2 ]; then
- ppmtopgm $tmp_ppm1 | pgmoil | pgmtoppm `randcolor`
-
- elif [ $N = 3 ]; then
- ppmrelief $tmp_ppm1 | ppmtopgm | pgmedge | ppmrelief | ppmtopgm |
- pgmedge | pnminvert | pgmtoppm `randcolor`
-
- elif [ $N = 4 ]; then
- ppmspread 71 $tmp_ppm1 > $tmp_ppm2
- pnmarith -add $tmp_ppm1 $tmp_ppm2
-
- elif [ $N = 5 ]; then
- pnmflip -lr $tmp_ppm1 > $tmp_ppm2
- pnmarith -multiply $tmp_ppm1 $tmp_ppm2 > $tmp_ppm3
- pnmflip -tb $tmp_ppm3 | ppmnorm > $tmp_ppm2
- pnmarith -multiply $tmp_ppm1 $tmp_ppm2
-
- elif [ $N = 6 ]; then
- N2=`rand 3`
- if [ $N2 = 0 ]; then
- pnmflip -lr $tmp_ppm1 > $tmp_ppm2
- elif [ $N2 = 1 ]; then
- pnmflip -tb $tmp_ppm1 > $tmp_ppm2
- else
- pnmflip -lr $tmp_ppm1 > $tmp_ppm2
- pnmflip -tb $tmp_ppm2 > $tmp_ppm3
- cp $tmp_ppm3 $tmp_ppm2
- fi
-
- pnmarith -difference $tmp_ppm1 $tmp_ppm2
-
- elif [ $N = 7 ]; then
-
- for i in 1 2 3 ; do
- ppmtopgm $tmp_ppm1 | pgmedge > $tmp_ppm2
- pnmarith -difference $tmp_ppm1 $tmp_ppm2 > $tmp_ppm3
- cp $tmp_ppm3 $tmp_ppm1
- done
- ppmnorm < $tmp_ppm1
-
- elif [ $N = 8 ]; then
- pnmflip -lr $tmp_ppm1 > $tmp_ppm2
- pnmarith -multiply $tmp_ppm1 $tmp_ppm2 | ppmrelief | ppmnorm | pnminvert
-
- elif [ $N = 9 ]; then
- pnmflip -lr $tmp_ppm1 > $tmp_ppm2
- pnmarith -subtract $tmp_ppm1 $tmp_ppm2 | ppmrelief | ppmtopgm | pgmedge
-
- elif [ $N = 10 ]; then
- ppmtopgm $tmp_ppm1 | pgmbentley | pgmtoppm `randcolor`
-
- elif [ $N = 11 ]; then
- pgmcrater -number 20000 -height $height -width $width | pgmtoppm `randcolor` > $tmp_ppm2
- pnmarith -difference $tmp_ppm1 $tmp_ppm2 > $tmp_ppm3
- pnmflip -tb $tmp_ppm3 | ppmnorm > $tmp_ppm2
- pnmarith -multiply $tmp_ppm1 $tmp_ppm2
-
- elif [ $N = 12 ]; then
- ppmshift 30 $tmp_ppm1 | ppmtopgm | pgmoil | pgmedge | pgmtoppm `randcolor` > $tmp_ppm2
- pnmarith -difference $tmp_ppm1 $tmp_ppm2
-
- elif [ $N = 13 ]; then
- ppmpat -madras $width $height | pnmdepth 255 > $tmp_ppm2
- pnmarith -difference $tmp_ppm1 $tmp_ppm2
-
- elif [ $N = 14 ]; then
- ppmpat -tartan $width $height | pnmdepth 255 > $tmp_ppm2
- pnmarith -difference $tmp_ppm1 $tmp_ppm2
-
- elif [ $N = 15 ]; then
- ppmpat -camo $width $height | pnmdepth 255 | ppmshift 50 > $tmp_ppm2
- pnmarith -multiply $tmp_ppm1 $tmp_ppm2
-
- elif [ $N = 16 ]; then
- pgmnoise $width $height | pgmedge | pgmtoppm `randcolor` > $tmp_ppm2
- pnmarith -difference $tmp_ppm1 $tmp_ppm2 | pnmdepth 255 | pnmsmooth
-
- else cat $tmp_ppm1
- fi
+sub pick_displayer {
+ my @names = ();
+
+ foreach my $cmd (@displayer_programs) {
+ $_ = $cmd;
+ my ($name) = m/^([^ ]+)/;
+ push @names, "\"$name\"";
+ print STDERR "$progname: looking for $name...\n" if ($verbose > 2);
+ foreach my $dir (split (/:/, $ENV{PATH})) {
+ print STDERR "$progname: checking $dir/$name\n" if ($verbose > 3);
+ return $cmd if (-x "$dir/$name");
+ }
+ }
+
+ $names[$#names] = "or " . $names[$#names];
+ printf STDERR "$progname: none of: " . join (", ", @names) .
+ " were found on \$PATH.\n";
+ exit 1;