home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 200.img / SCO386X3.TD0 / usr / spool / lp / model / ti800 < prev   
Encoding:
Text File  |  1988-05-17  |  2.0 KB  |  111 lines

  1. :
  2. #    @(#) ti800.src 1.2 88/05/13 
  3. #
  4. #    Copyright (C) The Santa Cruz Operation, 1985, 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. #!    Texas Instruments 855 printer
  10. #    Options: lp -oc   compressed print
  11. #            -on   font module select (n=1,2,3)
  12. #            -oq   quality mode
  13. #            -oz   12/15 cpi
  14. #            -ob   no banner
  15. #
  16. printer=`basename $0`
  17. request=$1
  18. name=$2
  19. title=$3
  20. copies=$4
  21. options=$5
  22. shift; shift; shift; shift; shift
  23.  
  24. # use following line for TI855 serial printers
  25. stty ixon 9600 0<&1
  26.  
  27. # use following line for TI850 serial printers
  28. # stty 300 0<&1
  29.  
  30. # select DP mode, draft mode, 10 cpi, and font module 1
  31. echo "\033@\033d\033y\033f1"
  32.  
  33. # border around the banner
  34. x="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
  35.  
  36. banner=yes
  37. for i in $options; do
  38.     case $i in
  39.     b)    banner=no ;;
  40.     esac
  41. done
  42.  
  43. [ "$banner" = yes ] && {
  44.     # get the local system id
  45.     if test -r /etc/systemid; then
  46.         sysid=`sed 1q /etc/systemid`
  47.     else
  48.         sysid=`uname -n`
  49.     fi
  50.  
  51.     # user = fifth field of /etc/passwd
  52.     user=`sed -n "s/^$name:.*:.*:.*:\(.*\):.*:.*$/\1/p" /etc/passwd`
  53.  
  54.     # nhead gets the value of BANNERS or 1 by default
  55.     nhead=`sed -n 's/^BANNERS=//p' /etc/default/lpd`
  56.     [ "$nhead" -ge 0 -a "$nhead" -le 5 ] || nhead=1
  57.  
  58.     # print the banner $nhead times
  59.     while    [ "$nhead" -gt 0 ]
  60.     do
  61.         echo "$x\n"
  62.         banner "$name"
  63.         echo "$x\n"
  64.         [ "$user" ] && echo "User: $user\n"
  65.         echo "Request id: $request\n"
  66.         echo "Printer: $printer\n"
  67.         date
  68.         echo "\nMachine: $sysid\n"
  69.         [ "$title" ] && banner $title
  70.         echo "\f\c"
  71.         nhead=`expr $nhead - 1`
  72.     done
  73. }
  74.  
  75. # send the file(s) to the standard out $copies times
  76. for i in $options
  77. do
  78.     case $i in
  79.     c)
  80.     echo "\033P"
  81.     ;;
  82.     1)
  83.     echo "\033f1"
  84.     ;;
  85.     2)
  86.     echo "\033f2"
  87.     ;;
  88.     3)
  89.     echo "\033f3"
  90.     ;;
  91.     q)
  92.     echo "\033q"
  93.     ;;
  94.     z)
  95.     echo "\033z"
  96.     ;;
  97.     esac
  98. done
  99.  
  100. while    [ "$copies" -gt 0 ]
  101. do
  102.     for file
  103.     do
  104.         pr -t -e "$file" 2>&1
  105.         echo "\f\c"
  106.     done
  107.     copies=`expr $copies - 1`
  108. done
  109. echo "\033@\033d\033y\033f1"
  110. exit 0
  111.