#! /bin/sh
# Script to stick bounding box finder in front of a postscript file.
#    Adapted from Ned's original
# $Header: bbfig,v 1.3 90/06/27 21:54:49 cosell Exp $
# Adapted for Ghostscript, kb@cs.umb.edu.

# Define this to the directory containing bb.ps, prepipe.ps, etc.
# Or put bb.ps in the same directory as this script, toss the
# Ghostscript stuff in the last line, and just print the output.
PSDIR=/usr/local/share/ps

if test ! -f ${PSDIR=`dirname $0`}/bb.ps; then
  echo "$0: Can't locate bb.ps" >&2
  exit 1
fi

if test -n "$DISPLAY"; then
  gs=gs
else
  gs=gsnd
fi

case $# in
    0)    cat $PSDIR/bb.ps -
	  ;;
    *)    cat $PSDIR/bb.ps "$@"
	  ;;
esac | $gs -q $PSDIR/prepipe.ps - $PSDIR/showpage.ps $PSDIR/loop.ps
