Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.2 KiB

  1. #-----------------------------------------------------------------//
  2. # Script: filestat.pm
  3. #
  4. # (c) 2000 Microsoft Corporation. All rights reserved.
  5. #
  6. # Purpose: This script validates the files
  7. #
  8. # Version: <1.00> 04/18/2002 : Serguei Kouzmine
  9. #-----------------------------------------------------------------//
  10. $VERSION = '1.2';
  11. package filestat;
  12. require 5.003;
  13. require Exporter;
  14. @ISA = qw(Exporter);
  15. @EXPORT = qw(filestat);
  16. my $op = {"writable"=> sub {-w shift}, "zerosize"=> sub {-z shift},
  17. "unreadable"=> sub {!-r shift}};
  18. #--------------------------------------------------------------//
  19. # filestat subroutine
  20. # usage:
  21. # $bad = &filestat("zerosize", @good_and_bad);
  22. # @$bad is the bad file list if scalar(@$bad)
  23. #--------------------------------------------------------------//
  24. sub filestat{
  25. my $test = shift;
  26. my $test = $op->{$test};
  27. my @out = ();
  28. foreach (@_){
  29. stat ;
  30. push @out, $_ if $test->($_);
  31. }
  32. return (@out );
  33. }
  34. 1;
  35. __END__
  36. =head1 NOTES
  37. =head1 AUTHOR
  38. Serguei Kouzmine [sergueik]
  39. =head1 COPYRIGHT
  40. Copyright (c) Microsoft Corporation. All rights reserved.
  41. =cut