home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 200.img / SCO386X3.TD0 / usr / spool / lp / model / imagen.pbs < prev    next >
Encoding:
Text File  |  1987-04-13  |  4.9 KB  |  261 lines

  1. :
  2. #    @(#) imagen.sh 1.2 86/12/17 
  3. #
  4. #    Copyright (C) The Santa Cruz Operation, 1986.
  5. #    This Module contains Proprietary Information of
  6. #    The Santa Cruz Operation, Microsoft Corporation
  7. #    and AT&T, and should be treated as Confidential.
  8. #
  9.  
  10. :
  11. #    IMAGEN SYSTEM V Spooler Interface
  12. #    for spooling impress, text, troff input, and troff output files
  13. #
  14. #    Install with:
  15. #
  16. #        lpadmin -p$printer -v$device -iimagen.$type
  17. #
  18. #    Where:    $printer    - name associated with printer
  19. #        $device        - physical device line
  20. #        $type        - communications interface:
  21. #                    sbs    Serial Byte Stream.
  22. #                    pbs    Parallel Byte Stream.
  23. #                    spp    Sequence Packet Protocol.
  24. #    Invoke with:
  25. #
  26. #        lp -d$printer -n$copies -t$title [opts] files
  27. #
  28. #    Legal opts values are:
  29. #
  30. #        -oli    - input file is language imPress
  31. #        -olp    - input file is text for line printing
  32. #        -olt    - input file is old style troff input
  33. #        -olfi    - input file is full imPress file
  34. #              (already has document header)
  35. #        -oldvi    - input file is dvi format (TEX output)
  36. #        -olc    - input file is C/A/T format (old style troff output)
  37. #        -ot$flags- options to be passed to troff
  38. #              ( e.g. "-ot-ms" )
  39. #        -ov$flags- options to be passed to dviimp
  40. #              ( e.g. "-od-d" )
  41. #        -oc$flags- options to be passed to catimp
  42. #              ( e.g. "-od-v" )
  43. #        -ob    - toggle id banner generation
  44. #        -ohname    - host machine is <name>
  45. #        -ouname    - charge printing to user <name>
  46. #        -oixxx    - document header flags for impress where xxx is
  47. #            2 - print two forms per page
  48. #            O - print outline on page
  49. #            r - toggle page reversal
  50. #            c - toggle page collation
  51. #            J - toggle printing of job header page
  52. #            R - print rules on page
  53. #            m - toggle error message detail
  54. #            j - toggle jam resistance
  55. #
  56. #####################################################################
  57. #
  58. #    Portions Copyright (c) 1985 IMAGEN Corporation.
  59. #    Portions Copyright (c) 1985,1986 The Santa Cruz Operation, Inc.
  60. #    All rights reserved.
  61. #    XENIX is a registered trademark of Microsoft Corporation.
  62. #
  63.  
  64. PATH=/bin:/usr/bin
  65.  
  66. comm=/usr/lib/ipbs
  67. stsfile=/usr/spool/lp/imagen.sts
  68. logfile=/usr/spool/lp/imagen.log
  69. account=/usr/adm/imagen
  70.  
  71. #
  72. #    programs and filters
  73. #
  74. itroff=itroff
  75. dviimp=dviimp
  76. catimp=catimp
  77.  
  78. #
  79. # default settings
  80. #
  81.  
  82. DFLFILE=/etc/default/imagen
  83. [ -r $DFLFILE ] && . $DFLFILE
  84. : ${JAMPROOF:=no}
  85.  
  86. #
  87. #    options for document control
  88. #
  89. ftype=printer
  90. forms=1
  91. outlines=off
  92. jobheader=on
  93. pagereversal=off
  94. pagecollation=on
  95. rules=off
  96. banner=on
  97. jamresistance=$JAMPROOF
  98. messages=on
  99.  
  100. #
  101. #    command line parameters
  102. #
  103. prntr=`basename $0`
  104. reqid=$1
  105. usrid=$2
  106. title=$3
  107. copies=$4
  108. options=$5
  109. fname=$6
  110.  
  111. shift; shift; shift; shift; shift
  112. files="$*"
  113.  
  114. if [ -r /etc/systemid ]; then
  115.     host=`sed 1q /etc/systemid`
  116. else
  117.     host=`uname -n`
  118.     [ "$host" = "(empty)" ] && host=`uname`
  119. fi
  120. charge=$usrid
  121.  
  122. #
  123. #    parse the spooler device dependent options
  124. #
  125. tflags= cflags= dviflags=
  126. for i in $options
  127. do
  128.     case "$i" in
  129.     li)
  130.         ftype=impress
  131.         ;;
  132.     lp)
  133.         ftype=printer
  134.         ;;
  135.     lfi)
  136.         ftype=fullimpress
  137.         ;;
  138.     lt)
  139.         ftype=troff
  140.         ;;
  141.     ldvi)
  142.         ftype=dvi
  143.         ;;
  144.     lc)
  145.         ftype=cat
  146.         ;;
  147.     t*)
  148.         temp=`echo "$i" | sed -e "1s/t//"`
  149.         tflags="$tflags $temp"
  150.         ;;
  151.     c*)
  152.         temp=`echo "$i" | sed -e "1s/c//"`
  153.         cflags="$cflags $temp"
  154.         ;;
  155.     v*)
  156.         temp=`echo "$i" | sed -e "1s/v//"`
  157.         dviflags="$dviflags $temp"
  158.         ;;
  159.     i2)
  160.         forms=2
  161.         ;;
  162.     iO)
  163.         outlines=on
  164.         ;;
  165.     ir)
  166.         pagereversal=on
  167.         ;;
  168.     ic)
  169.         pagecollation=off
  170.         ;;
  171.     iR)
  172.         rules=on
  173.         ;;
  174.     iJ)
  175.         jobheader=off
  176.         ;;
  177.     im)
  178.         messages=off
  179.         ;;
  180.     ij)
  181.         jamresistance=on
  182.         ;;
  183.     b)
  184.         banner=off
  185.         ;;
  186.     h*)
  187.         host=`echo "$i" | cut -c2-`
  188.         ;;
  189.     u*)
  190.         charge=`echo "$i" | cut -c2-`
  191.         ;;
  192.     esac
  193. done
  194.  
  195. #
  196. #    build the document header
  197. #
  198. iflags="jobheader $jobheader, copies $copies"
  199.  
  200. if [ $banner = on ]
  201. then
  202.     iflags="$iflags, owner \"$usrid\""
  203.  
  204.     user=`sed -n "s/^$usrid:.*:.*:.*:\(.*\):.*:.*$/\1/p" /etc/passwd`
  205.     [ -n "$user" ] && iflags="$iflags, user \"$user\""
  206.  
  207.     iflags="$iflags, name \"$reqid\""
  208.     [ -n "$title" ] && iflags="$iflags, title \"$title\""
  209.     iflags="$iflags, printer \"$prntr\", date \"`date`\", machine \"$host\""
  210. fi
  211.  
  212. iflags="pagereversal $pagereversal, $iflags"
  213. iflags="pagecollation $pagecollation, $iflags"
  214. iflags="messagedetail $messages, $iflags"
  215. iflags="jamresistance $jamresistance, $iflags"
  216.  
  217. #
  218. #    invoke the specified filter for input
  219. #
  220. case $ftype in
  221.  
  222. fullimpress)
  223.     echo "@Document($iflags)\c"
  224.     cat $files 2>&1
  225.     ;;
  226.  
  227. impress)
  228.     echo "@Document(language impress, $iflags)\c"
  229.     cat $files 2>&1
  230.     ;;
  231.  
  232. troff)
  233.     echo "@Document(language impress, $iflags)\c"
  234.     $itroff $tflags -sc $files | $catimp $cflags -i -
  235.     ;;
  236.  
  237. cat)
  238.     echo "@Document(language impress, $iflags)\c"
  239.     cat $files | $catimp $cflags -i -
  240.     ;;
  241.  
  242. dvi)
  243.     echo "@Document(language impress, $iflags)\c"
  244.     cat $files | $dviimp $dviflags -i -
  245.     ;;
  246.  
  247. printer)
  248.     [ $forms != 1 ]        && iflags="formsperpage $forms, $iflags"
  249.     [ $rules = on ]        && iflags="rules, $iflags"
  250.     [ $outlines = on ]    && iflags="outlines, $iflags"
  251.     echo "@Document(language printer, $iflags)\c"
  252.     cat $files 2>&1
  253.     ;;
  254.  
  255. *)
  256.     echo "@Document(language printer, $iflags)\c"
  257.     echo "\n\n\nBAD DOCUMENT TYPE: $ftype"
  258.     ;;
  259.  
  260. esac | $comm -s -o -l $logfile -a $stsfile -A $account -n "$charge" -h "$host"
  261.