#! /bin/sh
# $Id: nc,v 1.3 1996/01/11 16:35:58 zeller Exp $
# make new C file

# Copyright (C) 1993 Technische Universitaet Braunschweig, Germany.
# Written by Andreas Zeller (zeller@ips.cs.tu-bs.de).
# 
# This file is part of NORA.
# 
# NORA 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 2 of the License, or (at your option) any later version.
# 
# NORA 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 NORA -- see the file COPYING.
# If not, write to the Free Software Foundation, Inc.,
# 675 Mass Ave, Cambridge, MA 02139, USA.
# 
# NORA is an experimental inference-based software development
# environment. Contact nora@ips.cs.tu-bs.de for details.

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 'const 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 $user $file.C > /dev/null
	rm $file.C~  
	${VISUAL:-vi} $file.C
    fi
done
