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

  1. :
  2. #    @(#) hpjet.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. #!    HP Laserjet, Thinkjet or QuietJet
  10. #
  11. printer=`basename $0`
  12. request=$1
  13. name=$2
  14. title=$3
  15. copies=$4
  16. options=$5
  17. shift; shift; shift; shift; shift
  18.  
  19. # If it is necessary to change the baud rate or other stty settings for
  20. # your serial printer change the following line
  21. stty 9600 cs8 onlcr tab3 ixon ixoff clocal 0<&1
  22.  
  23. # border around the banner
  24. x="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
  25.  
  26. Graphics=no
  27. Landscape=no
  28. Wide=no
  29. banner=yes
  30. for i in $options
  31. do
  32.     case $i in
  33.         g|G|pro)
  34.             Graphics=yes
  35.             ;;
  36.         l|L)
  37.             Landscape=yes
  38.             ;;
  39.         w|W)
  40.             Wide=yes
  41.             ;;
  42.         b)    banner=no
  43.             ;;
  44.     esac
  45. done
  46.  
  47. if [ "$Landscape" = yes ]
  48. then
  49.     echo "\033E\033&l1o5.45c66F\033(s16.66H"
  50. elif [ "$Wide" = yes ]
  51. then
  52.     echo "\033E\033&a5L\033&l0o7.27c66F\033(s16.66H"
  53. else
  54.     echo "\033E\033&a5L\033&l0o7.27c66F"
  55. #    echo "\033E\033&a2L\033&l0o7.27c66F"
  56. fi
  57.  
  58. [ "$banner" = yes ] && {
  59.     # get the local system id
  60.     if test -r /etc/systemid; then
  61.         sysid=`sed 1q /etc/systemid`
  62.     else
  63.         sysid=`uname -n`
  64.     fi
  65.  
  66.     # user = fifth field of /etc/passwd
  67.     user=`sed -n "s/^$name:.*:.*:.*:\(.*\):.*:.*$/\1/p" /etc/passwd`
  68.  
  69.     # nhead gets the value of BANNERS or 1 by default
  70.     nhead=`sed -n 's/^BANNERS=//p' /etc/default/lpd`
  71.     [ "$nhead" -ge 0 -a "$nhead" -le 5 ] || nhead=1
  72.  
  73.     # print the banner $nhead times
  74.     while    [ "$nhead" -gt 0 ]
  75.     do
  76.         echo "$x\n"
  77.         banner "$name"
  78.         echo "$x\n"
  79.         [ "$user" ] && echo "User: $user\n"
  80.         echo "Request id: $request\n"
  81.         echo "Printer: $printer\n"
  82.         echo "Options: $options\n"
  83.         date
  84.         echo "\nMachine: $sysid\n"
  85.         [ "$title" ] && banner $title
  86.         echo "\f\c"
  87.         nhead=`expr $nhead - 1`
  88.     done
  89. }
  90.  
  91. if [ "$Graphics" = yes ]
  92. then
  93.     stty -opost 0<&1
  94. fi
  95.  
  96. # send the file(s) to the standard out $copies times
  97. while    [ "$copies" -gt 0 ]
  98. do
  99.     for file
  100.     do
  101.         cat "$file" 2>&1
  102.         echo "\033E\c"
  103.     done
  104.     copies=`expr $copies - 1`
  105. done
  106. exit 0
  107.