#! /bin/sh
# geomview shell script driver

MACHTYPE=linux

### If you want to be able to run geomview from a directory other than
### its distribution directory, or if you want to install it
### permanently on your system, first decide on a permanent place to
### keep the geomview distribution directory, and move or copy the
### entire directory (and all its subdirectories) to that location.
### Then change "." on the line defining GEOMROOT below to the
### absolute pathname of the distribution directory.  It is important
### that there be no spaces around the '=' sign.  For example, if the
### pathname of the geomview distribution directory on your system is
### "/usr/local/geomview", change the line below to
### 
### 	GEOMROOT="/usr/local/geomview"
### 
### Once you have made this change you can install a copy of this
### shell script anywhere you want (e.g. /usr/local/bin) and use it to
### invoke geomview.
###
### Here is the line to change:

GEOMROOT=.

########################################################################
#
#		  DO NOT CHANGE ANYTHING BELOW HERE		       #
#
########################################################################

### Geomview and/or its modules use the following environment
### variables.  For each of these that does not already have a value,
### this shell script assigns a value based on the setting of
### GEOMROOT above.  You can override these values if you want by
### setting them in your shell environment before invoking this
### script.
### 
### GEOMROOT: pathname of geomview distribution directory
### GEOMVIEW_GVX: pathname of executable file "gvx"
### GEOMVIEW_LOAD_PATH: colon-separated list of directories to search
### 	for files
### GEOMVIEW_EMODULE_PATH: colon-separated list of directories to search
### 	for modules
### GEOMVIEW_SYSTEM_INITFILE: pathname of an initialization file to
### 	read upon startup
### GEOMDATA: [ used only by some modules; for backward compatibility ]
### 	pathname of the data directory

: ${GEOMVIEW_GVX=${GEOMROOT}/bin/$MACHTYPE/gvx}
: ${GEOMVIEW_LOAD_PATH=.:${GEOMROOT}/data:${GEOMROOT}/data/geom:${GEOMROOT}/data/things}
: ${GEOMVIEW_EMODULE_PATH=${GEOMROOT}/modules/$MACHTYPE}
: ${GEOMVIEW_SYSTEM_INITFILE=${GEOMROOT}/data/.geomview}

# Geomview no longer uses GEOMDATA, but some external modules do.

: ${GEOMDATA=${GEOMROOT}/data}


export GEOMROOT GEOMVIEW_GVX GEOMVIEW_LOAD_PATH GEOMDATA \
        GEOMVIEW_EMODULE_PATH GEOMVIEW_SYSTEM_INITFILE


case "$1" in
  -dbx)  dbx  $GEOMVIEW_GVX ;;
  -gdb)  gdb  $GEOMVIEW_GVX ;;
  -edge) edge $GEOMVIEW_GVX ;;
  *) exec $GEOMVIEW_GVX ${1+"$@"} ;;
esac

