#!/bin/sh
# $Id: nh,v 1.5 1997/04/25 06:44:21 zeller Exp $
# make new header file

# Copyright (C) 1996 Technische Universitaet Braunschweig, Germany.
# Written by Andreas Zeller <zeller@ips.cs.tu-bs.de>.
# 
# 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 2 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, write to the Free Software Foundation, Inc.,
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# 
# 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=""

case `pwd` in
    *ddd*)    prefix=_DDD;;
    */ice/*)  prefix=_ICE;;
    */ice)    prefix=_ICE;;
    */nora/*) prefix=_Nora;;
    */nora)   prefix=_Nora;;
    *)        prefix=;;
esac

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

for name in $*
do
    name=`basename $name .h`
    file=`echo $name | $path/shorten 10`
    if [ -f $file.h ]; then
	echo "$file.h already exists"
    else
	(
	   echo '// $Id''$ -*- C++ -*-'
	   echo '//'
	   echo
	   echo '#ifndef '$prefix'_'$name'_h'
	   echo '#define '$prefix'_'$name'_h'
	   echo 
	   echo '#ifdef __GNUG__'
	   echo '#pragma interface'
	   echo '#endif'
	   echo
	   echo
	   echo '#endif // '$prefix'_'$name'_h'
	   echo "// DON'T ADD ANYTHING BEHIND THIS #endif"
	) > $file.h
	$path/apply-license $user $file.h > /dev/null
	rm $file.h~
 	${VISUAL:-vi} $file.h
    fi
done
