#!/bin/sh
#	$Id: process,v 1.7 1999-12-15 21:47:17 steve Exp $
# Process a document
#	Process a document using the (new) Document Processing System
#
# Usage: 
#	process [option]... filename
#
#
### Find out where this command came from:
#	Resort to a kludge to get around the fact that "type foo"
#	returns something like "foo is xxx", but "type -p foo" is
#	not supported on Solaris.

### May break if classpath is not set appropriately.

if [ "$1" = "--kludge" ] ; then
    echo $4
    exit
fi

XXX=`type $0`
XXX_BIN=`$0 --kludge $XXX` >/dev/null 2>&1
PIA_BIN_DIR=`dirname $XXX_BIN`
if [ ! -x "$XXX_BIN" ] ; then
    echo "Cannot locate binary directory for the PIA."
    echo "Please put the PIA's binary directory in your $PATH"
    exit 1
fi
PIA_HOME=${PIA_HOME-$PIA_BIN_DIR/..}
export PIA_HOME

### Handle -v specially: 
#	it has to be the first option in order for pia_wrapper to see it.

if [ "$1" = "-v" ] ; then
    V="-v"
    shift
fi

# We will count on Pia to handle multiple occurrances of -root and so on,
#	so that arguments provided by the user will override anything
#	this script puts earlier in the argument list.

exec $PIA_BIN_DIR/pia_wrapper org.risource.dps.Filter $V $*
