1b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov#! /bin/sh
2b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov#
3b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov# Script updates the copyright year in every file in Valgrind that contains
4b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov# a copyright notice.  Assumes they're all in the same format:
5b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov#
6436e89c602e787e7a27dd6624b09beed41a0da8aDmitriy Ivanov#     "Copyright (C) 20xy-2012"
7b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov#
8b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov# where x can be 0 or 1 and y can be anything.
9b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov# To use:
10b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov# - change the years in the 'perl' command below appropriately.
11b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov# - Run it from the base directory of a Valgrind workspace.  
12b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov# - And check the results look ok by diff'ing against the repository.
13b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov#
14b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov# Note that it will spit out some warnings when it runs;  ignore these.
15b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov#
16b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov
17b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov# The find command deliberately skips .svn/ subdirs -- we don't want to
18b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov# change them.
19b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanovfor i in `find . -name '*.[chS]' -type f -not -path '*.svn\/*'` ; do
20b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov    echo $i
21436e89c602e787e7a27dd6624b09beed41a0da8aDmitriy Ivanov    perl -p -e 's/Copyright \(C\) 20([0-1])([0-9])-2012/Copyright (C) 20$1$2-2013/' < $i > tmp.$$
22436e89c602e787e7a27dd6624b09beed41a0da8aDmitriy Ivanov    mv tmp.$$ $i
23436e89c602e787e7a27dd6624b09beed41a0da8aDmitriy Ivanov
24436e89c602e787e7a27dd6624b09beed41a0da8aDmitriy Ivanov# Copyright IBM Corp. 2010-2011
25436e89c602e787e7a27dd6624b09beed41a0da8aDmitriy Ivanov
26436e89c602e787e7a27dd6624b09beed41a0da8aDmitriy Ivanov    perl -p -e 's/Copyright IBM Corp. 20([0-1])([0-9])-2012/Copyright IBM Corp. 20$1$2-2013/' < $i > tmp.$$
27b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov    mv tmp.$$ $i
28b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanovdone
29b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov
30