#!/bin/sh # # This script selects an appropriate version of the On-Line Help # system to run, depending on the user's display type and machine # type. # # $Source: /afs/athena.mit.edu/user/d/o/dot/arch/share/bin/RCS/olh,v $ # $Author: dot $ # $Header: /afs/athena.mit.edu/user/d/o/dot/arch/share/bin/RCS/olh,v 1.7 97/01/07 09:15:28 dot Exp $ # #### Configuration - Change these lines if things move. # Configuration re. location of OLH tree olh_topdir=/afs/athena.mit.edu/astaff/project/olh olh_url_prefix=file://localhost${olh_topdir} olh_url=${olh_url_prefix}/index.html olh_keywords_dir=${olh_topdir}/db olh_keywords_url_prefix=file://localhost${olh_keywords_dir} olh_keywords=${olh_keywords_dir}/keywords olh_keywords_html=${olh_keywords}.html # Configuration re. location of WWW browsers browser_topdir=`attach -p -n infoagents` browser_bindir=`athdir ${browser_topdir}` browser_ascii=lynx browser_graphic=htmlview # Messages msg_olc="Please call 3-4435 if you need help." msg_topics1="The old @topic:subtopic form for accessing help topics is no longer supported; try entering 'help "; msg_topics2="' instead." msg_keyword1="Keyword " msg_keyword2=" not found. Bringing up OLH Keyword list." msg_fail1="The "; msg_fail2=" browser failed." msg_fail_motif="Try running 'help -tty' instead." msg_start1="Starting "; msg_start2=" World-Wide Web browser..." #### End Configuration - No changes needed below this line. PATH=${browser_bindir}:$PATH if [ "$WWW_HOME" = "" ] ; then WWW_HOME=$olh_url export WWW_HOME fi # See if X DISPLAY resource is set case $DISPLAY in "") browser=$browser_ascii run_in_background=false ;; *) browser=$browser_graphic run_in_background=true ;; esac # Parse command-line arguments args= lastarg= for i in $* ; do case $i in -n* | -a* | -t*) browser=$browser_ascii run_in_background=false ;; -x* | -m* ) browser=$browser_graphic run_in_background=true ;; *) args="$args $lastarg" lastarg="$i" ;; esac done # Choose starting page case $lastarg in @*) # old-style arg, e.g. @zephyr:start topic=`echo $lastarg | tr \: \@ | awk -F@ ' { print $2 } '` echo "${msg_topics1}${topic}${msg_topics2}" exit 1 ;; "") ;; *) # Extract relative URL from keyword html list topic=`echo $lastarg | tr A-Z a-z` relative_url=`awk ' $1 == "'$topic'" { print $2 }' $olh_keywords` case $relative_url in "") echo "${msg_keyword1}${lastarg}${msg_keyword2}" starting_url=$olh_keywords_html ;; ftp:* | http:* | gopher:*) starting_url=$relative_url # not really relative url ;; *) starting_url=${olh_keywords_url_prefix}/${relative_url} ;; esac ;; esac # Run program if [ "$browser" != "$browser_graphic" ] ; then echo ${msg_start1}${browser}${msg_start2} fi if [ "$starting_url" = "" ] ; then starting_url=$olh_url fi failure_message="$failure_message ${msg_olc}" if [ $run_in_background = true ]; then (($browser $args $starting_url || (echo "$failure_message")) &) else $browser $args $starting_url || (echo "$failure_message") fi # Done exit 0