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.

30 lines
658 B

  1. #!/bin/sh
  2. FILES=`find . \( \( -not -path './objdir*' \) -and \( -name '*.h' -o -name '*.hxx' -o -name '*.cxx' \) \)`
  3. perl -wn -i.bak -e '
  4. use strict;
  5. my $YEAR = 2013;
  6. my $sep = qr/[\s,;]/;
  7. if (/copyright/i)
  8. {
  9. print STDERR;
  10. }
  11. if (/(copyright $sep+ (?:\(c\) $sep+)? (?:\d{4})) (\s* - \s*) (\d{4})/ixgp)
  12. {
  13. #print STDERR "($1) ($2) ($3)\n";
  14. #print STDERR "${^PREMATCH}$1$2$YEAR${^POSTMATCH}";
  15. print "${^PREMATCH}$1$2$YEAR${^POSTMATCH}";
  16. }
  17. elsif (/(copyright $sep+ (?:\(c\) $sep+)? (\d{4}))/ixgp)
  18. {
  19. #print STDERR "($1)\n";
  20. #print STDERR "${^PREMATCH}$1-$YEAR${^POSTMATCH}";
  21. print "${^PREMATCH}$1-$YEAR${^POSTMATCH}";
  22. }
  23. else
  24. {
  25. print;
  26. }
  27. ' $FILES