#! /bin/bash

usage="$0 [ -round ] < EPSFILE"

# Prints the four parameters LOX LOY HIX HIY of the bounding box
# of an Encapsulated Postscript.
# The "-round" flag rounds them (outwards) to integers.

opts=( ) 

while [[ ( $# -gt 0 ) && ( "/$1" =~ /-.* ) ]]; do
  if [[  "/$1" == "/-round"  ]]; then
    opts=( ${opts} "-v" "rnd=1" ); shift
  else
    echo "unrecognized option: $1" 1>&2
    echo "usage: ${usage}" 1>&2; exit 1
  fi
done

if [[ $# -ne 0 ]]; then
  echo "usage: ${usage}" 1>&2; exit 1
fi

gawk -f ${STOLFIHOME}/lib/do_get_eps_bounding_box.gawk ${opts}
