#! /bin/csh -f # # Based on printscribe which is a Copyright IBM utility. # For full copyright information see 'andrew/config/COPYRITE' # $Header: /obj/v6src/RCS/ez2ps,v 1.2 1992/07/24 23:01:42 gk5g R6tape $ # $Author: gk5g $ # $Source: /obj/v6src/RCS/ez2ps,v $ # use clever csh bits to discover if we should act like a filter, or emit # files. Output filenames are the input filename with .PS appended # GROSSNESS: We need to assemble a list of args to pass through to # ezprint. This means we need to know what they all are, so we can # preserve more than just flags. (like -o filename). # So if new args come along that we want to forward to ezprint, we # have to add them here. # We also delete certain args like -S which don't make any sense. # # Any args we don't understand are passed thru as booleans. # Any arg not begining with a dash that isn't parsed out of a command # arg is assumed to be a file. # If we go through all the args and never print a file, we assume we're a # pipe. # # For my next trick, I will invent infinite improbability drive -wdc. set PASSTHRU="" while ($#argv > 0) switch($1) case -e: case -c: case -C: case -N: case -T: case -n: case -o: case -O: case -a: case -m: case -l: case -v: set PASSTHRU="$PASSTHRU $1" shift if ($#argv == 0) then echo ez2ps: Missing argument -- try again. exit (-1) endif set PASSTHRU="$PASSTHRU $1" breaksw case -S: shift if ($#argv == 0) then echo ez2ps: Missing argument -- try again. exit (-1) endif breaksw case -S*: case -s*: breaksw case -q*: case -i*: case -I*: case -E*: case -C*: case -p*: case -t*: case -h*: case -n*: case -V*: case -z*: case -FE*: case -Fe*: case -*: set PASSTHRU="$PASSTHRU $1" breaksw default: # Set pipeline based on whether you have ditroff et al or not set p1 = "geqn" set p2 = "gtbl" set p3 = "groff -Tps" set wh = `which psdit` if ( $#wh < 4) then set p1 = "eqn" set p2 = "ditroff -Tpsc" set p3 = "psdit" endif if ($#argv > 2) then echo ez2ps: Last two args should be files. exit (-1) else if ($#argv == 2) then exec ezprint -q -t $PASSTHRU $1 | $p1 | $p2 | $p3 > ${2} exit (0) else if ($#argv == 1) then exec ezprint -q -t $PASSTHRU $1 | $p1 | $p2 | $p3 exit (0) endif endsw shift end exec ezprint -q -s -t $PASSTHRU | $p1 | $p2 | $p3