#!/bin/bash

# A quite restrictive simv server which only allows navigation and viewing.
# Intented to work with  simv_frontend.php3  via a http server.

# adjustable parameters :

# The directory in which the PHP3 frontend script resides 
workdir=/usr/local/httpd/htdocs/stic


# the portnumber where to provide service. This must be the same as in the
# variable $simv_port in the PHP3 frontend script
simv_port=4000


# ---------------------------------------------------------------------

# determine the installation directory of stic_std_variables and execute inline
if test -n "$STIC_MAIN_DIR"
then
  stic_init_dir=$STIC_MAIN_DIR
elif test -r $HOME/.stic_main_dir
then
  stic_init_dir=$(cat $HOME/.stic_main_dir)
fi
if test "$stic_init_dir" = ""
then
  stic_init_dir=$(dirname "$0")/
else
  stic_init_dir="$stic_init_dir"/scripts/
fi
if test -r "$stic_init_dir"stic_std_variables
then
  . "$stic_init_dir"stic_std_variables
elif test  -z "$STIC_NO_BASH" -a -n "$(type -p stic_std_variables)"
then
  . stic_std_variables
fi


tmpdir=$workdir/tmp

if test -d $tmpdir
then
  dummy=dummy
else
  mkdir $tmpdir
fi


  if test "$1" == "-tcltk"
  then
    with_tcltk="-tcltk"
    shift 1
  fi
  if test "$1" == "-no_rc"
  then
    no_rc="-no_rc"
    shift 1
  fi

  "$stic_scripts_dir"simv_start \
    $with_tcltk \
    $no_rc \
    -end_on:all:clear \
    -show_copy:'*':all:max_number=5keep=60:$tmpdir/simv \
    -internal:current_file:off \
    -internal:double_files:off \
    -tcp_service:2:localhost:$simv_port:7F000001:obstinate \
    -permission:all:all:deny \
    -permission:all:navigation:permit \
    -permission:all:client:permit \
    -permission:all:info:permit \
    -permission:internal_owner:all:permit \
    "$@" \

