#! /bin/sh

# Compress TeX/Mathematica Mathematica 2.0 graphics
# 12/20/91 dan@chem.bu.edu

# Compress each file and write bounding box information to file.bb for psfig

if [ $# -lt 1 ]
then
	echo Usage: $0 file1 [ file2 ... ]
	echo Compress TeX/Mathematica Mathematica 2.0 graphics to file.Z and file.bb
	exit 1
fi

while [ "$1" != "" ]
do
	bb=`grep "%%BoundingBox" $1`
	if [ "$bb" != "" ]
	then
		echo "%!" > $1.bb
		echo $bb >> $1.bb
		compress -f $1
	else
		echo "$1 has no bounding box data; skipping"
	fi
	shift
done

