#!/opt/teamware/bin/perl
#
#ident	"@(#)newdeltas	1.1	93/11/18 SMI"
#
# Copyright (c) 1993 by Sun Microsystems, Inc.
#
# Perl script to list SCCS file deltas newer than a given date.
#
$USAGE="usage: newdeltas filelist YYMMDD";
#
# Input:
#    filelist: List of all files that have updates in them.
#	Construct this list by editing output from putback -n.  Form a
#	simple list of files rooted at the top of the workspace and cut
#	out the creates and deletes to yield of list of updated files.
#    YYMMDD: given date afterwhich relevant deltas were made.
#
# Output:
#	A list to stdout of "sccs prs" histories for each file and the
#	deltas between the present file and the version at the given date.
#	Keywords are shown expanded in the diffs.


$|=1; # Unbuffered output

$DELTA_FILES=@ARGV[0];

if ( $#ARGV < 1 )
{
   print("${USAGE}\n");
   exit(1);
}

$given_date = @ARGV[1];

$CODEMGR_WS = $ENV{"CODEMGR_WS"};
if (length($CODEMGR_WS) < 2) 
{
	print("\$CODEMGR_WS is not set, set and re-run\n");
   	print("${USAGE}\n");
	exit(1);
} #if

if (-f $DELTA_FILES)
{
   open(delta_files,"$DELTA_FILES");
} #if
else
{
   print("Unable to open: ${DELTA_FILES}\n");
   exit(1);
} #else

while (<delta_files>)
{
   chop($_);
   $file = $_;
   $file =~ s/.*\///o;
   $dir = $_;
   $dir =~ s/\/[^\/]*$//o;
   chdir("${CODEMGR_WS}/${dir}");
   print("<------------------------------------------------------------>\n\n");
   print("FILE: ${dir}/${file}\n\n");
   system("sccs prs -c${given_date} -l ${file}");
   system("sccs diffs -c${given_date} ${file}");
   print("\n\n");
} #while

