Skip to content

Commit 1676e7e

Browse files
committed
update_copyrights.sh: Simple script to update copyright years.
1 parent 687d1b5 commit 1676e7e

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

scripts/update_copyrights.sh

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

0 commit comments

Comments
 (0)