home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / tsw / TSW_3.4.0.exe / Apache2 / perl / makerandom.bat < prev    next >
Encoding:
DOS Batch File  |  2004-03-20  |  1.5 KB  |  67 lines

  1. @rem = '--*-Perl-*--
  2. @echo off
  3. if "%OS%" == "Windows_NT" goto WinNT
  4. perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
  5. goto endofperl
  6. :WinNT
  7. perl -x -S %0 %*
  8. if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl
  9. if %errorlevel% == 9009 echo You do not have Perl in your PATH.
  10. if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul
  11. goto endofperl
  12. @rem ';
  13. #!/usr/bin/perl -sI../lib -Ilib/
  14. #line 15
  15. ##
  16. ## makerandom - interface to crypt::random
  17. ##
  18. ## Copyright (c) 1998, Vipul Ved Prakash.  All rights reserved.
  19. ## This code is free software; you can redistribute it and/or modify
  20. ## it under the same terms as Perl itself.
  21. ##
  22. ## $Id: makerandom.bat,v 1.3 2004/03/20 23:00:27 joker Exp $
  23.  
  24. use Crypt::Random qw( makerandom makerandom_itv );
  25.  
  26. unless ( $size || $lower )  { 
  27.     my $name = $0; 
  28.     $name =~ s:.*/::;
  29.     print "usage: $name [options] \
  30.        -size=bitsize \
  31.        -strength=[01] \
  32.        -dev=device \ 
  33.        -lower=lower_bound \
  34.        -upper=upper_bound \
  35.        -num=quantity\n\n";
  36.     exit 0;
  37. }
  38.  
  39.  
  40. $strength = 0 unless $strength; 
  41. my $i     = 1; 
  42.    $num   = 1 unless $num; 
  43.  
  44. while ( $i++ <= $num ) { 
  45.  
  46. my $r; 
  47.  
  48. if ( $size ) { 
  49.     $r = makerandom Size => $size, 
  50.                     Strength => $strength,
  51.                     Device => $dev; 
  52. }
  53.  
  54. if ( $lower ) { 
  55.     $r = makerandom_itv Lower => $lower, 
  56.                         Upper => $upper, 
  57.                         Strength => $strength, 
  58.                         Device => $dev;
  59. }
  60.  
  61. print "$r\n";
  62.  
  63. }
  64.  
  65. __END__
  66. :endofperl
  67.