#!/bin/csh
if ( ( -f $1 ) && ((-w $1 ) || ( -o $1 )) ) then
	if ( ! -w $1 ) then
		chmod u+w $1
		touch $1
		chmod a-w $1
	else
		touch $1
	endif
else
	if ( -f RCS/$1,v ) then
		if ( -f $1 ) then
			rcsclean $2 $1
		endif
		if ( -f $1 ) then
			echo "!!!! File $1 is modified but hasn\'t been saved"
			cp $1 $1____
			rm -f $1
			mv $1____ $1
			chmod ug+w $1
			touch $1
		else
			co $2 $1
		endif
	else
		if ( -f $1 ) then
			echo "File $1 protected from writing and TOUCHing"
		endif
	endif
endif
