#!/bin/sh
# $Id: nc 6884 2008-03-09 20:42:06Z apg $
# make new C file

# Copyright (C) 1996 Technische Universitaet Braunschweig, Germany.
# Written by Andreas Zeller <zeller@gnu.org>.
# 
# This file is part of ICE.
# 
# ICE is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation; either
# version 3 of the License, or (at your option) any later version.
# 
# ICE is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public
# License along with ICE -- see the file COPYING.
# If not, see <http://www.gnu.org/licenses/>.
# 
# ICE is the incremental configuration environment.
# For details, see the ICE World-Wide-Web page, 
# `http://www.cs.tu-bs.de/softech/ice/',
# or send a mail to the ICE developers at `ice@ips.cs.tu-bs.de'.

this=`basename $0`
path=`dirname $0`

user=""
if [ "$1" = "-l" ]; then
  user="-l $2"
  shift 2
fi

for name in $*
do
    name=`basename $name .C`
    file=`echo $name | $path/shorten 10`
    if [ -f $file.C ]; then
	echo "$file.C already exists"
    else
	(
	   echo '// $Id''$ -*- C++ -*-'
	   echo '//'
	   echo
	   echo 'char '$name'_rcsid[] = '
	   echo '    "$Id''$";'
	   echo
	   echo '#ifdef __GNUG__'
	   echo '#pragma implementation'
	   echo '#endif'
	   echo
	   echo '#include "'$file'.h"'
	   echo
	) > $file.C
	$path/apply-license -f $user $file.C > /dev/null
	rm $file.C.orig
	echo $file.C
    fi
done
