#! /bin/csh -f -e set usage = "$0 [ SCALESPECS ] OPTIONS [ < ] INFILE.ppm > OUTFILE.gif" # Same as linear-ppm-to-gif (q.v.), but apples first pnmscale with # the SCALESPECS arguments. if ( ( $#argv >= 1 ) && ( "x$1" !~ x-* ) ) then set scalespecs = ( "$1" ); shift; else if ( ( $#argv >= 2 ) && ( \ ( "x$1" == "x-xsize" ) || \ ( "x$1" == "x-ysize" ) || \ ( "x$1" == "x-xscale" ) || \ ( "x$1" == "x-yscale" ) || \ ( "x$1" == "x-width" ) || \ ( "x$1" == "x-height" ) || \ ( "x$1" == "x-pixels" ) || \ ) ) then set scalespecs = ( "$1" "$2" ); shift; shift; else if ( ( $#argv >= 3 ) && ( "x$1" == "x-xysize" ) ) then set scalespecs = ( "$1" "$2" "$3" ); shift; shift; shift; else echo "usage: ${usage}"; exit 1 endif @ n = $#argv set cmd = ( "cat" ) if ( $n >= 1 ) then set infile = "$argv[$n]" if ( "x${infile:e}" == "xppm" ) then set cmd = ( "cat" "${infile}" ) @ n = $n - 1 endif endif set options = ( $argv[1-$n] ) set tmp = "/tmp/$$" ${cmd} | pnmscale ${scalespecs} > ${tmp} linear-ppm-to-gif ${options} < ${tmp} /bin/rm ${tmp}