#!/bin/sh
# $Id: nc,v 1.1.1.1 1995/05/01 15:48:43 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.

# $Log: nc,v $
# Revision 1.1.1.1  1995/05/01  15:48:43  zeller
# DDD 0.9 distribution
#
# Revision 1.1.1.1  1995/02/09  09:14:39  zeller
# ICE 0.5 distribution
#
# Revision 1.6  1994/11/18  11:52:52  zeller
# New: break RCS ID in two lines
#
# Revision 1.5  1994/07/19  15:43:36  zeller
# New: rcsid is static
#
# Revision 1.4  1993/07/19  19:18:35  zeller
# Neu: Name des Erstellers angeben
# Neu: Editor aufrufen
#
# Revision 1.3  1993/06/30  07:06:18  zeller
# Fix: enstehende Datei erhaelt Log
#
# Revision 1.2  1993/06/30  07:02:31  zeller
# Neu: Anpassung an RCS
# Neu: Log
#

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 '// $Log''$'
	   echo
	   echo 'static const char 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
