#!/bin/csh -f
# you'll like this:
#	you can do all the existing RCS files by giving no args,
#	or, you can give local file names as args
#	I don't know if you can add a file to the RCS using this.

set sourced=/batgirl/pub/src/wack

if ( $#argv == 0 ) then
    set args = $sourced/RCS/*
else
    set args = ($*)
endif

foreach file ($args)
    set local=`basename $file ,v`
    set base=$local:r
    set file = $sourced/RCS/$local,v

    # if writable, try to check it in, copy new (read-only) version
    # to sourced, copy .o up if it exists

    if ( -w $local ) then
	echo 
	echo checkin $local
	ci -u $file

	echo update copy in source directory
	pushd $sourced
	co $local
	popd

	# CAN'T HANDLE IT cp $local $sourced
	if ( -e $base.o ) then
	    echo copying $base.o to source directory
	    cp $base.o  $sourced
	else
	    echo no $base.o to copy
	endif
    else
	echo skip $local
    endif
end

if ( -e tags ) cp tags $sourced
