#!/bin/sh
# BZFlag
# Copyright (c) 1993-2012 Tim Riker
#
# This package is free software;  you can redistribute it and/or
# modify it under the terms of the license found in the file
# named COPYING that should have accompanied this file.
#
# THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
# NOTE: update just the next two lines and then run this script
OLDCOPYRIGHTTEXT='Copyright (c) 1993-2011'
NEWCOPYRIGHTTEXT='Copyright (c) 1993-2012'
#
# update copyright in all files
#
# bzflag top-level dir
for root in . .. ; do
  if [ -r $root/bzflag.lsm.in ] ; then
    break
  fi
done

#if [ -r $root/include/config.h ] ; then
#  echo "$0 should be run only after a make maintainer-clean!"
#  exit 1
#fi
myname=touchcopyright
tmpfile=$root/$myname.tmp
rm -f $tmpfile
# FIXME: only touch files that have the Subversion svn:eol-style property set.
# touch myself last
files="`find $root -type f -not -regex '.*\.svn.*' -not -name \*.png -not -name \*.wav -not -name \*.icns -not -regex '.*src/other/.*' | grep -v misc/$myname` misc/$myname"

# do replacement
for file in $files; do
  echo -e -n "$file\r"
  if [ ! -w ${file} ]; then
    echo "${file} not found or not writable."
    continue
  fi
  # cat to the file, not move to preserve permissions
  if sed -e "s/${OLDCOPYRIGHTTEXT}/${NEWCOPYRIGHTTEXT}/" < ${file} > $tmpfile ; then
    cat $tmpfile > ${file}
  fi
done
rm -f $tmpfile

# Local Variables: ***
# mode:sh ***
# tab-width: 8 ***
# sh-indentation: 2 ***
# sh-basic-offset: 2 ***
# indent-tabs-mode: t ***
# End: ***
# ex: shiftwidth=2 tabstop=8
