home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume12 / psf2 / part02 / psfxenix.LP < prev    next >
Encoding:
Text File  |  1990-05-19  |  2.0 KB  |  88 lines

  1. :
  2. #
  3. #!    Postscript serial or parallel printer using psf filters
  4. #
  5. #    NOTE: the above line is displayed on the "mkdev lp" printer
  6. #    ^^^^^ selection list.  If you create multiple printer models,
  7. #          edit the above to signify the options invoked with psf.
  8. #
  9. #    This print model works with Xenix 2.2.3, 2.3.2.  It is the printer
  10. #    back-end that is called by lp for physical printing.
  11. #
  12. #    The installpsf script will use sed to replace "BINARY" with
  13. #        the binary library directory name.
  14. #        "OPTIONS" will be replaced by the desired default
  15. #        options specified in the Makefile.
  16.  
  17. # The following parameters are passed from "lp" at print time.
  18.  
  19. printer=`basename $0`
  20. request=$1
  21. name=$2
  22. title=$3
  23. copies=$4
  24. options=$5
  25. shift; shift; shift; shift; shift
  26.  
  27. # Modify the following for required stty settings.
  28.  
  29. stty onlcr ixon ixoff 0<&1
  30.  
  31. banner=yes
  32. today=`date`
  33. for i in $options; do
  34.     case $i in
  35.     b)    banner=no ;;
  36.     esac
  37. done
  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/psbanner "$name" "$user" "$request" "$printer" "$options" "$today" "$sysid" "$title" BANNER
  60.         bannercount=`expr $bannercount - 1`
  61.     done
  62. }
  63.  
  64. #    If the input text file contains %! in the first line,
  65. #    then assume that it has already been wrapped in postscript
  66. #    code.  If the %! is missing, then filter through psf
  67. #
  68. #    The "OPTIONS" are default options forced in during "installpsf"
  69. #    The "$options" are passed by lp with  -o"opions"
  70.  
  71. while    [ "$copies" -gt 0 ]
  72. do
  73.     for file
  74.     do
  75.         BINARY/psdetect < "$file"
  76.  
  77.         case $? in
  78.  
  79.         0)    cat "$file" 2>&1;;
  80.  
  81.         1)    BINARY/psf OPTIONS $options "$file" 2>&1;;
  82.  
  83.         esac
  84.     done
  85.     copies=`expr $copies - 1`
  86. done
  87. exit 0
  88.