home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / s / stex2-18.zip / SeeTeX / Iptex / iptex.proto < prev   
Text File  |  1989-11-15  |  3KB  |  120 lines

  1. #!/bin/sh
  2. #
  3. # print a dvi file on the imagen
  4. #
  5. #    The 'bin' symbol will be overwritten with the real name by the
  6. #    install
  7. #
  8. IMAGEN=BIN/imagen1
  9. IPR=IPRBIN/ipr
  10. iprflags=
  11. cflag=-c
  12. flags="-r 300"
  13. sflag="no"
  14. legal="no"
  15. printer=""
  16. preraster="no"
  17. # eat arguments
  18.  
  19. while [ $# -gt 0 ]
  20. do
  21.     case "$1" in
  22.     -force)
  23.         flags="$flags -force";
  24.         cflag=""
  25.         ;;
  26.     -t|-s)        # for TROFF people
  27.         sflag="yes";;
  28.     -P*)
  29.         printer="$1" ;
  30.         ;;
  31.     -A*)
  32.         iprflags="$iprflags $1";;
  33.     -I)
  34.         iprflags="$iprflags $2"
  35.         shift;;
  36. #
  37. #    The following options are for imagen1. We need to know about them
  38. #    to process their arguments
  39. #
  40.     -p|+p|-l|-force|-D|-v|+v|-cwd|-cht)
  41.         flags="$flags $1" ;
  42.         ;;
  43. #
  44. #    At UIUC, legal sized paper can only be printed on imagen-1.
  45. #    An alternative to this code is to restrict the printer choice
  46. #    to one of a number of legal-ready printers.
  47. #
  48.     -legal)
  49.         flags="$flags $1" ;
  50.         legal="yes";
  51.         if [ printer != "-P1" ] ; then
  52.             echo "Legal size selected, Imagen-1 being used" 1>&2
  53.         fi
  54.         printer="-P1"
  55.         ;;
  56.     -preraster)
  57.         preraster="yes"
  58.         ;;
  59.     -rm|-sm|-tm|-m|-r|-d|-e)
  60.         flags="$flags $1 $2" ;
  61.         shift;
  62.         ;;
  63.     *)
  64.         break
  65.     esac
  66.     shift
  67. done
  68.  
  69. if [ $# != 1 ]; then
  70.     echo "Usage: $0 [options] [-I ipr-arg] [imagen1-args] filename" 1>&2
  71.     echo "Option         | Default | Meaning" 1>&2
  72.     echo "-legal         | false   | Use legal sized paper" 1>&2
  73.     echo "-force         | false   | Force the output to be printed" 1>&2
  74.     echo "-s             | false   | Send output to stdout" 1>&2
  75.     echo "-preraster     | false   | Pre-rasterize the output" 1>&2
  76.     echo "-Pprinter      | ip1     | Select printer for output" 1>&2
  77.     echo "-Aacct         |         | Use printing account acct" 1>&2
  78.     echo " " 1>&2
  79.     echo "Imagen1 has the following options" 1>&2
  80.     $IMAGEN -help < /dev/null
  81.     exit 1
  82. fi
  83.  
  84. dvifile=$1
  85.  
  86. if [ ! -r $dvifile ]; then
  87.     dvifile=$1.dvi
  88.     if [ ! -r $dvifile ]; then
  89.         echo "$0: cannot find $1 or $1.dvi" 1>&2
  90.         exit 1
  91.     fi
  92. fi
  93.  
  94. if [ "$cflag" = -c ]; then
  95.     trap 'rm -f /tmp/iptex$$' 0 1 2 3 15
  96.     if $IMAGEN  $flags $dvifile > /tmp/iptex$$; then
  97.         if [ "$sflag" = yes ] ; then
  98.             cat /tmp/iptex$$
  99.         else
  100.         if [ $preraster = "yes" ] ; then
  101.             $IPR -D'jobheader on' -D'prerasterization on' $iprflags $printer /tmp/iptex$$
  102.         else
  103.             $IPR -D'jobheader on' $iprflags $printer /tmp/iptex$$
  104.         fi
  105.         fi
  106.     else
  107.         echo $0': output not spooled (use -c to force)' 1>&2
  108.     fi
  109. else
  110.     if [ "$sflag" = yes ] ; then
  111.         $IMAGEN $flags $dvifile
  112.     else
  113.         if [ $preraster = "yes" ] ; then
  114.         $IMAGEN $flags $dvifile | $IPR -D'jobheader on' -D'prerasterization on' $iprflags $printer /tmp/iptex$$
  115.         else
  116.         $IMAGEN $flags $dvifile | $IPR -D'jobheader on' $iprflags $printer /tmp/iptex$$
  117.         fi
  118.     fi
  119. fi
  120.