#!/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.7 1993/12/14 13:38:43 hernan Exp $
# DATE             : $Date: 1993/12/14 13:38:43 $
# TIME             : 
#
#	verslog [-h|-?|-v version] files
#
# Version for the SCCS Source Code Control System
#
SCCSDIR=SCCS
DELTADIR=""
DELTA=""
KEEP=""
VERSION="-e"
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=""
		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
	if [ -f "$SCCSDIR/s.$FILE" ]
	then
		DELTADIR=$SCCSDIR
	elif [ -f "s.$FILE" ]
	then
		DELTADIR=.
	else
		RET=2
		continue
	fi

	prs $VERSION -d"@:I:\t:Dd:/:Dm:/:Dy:\t:T:\t:P:\t:C:" $DELTADIR/s.$FILE |
		grep "^@" | cut -c2-
	if [ $? -ne 0 ]
	then
		RET=3
		continue
	fi
done
exit $RET
