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

  1. :
  2. #    @(#) qume1155.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. #!    Qume Sprint 1155 line printer
  10. #    Options: lp -ob   no banner
  11. #
  12. printer=`basename $0`
  13. request=$1
  14. name=$2
  15. title=$3
  16. copies=$4
  17. options=$5
  18. shift; shift; shift; shift; shift
  19.  
  20. # for the qume we need to translate nl into nl cr
  21. # and we need to set the tabs each time a file is printed.
  22. # this could be done only once if you knew that the tabs
  23. # had been set properly. for some reason the qume doesn't like
  24. # any tab stops beyond 97.
  25. #
  26. # the printer was set to 9600 baud, no auto line feed (didn't seem
  27. # to work anyway), handshaking - xon xoff, no parity checking 
  28. #
  29. stty 9600 opost onlcr ixon ixoff 0<&1
  30. echo "\033(09,17,25,33,41,49,57,65,73,81,89,97.\c"
  31.  
  32. # border around the banner
  33. x="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
  34.  
  35. banner=yes
  36. for i in $options; do
  37.     case $i in
  38.     b)    banner=no ;;
  39.     esac
  40. done
  41.  
  42. [ "$banner" = yes ] && {
  43.     # get the local system id
  44.     if test -r /etc/systemid; then
  45.         sysid=`sed 1q /etc/systemid`
  46.     else
  47.         sysid=`uname -n`
  48.     fi
  49.  
  50.     # user = fifth field of /etc/passwd
  51.     user=`sed -n "s/^$name:.*:.*:.*:\(.*\):.*:.*$/\1/p" /etc/passwd`
  52.  
  53.     # nhead gets the value of BANNERS or 1 by default
  54.     nhead=`sed -n 's/^BANNERS=//p' /etc/default/lpd`
  55.     [ "$nhead" -ge 0 -a "$nhead" -le 5 ] || nhead=1
  56.  
  57.     # print the banner $nhead times
  58.     while    [ "$nhead" -gt 0 ]
  59.     do
  60.         echo "$x\n"
  61.         banner "$name"
  62.         echo "$x\n"
  63.         [ "$user" ] && echo "User: $user\n"
  64.         echo "Request id: $request\n"
  65.         echo "Printer: $printer\n"
  66.         date
  67.         echo "\nMachine: $sysid\n"
  68.         [ "$title" ] && banner $title
  69.         echo "\f\c"
  70.         nhead=`expr $nhead - 1`
  71.     done
  72. }
  73.  
  74. # send the file(s) to the standard out $copies times
  75. while    [ "$copies" -gt 0 ]
  76. do
  77.     for file
  78.     do
  79.         cat "$file" 2>&1
  80.         echo "\f\c"
  81.     done
  82.     copies=`expr $copies - 1`
  83. done
  84. exit 0
  85.