#!/bin/csh -f

# clean up each input .ps file from the Mac by replacing ^M with ^J and
#  stripping the %%EOF (also rescind execute permission for the file and
#  remove the %-prefixed temp file)
foreach f ($argv)
	echo Cleaning $f
	/bin/cp $f $f-dirty
	/bin/chmod -x $f
	/usr/bin/tr '\015' '\012' < $f-dirty | /bin/grep -v %%EOF >! $f
	/bin/rm $f-dirty
	if (-f "%$f") /bin/rm "%$f"
end

