#!/bin/sh
##########################################################################
##                                                                      ##
##       Copyright (C) 2011 by Xerox Corp.   All rights reserved.       ##
##                                                                      ##
##########################################################################

for NextArg; do
  ARGS="${ARGS}${LastArg} "
  LastArg=$NextArg
done

if ( [ $# -gt 1 ] && [ "$1"  = "-GS" -o "$1" = "-MS" ] ) || [ $# -eq 0 ];
then
	ARGS="${ARGS}${LastArg} "
else
	LPC="`echo $LastArg | cut -b1`"
	if [ "$LPC" != "/" -a -f "`pwd`/${LastArg}" ];
	then
		TargetFile="`pwd`/${LastArg}"
	else
		TargetFile=$LastArg
	fi
fi

cd /opt/XeroxOffice/prtsys
exec /opt/XeroxOffice/prtsys/xeroxofficedriver $ARGS $TargetFile
