home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume27 / psf3 / part04 / psfxenix.LP < prev   
Encoding:
Text File  |  1992-01-20  |  1.7 KB  |  78 lines

  1. #!    Postscript serial or parallel printer using psf filters
  2. #
  3. #    NOTE: the above line is displayed on the "mkdev lp" printer
  4. #    ^^^^^ selection list.  If you create multiple printer models,
  5. #          edit the above to signify the options invoked with psf.
  6. #
  7. #    This print model works with Xenix 2.2.3, 2.3.2.  It is the printer
  8. #    back-end that is called by lp for physical printing.
  9. #
  10. #    "make installxenix" will use sed to replace "BINARY" with
  11. #        the binary library directory name.
  12.  
  13. # The following parameters are passed from "lp" at print time.
  14.  
  15. printer=`basename $0`
  16. request=$1
  17. name=$2
  18. title=$3
  19. copies=$4
  20. options=$5
  21. shift; shift; shift; shift; shift
  22.  
  23. # Modify the following for required stty settings.
  24.  
  25. stty onlcr ixon ixoff 0<&1
  26.  
  27. banner=yes
  28. today=`date`
  29. for i in $options; do
  30.     case $i in
  31.     b)    banner=no ;;
  32.     esac
  33. done
  34.  
  35. [ "$title " = " " ] && {
  36.     title=`basename $1`
  37. }
  38.  
  39. [ "$banner" = yes ] && {
  40.  
  41. #    get the machine name
  42.  
  43.     if test -r /etc/systemid; then
  44.         sysid=`sed 1q /etc/systemid`
  45.     else
  46.         sysid=`uname -n`
  47.     fi
  48.  
  49. #    get the user name from the GCOS field in /etc/passwd
  50.  
  51.     user=`sed -n "s/^$name:.*:.*:.*:\(.*\):.*:.*$/\1/p" /etc/passwd`
  52.  
  53. #    get the count of the number of banner pages from /etc/default/lpd
  54.  
  55.     bannercount=`sed -n 's/^BANNERS=//p' /etc/default/lpd`
  56.     [ "$bannercount" -ge 0 -a "$bannercount" -le 5 ] || bannercount=1
  57.     while    [ "$bannercount" -gt 0 ]
  58.     do
  59.         BINARY/psfbanner "$name" "$user" "$request" "$printer" "$options" "$today" "$sysid" "$title" -g PAGETYPE -u DEFFILE
  60.         bannercount=`expr $bannercount - 1`
  61.     done
  62. }
  63.  
  64. #    psffilter filters the file unless it already is in postscript
  65. #
  66. #    The "$options" are passed by lp with  -o"opions"
  67.  
  68. files="$*"
  69. while    [ "$copies" -gt 0 ]
  70. do
  71.     for file in $files
  72.     do
  73.         BINARY/psffilter $options "$file" 2>&1
  74.     done
  75.     copies=`expr $copies - 1`
  76. done
  77. exit 0
  78.