#!/bin/sh

if [ $# != 1 ];
then
    echo "Usage: $0 file"
    exit 1
fi

file=$1
if [ ! -f $file ]
then
	echo "$0: $file is not a file!"
	exit 2
fi

if [ ! -r $file ]
then
    echo "$0: File $file cannot be read"
    exit 4
fi

#Try to open file in an existing netscape window
(netscape -no-about-splash -remote "openFile(${file})") >& /dev/null

#if this fails, it means that netscape is not running, so start it
if [ $status ]
then
  netscape -no-about-splash -no-install file:${file}
fi

