#!/bin/sh
#
# Copyright (c) 1993 InterSoft Co.  All Rights Reserved
# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF InterSoft Co.
# The copyright notice above does not evidence any
# actual or intended publication of such source code.
#
# MODULE & VERSION : $Id: verslog.sh,v 1.2 1993/10/06 11:11:48 hernan Exp $
# DATE             : $Date: 1993/10/06 11:11:48 $
# TIME             : 
#
#	verslog [-h|-?|-v version] files
#
# Version for the RCS Revision Control System
#
DELTA=""
KEEP=""
VERSION=""
USAGE="Usage: `basename $0` [-h|-?|-v version] files"
RET=0
SAVEPWD=`pwd`

while getopts h?v: OPT
do
	case $OPT in
	h|\?)
		echo $USAGE 1>&2
		exit 1
		;;
	v)
		if [ $OPTARG = "last" ]
		then
			VERSION=-r
		else
			VERSION=-r$OPTARG
		fi
		;;
	esac
done

shift `expr $OPTIND - 1`

if [ $# -eq 0 ]
then
	echo $USAGE 1>&2
	exit 1
fi

for i
do
	DIR=`dirname $i`
	FILE=`basename $i`
	cd $SAVEPWD
	cd $DIR
	if [ $? -ne 0 ]
	then
		RET=1
		continue
	fi

	rlog $VERSION $FILE | awk '
	$1 == "revision" {
		revision = $2
	}
	$1 == "date:" {
		date = substr($2, 9, 2) "/" substr($2, 6, 2) "/" substr($2, 3, 2)
		time = substr($3, 1, length($3)-1)
		author = substr($5, 1, length($5)-1)
		firstLine = 1
		next
	}
	firstLine == 1 {
		printf("%s\t%s\t%s\t%s\t%s\n", revision, date, time, author, $0)
		firstLine = 0
	}'
	if [ $? -ne 0 ]
	then
		RET=3
		continue
	fi
done
exit $RET
