#! /bin/csh 

#*****************************************
#
# csh script used to run fakerat_menu
#
# D. W. Murphy	Last changed: 25-May-1995
#
#*****************************************

#
# In order for fakerat to run correctly a
# few environmental variables need to be set.
# If you need to set an environmental variable
# un-comment out the appropriate # setenv line
# by removing the # and then set the variable
# as you wish.


#*****************************************
# PGPLOT_FONT
#*****************************************

# set PGPLOT_FONT to the pathname of grfont.dat,
# if required.

setenv PGPLOT_FONT /usr/local/pgplot/grfont.dat
#setenv PGPLOT_FONT /usr/lib64/pgplot/grfont.dat

# notes:

# For pre 5.0 versions of PGPLOT there is no
# to set  PGPLOT_FONT if grfont.dat is in
# /usr/local/vlb/pgplot on SUN workstations

# For pre 5.0 versions of PGPLOT there is no
# to set  PGPLOT_FONT if grfont.dat is in
# /usr/src/pgplot on HP workstations


#*****************************************
# PGPLOT_DIR
#*****************************************

# In 5.0 or higher versions of PGPLOT:

# The environmental variable PGPLOT_DIR is used to show the 
# location of:
# (i) the pgxwin_server program, if this program is not
# in a directory in your path.
# and
# (ii) the PGPLOT library, if it is not in the library path 
# specified by the environmental variable LD_LIBRARY_PATH.

# set PGPLOT_DIR, if required:

# setenv PGPLOT_DIR <directory name>

#*****************************************
# PGPLOT_XW_CLICKLEFT
#*****************************************

# In pre 5.0 versions of PGPLOT:

# If PGPLOT_XW_CLICKLEFT is set to 1.
# X windows created by fakerat will
# not be destroyed until there is a
# click of the left hand mouse button
# in them:

# set PGPLOT_XW_CLICKLEFT here, if required:

 setenv PGPLOT_XW_CLICKLEFT 1

#*****************************************
# PGPLOT_XW_WIDTH
#*****************************************

# In pre 5.0 versions of PGPLOT:

# PGPLOT_XW_WIDTH set the size of an X window
# created by fakerat and fakerat_menu relative
# to a default size:

# set PGPLOT_XW_WIDTH here, if required:

 setenv PGPLOT_XW_WIDTH 0.6

#*****************************************
# End of Environmental Variables
#*****************************************



#*****************************************
# Running fakerat_menu via an XWindow
#*****************************************

#  set menurat_defaults = $1

# note: since -f is a csh file inquiry operator need
# to turn off this feature by creating the variable a 

  set a=a$1

#  echo 'a is: ' $a

if($a == "a-h") then
 echo  ' '
 echo 'possible run options are:'
 echo ' '
 echo 'run    : run fakerat_menu with simple menu'
 echo 'run -h : help option'
 echo 'run -s : run fakerat_menu with simple menu'
 echo 'run -c : run fakerat_menu with complex menu'
 echo 'run -f : re-initialize everything by running fakerat_init -f'
 echo '         followed by run'
 echo '  '
 exit
endif

  set menu = s
  set menurat_defaults = menurat_defaults

if( ${#argv} == 1 ) then
  set menurat_defaults = $1
endif

if($a == "a-f") then
 echo 'run -f option: '
 fakerat_init -f
 set menu = s
 set menurat_defaults = menurat_defaults
endif

if($a == "a-s") then
 echo 'run -s option: using simple menu'
 set menu = s
 set menu-ratdefaults = menurat_defaults
endif

if($a == "a-c") then
 echo 'run -c option: using complex menu'
 set menu = c
 set menurat_defaults = menurat_defaults
endif

if( ${#argv} == 2 ) then
  set menurat_defaults = $2
endif




if(! -e $menurat_defaults ) then
 echo ' '
 echo '***************************************************'
 echo ' ERROR in starting up fakerat_menu'
 echo ' menu-ratdefaults file: ' $menurat_defaults ' does NOT exist'
 echo '***************************************************'
 echo ' '
 exit
endif

fakerat_menu << EOD
$menurat_defaults
echo '                          ERROR in starting up fakerat_menu'
$menu
EOD

exit
