Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

lic_to_2 1.0KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/usr/bin/perl
  2. use Getopt::Long;
  3. sub usage {
  4. print STDERR "Usage:\n";
  5. print STDERR "\t$0 --lic2 <license 2.0 file>\n";
  6. exit 1;
  7. }
  8. &usage unless GetOptions("lic2=s" => \$lic2);
  9. &usage unless defined($lic2);
  10. die "Can't open $lic2\n" unless open LIC2, "<$lic2";
  11. # Read files without an input record separator
  12. undef $/;
  13. # Slurp the license file
  14. $lic2text = <LIC2>;
  15. ($lic2begin = $lic2text) =~ s/^(.*)\{YEARS\}(.*)/$1/s;
  16. $lic2rem = $2;
  17. # Slurp the input file
  18. $_ = <>;
  19. s|\n # Start with a newline
  20. [^\n]*=+\s+ # Non-newlines followed by multiple '='
  21. # ...followed by whitespace (incl. newline)
  22. [^\n]* # Non-newlines (incl spaces)
  23. The\ Apache\ Software\ License,\ Version\ 1\.1
  24. .* # Anything
  25. Copyright\ \(C\)\ (\d+(-\d+)?)\ The\ Apache\ Software\ Foundation
  26. .* # Anything
  27. James\ Tauber
  28. .* # Anything
  29. \<http://www.apache.org/\>\.
  30. \s+ # Any whitespace
  31. |$lic2begin$1$lic2rem|xs;
  32. print;