#!/bin/sh
BROWSER=netscape
URL=/usr/local/bochs/1.4.1/DOC-linux.html
MY_PATH=/usr/local/bin/bochs-docs

cat <<EOF
-----------------------------------------------------
Viewing Bochs HTML documentation with $BROWSER
-----------------------------------------------------
EOF

if test "$BROWSER" = netscape; then
  # first try to put the documentation into the currently running netscape.
  $BROWSER -remote "openURL($URL)" >/dev/null 2>/dev/null

  # if that succeeded, we're done
  if test $? = 0; then
    exit 0
  fi
fi

# try starting a new browser instead
$BROWSER $URL

# nothing else to try, so if that failed print a decent error message
if test $? != 0; then
  echo ERROR: Browser ended with an error code $?.  This may mean that
  echo the browser was not found in your PATH, or that the browser was
  echo killed.  To use a different browser, edit $MY_PATH
  echo and change the BROWSER variable.
  exit 1
fi

exit 0
