R-alpha: bouncing message...

Martin Maechler (maechler@stat.math.ethz.ch)
Fri, 17 May 96 09:17:06 +0200


Date: Fri, 17 May 96 09:17:06 +0200
Message-Id: <9605170717.AA13206@>
From: Martin Maechler <maechler@stat.math.ethz.ch>
To: R-testers@stat.math.ethz.ch
Subject: R-alpha: bouncing message...

[this message originally BOUNCED to the  list owner (M.Maechler),
 because it had 'help' in it's subject, ...]

To: R-testers@stat.math.ethz.ch
Subject: help command
From: Luke Tierney <luke@stat.umn.edu>
Message-Id: <9605161852.AA20534@nokomis.stat.umn.edu>
Date: Thu, 16 May 1996 13:52:04 -0500 (CDT)

I just joined this list recently, so if this has been rehashed before,
I apologize.

I am in the process of setting up R on our systems and wanted to get
the help() command to pop up the appropriate html file as generated by
'make man.html'. The following modification to cmd/help seems to do
the trick. When DISPLAY is set it tries to use an existing netscape or
starts a new one; otherwise it uses lynx. The hack for locating the
file to open is based on the structure of the html/funs/index file.

(I'm not much of a sh or regexp programmer, so I'm sure this could be
cleaned up quite a bit.)

luke
-------------------------------------------------------------------------------
#!/bin/sh

textbrowser=/usr/local/bin/lynx
file=$RHOME/html/index.html
ifile=$RHOME/html/funs/index.html

#
# If $1 is not empty, try to find one entry for $1 in the index file
#
if [ $1 ]
then
	entry=`grep ">$1<" $ifile | head -1 | sed 's/^.*="//' | sed 's/".*$//'`
	if [ $entry ]
	then
		file=$RHOME/html/funs/$entry
	else
		echo "can't find help for \"$1\""
		exit
	fi
fi

#
# Fire up netscape or text browser on $file
#
if [ $DISPLAY ]
then
	#
	# For netscape, first try to use an existing browser.
	# If that fails, try to start up a new browser.
	#
	if (netscape -remote "openURL($file)" 2> /dev/null)
	then
		status="success"
	else
		status="failure"
	fi
	if [ $status = "failure" ]
	then
		echo "starting up netscape ..."
		netscape $file &
	fi
else
	$textbrowser $file
fi




=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-testers mailing list -- To (un)subscribe, send
subscribe	or	unsubscribe
(in the "body", not the subject !)  To: r-testers-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-