#! /bin/sh
#
if ( test $# = 0 ) then
	echo " "
	echo "man1copy:  copy manual pages from section 1"
	echo "           to remote system using shadowcopy facility"
	echo "           & to /explprod/phase1/man/[man1,cat1] both"
	echo "           locally & remotely"
	echo "           The date is also stamped onto the man page"
	echo " "
	echo "Usage:"
	echo "        man1copy [program names]"
	echo " "
	exit 1
fi
#set pgm = $argv[1]
cdir=`pwd`
#
for args
	do
	cd $DEPTROOT/usp/man/man1
	if (test ! -f $args.1) then
	  exit 0
	fi
	date="`date '+\"%a %h %d 19%y\"' `"
	line=".TH $1 1  $date \"From trcgp\/usp\""
	sed "1,$ s/\.TH.*/$line/" $args.1 > tmp.$$
	"mv" tmp.$$ $args.1
	man -M ${DEPTROOT}/usp/man $args 2> tmp.$$
	/usr/bin/rm tmp.$$
	cd $DEPTROOT/usp/man/cat1
	echo "Updating explprod cat1"
	/usr/bin/rm $EXPLROOT/usp/man/cat1/$args.1
	"cp"  $args.1    $EXPLROOT/usp/man/cat1
	echo "Updating explprod man1"
	"rm" $EXPLROOT/usp/man/man1/$args.1
	"cp"  $DEPTROOT/usp/man/man1/$args.1    $EXPLROOT/usp/man/man1
	if( test "$ARCH" != "cray2" ) then
	  echo "Remotely updating cray usp & explprod cat1: "$args.1
	  rcp $args.1 sc:~apcexpl/explprod.cray/phase1/trcgeop/usp/man/cat1
	  shadowcopy -v $args.1
        fi
done 
#
