home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / c / cops_104.zip / cops_104 / perl / chk_strings next >
Text File  |  1992-03-10  |  1KB  |  48 lines

  1. #!/bin/sh  # need to mention perl here to avoid recursion
  2. #
  3. #  Usage: chk_strings filename
  4. #
  5. #  This will check pathnames inside executable files for writability,
  6. # The big string "@ignores" is a list of files that are ignored by
  7. # this; you can set it to whatever you want -- default is:
  8. # '^/tmp/?' and '^/(var|usr)/tmp/?'
  9. #  No program root EVER runs should be show up here.
  10. #
  11. # NOTE:
  12. #   If you know where perl is and your system groks #!, put its
  13. # pathname at the top to make this a tad faster.
  14. #
  15. # the following magic is from the perl man page
  16. # and should work to get us to run with perl 
  17. # even if invoked as an sh or csh or foosh script.
  18. # notice we don't use full path cause we don't
  19. # know where the user has perl on their system.
  20. #
  21. eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' 
  22. & eval 'exec perl -S $0 $argv:q'
  23.     if $running_under_some_stupid_shell_instead_of_perl;
  24.  
  25. package main;
  26.  
  27. $| = 1;
  28.  
  29. require 'getopts.pl';
  30. require 'chk_strings.pl';
  31.  
  32. die "Usage: $0 [-rd] file ...\n" unless &Getopts('rd') && @ARGV;
  33.  
  34. package chk_strings;
  35.  
  36. $debug = $'opt_d;
  37. $recurse = $'opt_r;
  38. @ignores = ( '^/tmp/?', '^/(var|usr)/tmp/?' )
  39.     unless defined @ignores;
  40.  
  41. #%paths = ();  # faster than local
  42.  
  43. for (@'ARGV) { 
  44.     (warn("$0: $_: $!\n"), next) unless -e;
  45.     &'chk_strings($_); 
  46.