#!/bin/sh
# Recursively execute an sccs command on all subdirectories
# The purpose is the recursive execution of an sccs command
# 	not worrying about which subdirectory a specified SCCS file is.
# It will automatically find and restore it on the right subdirectory for you.
# It takes all sccs command line arguments.
# WARNING: You should issue it from the top directory at the moment to serach
#	for all sub directories; otherwise it will only serach for the
#	current directory and subdirectories called *lib
# eg rsccs edit source.c (to edit a file you do not know where it is)
#    rsccs unedit source.c (to unedit a file you do not know where it is)
#    rsccs vi source.c (to vi a file)
#    rsccs get SCCS (to get all files from SCCS archives)

case $# in
0)	echo Error: Too few arguments!
	exit ;;
1)	echo `pwd`: sccs $*
	sccs $* ;;
*)	
	for i in $*
	do
		case $i in
		-*)
			;;
		SCCS)
			echo `pwd`: sccs $*
			sccs $*
			;;
		*.[cfh])
			if test -f SCCS/s.$i
			then
				echo `pwd`: sccs $*
				sccs $*
				exit
			fi
			;;
		*)
			;;
		esac
	done
	;;
esac

for i in * 
do	
	case $i in
	*lib)
		cd $i
		${KAOSHOME}/bin/rsccs $*
		cd ..
		;;
	*) 
	esac
done
