home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / unix / question / 10095 < prev    next >
Encoding:
Text File  |  1992-08-14  |  1.7 KB  |  54 lines

  1. Newsgroups: comp.unix.questions
  2. Path: sparky!uunet!uunet.ca!canrem!telly!druid!darcy
  3. From: darcy@druid.uucp (D'Arcy J.M. Cain)
  4. Subject: Re: dumping text to a local printer attached to a terminal?
  5. Message-ID: <1992Aug14.213647.11014@druid.uucp>
  6. Date: Fri, 14 Aug 1992 21:36:47 GMT
  7. References: <drenze.713553624@icaen.uiowa.edu> <1992Aug12.142109.12980@swbatl.sbc.com>
  8. Organization: D'Arcy Cain Consulting
  9. Lines: 43
  10.  
  11. rollins@oktext.UUCP (Steven D. Rollins) writes:
  12. >    This little script might work for you, it does for me. The first
  13. >    line turns on vt100 print-pass-thru. the second cats your file to
  14.  
  15. Just slightly hardware dependent.  Here is my script:
  16.  
  17. ----------------------------------------------------------------------
  18. #! /bin/sh
  19. # lpx - prints on attached printer if available
  20. # Written by D'Arcy J.M. Cain
  21.  
  22. # first trap the exit in case we abort while passing through
  23. trap 'tput mc4; exit 0' 0
  24.  
  25. # now pass through
  26. tput mc5
  27.  
  28. # if there is an error try to supply some help
  29. if [ $? -ne 0 ]
  30. then
  31.     echo "Your terminal doesn't seem to handle pass-through printing."
  32.     echo "Please contact the administrator if you have a terminal that"
  33.     echo "supports this feature and you would like to have it enabled."
  34.     exit
  35. fi
  36.  
  37. # now dump everything
  38. cat $*
  39.  
  40. # note there is no cleanup code here - the exit is trapped above
  41. -------------------------------------------------------------------
  42.  
  43. Notice that withot the comments, error checking, etc this boils down
  44. to simply:
  45.   tput mc5
  46.   cat $*
  47.   tput mc4
  48.  
  49. -- 
  50. D'Arcy J.M. Cain (darcy@druid.com)  |
  51. D'Arcy Cain Consulting              |   There's no government
  52. Toronto, Ontario, Canada            |   like no government!
  53. +1 416 424 2871          DoD#0082   |
  54.