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.

lic_to_2 1023B

12345678910111213141516171819202122232425262728293031323334353637
  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]*=+\s+ # Non-newlines followed by multiple '='
  20. # ...followed by whitespace (incl. newline)
  21. [^\n]* # Non-newlines (incl spaces)
  22. The\ Apache\ Software\ License,\ Version\ 1\.1
  23. [^C]* # Anything not a capital C
  24. Copyright\ \(C\)\ (\d+(-\d+)?)\ The\ Apache\ Software\ Foundation
  25. .* # Anything
  26. Foundation,\ please\ see\ \<http://www.apache.org/\>\.
  27. \s*\n # Any whitespace ending in a newline
  28. |$lic2begin$1$lic2rem|xs;
  29. print;