#! /bin/sh
######################################################################### 
#									# 
#   File: scorpion/bin/updatemakefile 
#				 					# 
#   Copyright (C) 1991 Hasnain Karampurwala
#									# 
#   The Scorpion System is free software in the public domain; you can  # 
#   redistribute it and/or modify it as you wish. We ask that you 	# 
#   retain credits referencing the University of Arizona and that you	# 
#   identify any changes you make.					# 
#									# 
#   Report problems to scorpion-project@cs.arizona.edu			# 
#   Direct all inquiries to:	The Scorpion Project			# 
#				Department of Computer Science		# 
#				Gould-Simpson Building			# 
#				University of Arizona			# 
#				Tucson, AZ 85721			# 
#				U.S.A.					# 
#									# 
#   Revision Log:							# 
#	$Log:$ 
#									# 
#   Edit Log:								# 
#									# 
######################################################################### 

MV="/bin/mv"
SED="/usr/bin/sed"
while true ; do
	case $1 in
		-m )	MV="$2"
			shift
			shift
			;;
		-s )	SED="$2"
			shift
			shift
			;;
		* )	break
			;;
	esac
done

if [ ! ${2-""} ]
then	echo "updatemakefile: makefile not specified"
	exit 1
fi
if [ ${3-""} ]
then	echo "updatemakefile: too many files specified -> $*"
	exit 1
fi
if [ '!' -f $1 ]
then	echo "updatemakefile: can't open $1"
	exit 1
fi
if [ '!' -f $2 ]
then	echo "updatemakefile: can't open $2"
	exit 1
fi
$SED -f $1 < $2 > $2.tmp
$MV $2.tmp $2
