#!/bin/csh -f
set pathname = $1
shift
set file = $1 
shift
set fileroot = $file:r

if (-r $file) then
    echo "$file is already here"
    exit (2)
endif

if (-r $pathname/SCCS/s.$file) then
    sccs -d$pathname edit $file
    if ($status) then
	echo Can not sccs edit \"$file\"
	exit (2)
    endif
else
    cp $pathname/$file .
    if ($status) then
	echo Can not copy \"$pathname/$file\" to \"$file\"
	exit (2)
    endif
endif
    
cat > makeed$$ << theend
s;$pathname/\${HOW}/$fileroot;./\${HOW}/$fileroot;
s;$pathname/$file;./$file;
s;$pathname/$fileroot ;./$fileroot ;
theend
cp -p Makefile Makefile.bak
sed -f makeed$$ < Makefile > newMakefile
mv newMakefile Makefile
rm -f makeed$$
