#! /bin/csh -f
#! /bin/csh -fxv
#
# shar - create shell archive of text files
# Usage: makeshar sharfile file1 file2 ...
#
if( $#argv < 2 ) then
	echo "Usage: makeshar sharfile file1 file2 ..." > /dev/tty
	exit 1
endif
set AR=$1		# 
shift			# Rest of arguments are files
if( $#argv < 1 ) then
	echo "Usage: makeshar sharfile file1 file2 ..." > /dev/tty
	exit 1
endif
echo '#\!/bin/csh -f' > $AR
echo '#This is a csh archive. Unwrap it by typing csh file' >> $AR
foreach i ( $argv)
	file $i | grep text > /dev/null
	if ( $status != 0 ) then
		echo $i not archived > /dev/tty
		continue
	endif
	echo a - $i
	echo "echo x - $i" >> $AR
	echo "cat > $i << FunkyStuff" >> $AR
	cat $i >> $AR
	echo FunkyStuff >> $AR
end
exit 0
