#!/bin/sh
#
# ident "@(#)bbnetscape.sh 1.5     01/06/08 SMI"
#
# Copyright (c) 2000 by Sun Microsystems, Inc.
# All rights reserved.
#                       

. $BBROOT/etc/opt/SUNWbb/blackbox.rc
. $BBPATH/config/browser.rc

# damned netscape dumps core when you take away the X server
ulimit -c 0

NS=$BROWSERPATH

MOZILLA_HOME=${NS} ; export MOZILLA_HOME

xset fp rehash >/dev/null 2>&1

# NS hangs when it finds a .newsrc-host and host isn't a know hostname
# it continues after the lookup times out
# solution: no .newsrc* file, no lookup !
/bin/rm -f $BBHOME/.newsrc*

eval `$BBPATH/bin/bbsetenv`
MOZILLA_HOME=$MOZILLA_HOME ; export MOZILLA_HOME;
PATH=/bb/bin:$PATH

BBLD_PRELOAD=`echo $BBLD_PRELOAD | tr -s ':' ' '`
export BBLD_PRELOAD 

$BBPATH/bin/bbchroot  $BBROOTPATH "${NS}/${BROWSER} $*" &
bpid=$!
 
if [ "$bpid" != "" -a "$bpid" -gt 0 ]; then 
	echo $bpid > $BBTMPPATH/${BBUSER}.browserpid
	wait $bpid 
fi

rm -f $BBTMPPATH/${BBUSER}.browserpid

PID=`cat $BROWSER_LOCK 2>/dev/null`
if [ $? = 0 -a "$PID" != "" ]; then
	$BBPATH/bin/bbkillproc 15 $PID bbstartbrowser
fi
