home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2 / Openstep-4.2-Intel-User.iso / usr / bin / ptroff < prev    next >
Text File  |  1997-03-29  |  2KB  |  70 lines

  1. #! /bin/sh
  2. # sh/ptroff.bsd
  3. # Copyright 1985,1987 Adobe Systems Incorporated. All rights reserved.
  4. # GOVERNMENT END USERS: See notice of rights in Notice file in TranScript
  5. # library directory -- probably /usr/lib/ps/Notice
  6. # RCSID: $Header: /disks/hobo/vp6/snichols/rel3.0/transcript/sh/RCS/ptroff.bsd,v 3.0 1991/06/17 17:29:09 snichols Exp $
  7. #
  8. # run troff in an environment to print on a PostScript printer
  9. #
  10. # ptroff - troff | pscat [| lpr]
  11. PATH=/bin:/usr/bin:$PATH       # Make sure we get system programs.
  12. export PATH
  13.  
  14. opt= spool= pscatopt=
  15. psfontlib=/usr/lib/transcript/troff.font
  16. font=-F${psfontlib}
  17. family=Times
  18.  
  19. # NeXT default printer
  20. printer=`dread System Printer`
  21. if test "$?" -ne 0 ; then
  22.     printer=-PLocal_Printer
  23. else
  24.     printer=-P`dread System Printer | sed -e 's/.* //'`
  25. fi
  26.  
  27. while test $# != 0
  28. do    case "$1" in
  29.     -F)    if test "$#" -lt 2 ; then
  30.             echo '-F takes following font family name' 1>&2
  31.             exit 1 
  32.         fi
  33.         family=$2 ; shift ;;
  34.     -F*)    echo 'use -F familyname' 1>&2 ;
  35.         exit 1 ;;
  36.     -t)    nospool=1 ;;
  37.     -#*|-h|-m)    spool="$spool $1" ;;
  38.     -P*)    printer=$1 ;;
  39.     -C)    spool="$spool $1 $2"
  40.         classname=$2 ; shift ;;
  41.     -J)    jobname=$2 ; shift ;;
  42.     -l)    pscatopt="$pscatopt $1 $2"
  43.         shift ;;
  44.     -s)    pscatopt="$pscatopt $1 $2"
  45.         shift ;;
  46.  
  47.     -)    fil="$fil $1" ;;
  48.     -*)    opt="$opt $1" ;;
  49.  
  50.     *)    fil="$fil $1" ; jobname=${jobname-$1} ;;
  51.     esac
  52.     shift
  53. done
  54. spool="$printer $spool"
  55. if test "$jobname" = "" ; then
  56.     jobname="Troff"
  57. fi
  58. spool="-J $jobname $spool"
  59. if test "$fil" = "" ; then
  60.     fil="-"
  61. fi
  62. troff="troff -F${psfontlib}/${family}/ftXX -t $opt ${psfontlib}/${family}/font.head $fil "
  63. pscat="pscat -F${psfontlib}/${family}/font.ct $pscatopt"
  64.  
  65. if test "$nospool" = "1" ; then
  66.     $troff | $pscat
  67. else
  68.     $troff | $pscat | lpr $spool
  69. fi
  70.