#! /bin/sh
#
# Script updates the copyright year in every file in Valgrind that contains
# a copyright notice.  Assumes they're all in the same format:
#
#     "Copyright (C) 20xy-2012"
#
# where x can be 0 or 1 and y can be anything.
# To use:
# - change the years in the 'perl' command below appropriately.
# - Run it from the base directory of a Valgrind workspace.  
# - And check the results look ok by diff'ing against the repository.
#
# Note that it will spit out some warnings when it runs;  ignore these.
#

# The find command deliberately skips .svn/ subdirs -- we don't want to
# change them.
for i in `find . -name '*.[chS]' -type f -not -path '*.svn\/*'` ; do
    echo $i
    perl -p -e 's/Copyright \(C\) 20([0-1])([0-9])-2012/Copyright (C) 20$1$2-2013/' < $i > tmp.$$
    mv tmp.$$ $i

# Copyright IBM Corp. 2010-2011

    perl -p -e 's/Copyright IBM Corp. 20([0-1])([0-9])-2012/Copyright IBM Corp. 20$1$2-2013/' < $i > tmp.$$
    mv tmp.$$ $i
done

