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

  1. :
  2. #    @(#) crnlmap.sh 1.6 88/05/13 
  3. #
  4. #    Copyright (C) The Santa Cruz Operation, 1985.
  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. #!    Serial or parallel printer requiring <nl> mapped to <cr><lf>
  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 add the appropriate options here:
  21. stty onlcr 0<&1
  22.  
  23. # border around the banner
  24. x="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
  25.  
  26. # the fifth field of the /etc/passwd file is assigned to the variable user
  27. user=`sed -n "s/^$name:.*:.*:.*:\(.*\):.*:.*$/\1/p" /etc/passwd`
  28.  
  29. # nhead gets the value of BANNERS or 1 by default
  30. nhead=`sed -n 's/^BANNERS=//p' /etc/default/lpd`
  31. [ "$nhead" -ge 0 -a "$nhead" -le 5 ] || nhead=1
  32.  
  33. # print the banner $nhead times
  34. {
  35. while    [ "$nhead" -gt 0 ]
  36. do
  37.     echo "$x\n"
  38.     banner "$name"
  39.     echo "$x\n"
  40.     [ "$user" ] && echo "User: $user\n"
  41.     echo "Request id: $request\n"
  42.     echo "Printer: $printer\n"
  43.     date
  44.     echo
  45.     [ "$title" ] && banner $title
  46.     echo "\f\c"
  47.     nhead=`expr $nhead - 1`
  48. done
  49.  
  50. # send the file(s) to the standard out $copies times
  51. while    [ "$copies" -gt 0 ]
  52. do
  53.     for file
  54.     do
  55.         cat "$file" 2>&1
  56.         echo "\f\c"
  57.     done
  58.     copies=`expr $copies - 1`
  59. done
  60. exit 0
  61.