#!/bin/csh -f
#
#	$Id: ncargrun,v 1.8 2010-03-14 21:35:06 haley Exp $
#

foreach arg ($argv)

	switch ($arg)

	case "-o":
		set get_output
		breaksw

	case "-t":
		setenv NCARG_GKS_OUTPUT "| ctrans"
		breaksw

	default:
		if ( $?get_output ) then
#
# Out of laziness, just set all five of these env. vars and
# not worry about which one actually gets used.
#
			setenv NCARG_GKS_OUTPUT $arg
			setenv NCARG_GKS_PSOUTPUT $arg
			setenv NCARG_GKS_PDFOUTPUT $arg
			setenv NCARG_GKS_CPSOUTPUT $arg
			setenv NCARG_GKS_CPDFOUTPUT $arg
			setenv NCARG_GKS_CPNGOUTPUT $arg
			unset get_output
		else
			if ( ! $?program ) then
				set program=$arg
			else
				echo "$0: too many program names"
				exit 1;
			endif
		endif
	endsw
end

./$program
