#!/bin/sh
#
# This script can be used to change the copyright notice in source files
#
# $Id: chcpy,v 1.4 2004/07/09 15:12:28 gkminix Exp $
#

DIR="$1"
if [ "x$DIR" = "x" -o ! -d "$DIR" ]; then
	echo "usage: $0 <directory>"
	exit 1
fi

YEAR=`date +%Y`
find $DIR -type f -not -name '*.bin' -not -name '*.exe' -not -name '*.com' -not -name '*.sys' |\
while read fname
do
	sed "s/[cC]opyright \+[(][cC][)] \+\([12][09][0-9][0-9]\)\([,-]20[0-9][0-9]\)\? \+Gero Kuhlmann/Copyright (C) \1-$YEAR Gero Kuhlmann/" $fname >$fname.old
	if cmp -s $fname.old $fname; then
		rm $fname.old
	else
		echo $fname
		mv $fname.old $fname
	fi
done

