#!/bin/csh -f

set from = ""
set to = ""
set mtime = ()
set dirs = ()

while ($#argv > 0)
	if ("$argv[1]" !~ -*) then
		set dirs = ($dirs $argv[1])
	else
		switch ($argv[1])
			case "-from":
				set from = $argv[2]
				shift
				breaksw
			case "-to":
				set to = $argv[2]
				shift
				breaksw
			case "-mtime":
			        set mtime = ($argv[1-2])
				shift
				breaksw
			default:
				echo "Bogus switch: $argv[1]"
				exit
		endsw
	endif
	shift
end

if ($#dirs == 0) set dirs = .

find $dirs -follow -name '*,v' $mtime -exec rlog  "-d$from<$to" '{}' \; | \
    sed -n -e '/^RCS file:/p' -e '/^------/,/^======/p' | \
    sed -e '/^RCS file:/{;:again\
	N;s/^RCS file.*\nRCS file/RCS file/;t again\
	}' 
