#!/bin/sh
# webstone 2.6 98/07/25
#
############################################################################
#                                                                          #
# The contents of this file are subject to the WebStone Public License     #
# Version 1.0 (the "License"); you may not use this file except in         #
# compliance with the License. You may obtain a copy of the License        #
# at http://www.mindcraft.com/webstone/license10.html                      #
#                                                                          #
# Software distributed under the License is distributed on an "AS IS"      #
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See      #
# the License for the specific language governing rights and limitations   #
# under the License.                                                       #
#                                                                          #
# The Original Code is WebStone 2.5.                                       #
#                                                                          #
# The Initial Developer of the Original Code is Silicon Graphics, Inc.     #
# and Mindcraft, Inc.. Portions created by Silicon Graphics. and           #
# Mindcraft. are Copyright (C) 1995#1998 Silicon Graphics, Inc. and        #
# Mindcraft, Inc. All Rights Reserved.                                     #
#                                                                          #
# Contributor(s): ______________________________________.                  #
#                                                                          #
############################################################################

WEBSTONEROOT=`pwd` ; export WEBSTONEROOT
[ -z "$EDITOR" ] && EDITOR="vi"

case $1 in
  '-gui')
	  bin/webstone-gui.pl
	  ;;
  '-help')
	  echo
	  more README.FIRST
	  ;;
  '-setup')
	  if (sh bin/gui-configure)
	  then
		:
	  else
		echo
		echo "Some problems were found."
		echo "Press RETURN to continue, or CTRL-C to abort."
		read junk
	  fi
	  if [ -d src ]
	  then
		  if (cd src ; ./configure ; make install)
		  then
			echo
			echo
			echo "Press RETURN to continue"
			read junk
			$EDITOR conf/testbed
			echo
			echo "WebStone make complete."
			echo "Type './webstone -genfiles' to create the fileset."
			echo
		  else
			echo
			echo "WebStone make FAILED"
			echo "Consult the file doc/FAQ-webstone.html for porting hints."
			echo
		  fi
	  fi
	  ;;
  '-kill')
	   cd bin
	   ./killbench
	   ;;
  '-nogui')
	    cd bin
	    ./runbench
	    ;;
  '-genfiles')
	       cd bin
	       ./genfiles
		echo
		echo "If no errors occurred, type './webstone' to run the benchmark."
		echo
	       ;;
  '-silent')
	     cd bin
	     ./runbench > /dev/null 2>&1 &
	     ;;
  '-tail')
	   LATEST=$WEBSTONEROOT/bin/runs/`ls -1 $WEBSTONEROOT/bin/runs | tail -1`/run
	   tail -f $LATEST
	   ;;
  '-results')
	      bin/wscollect $2 bin/runs
	      ;;
	     
  *)
     $WEBSTONEROOT/webstone -nogui
     ;;
esac

# end
