#!/bin/csh -f

#	/mit/logos/scriptbin/olh
#
#	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: $
#	$Author: $
#	$Header: $
#

if ($?DISPLAY) then
	set style=motif
else
	set style=ascii
endif

set args=""

foreach i ($argv)
	switch ($i)
	case "-n*":
	case "-a*":
	case "-t*":
		set style=ascii
		breaksw
	case "-x*":
	case "-m*":
		set style=motif
		breaksw
	default:
		set args="$args $i"
		breaksw
	endsw
end

set olh_program=/mit/logos/${hosttype}bin/olh_${style}

if (${style} == "motif") then
  echo " \
------------------------------- May 8, 1991 -------------------------------- \
If you use the X version of OLH on a low-end workstation, the system will \
automatically convert formatted documents into plain-text versions (where \
possible) and show the text in the built-in OLH text displayer.  (Thus, EZ \
documents are converted to text versions rather than shown in a separate EZ \
window, but PostScript documents are still shown using viewscribe, since we\
don't have a PostScript-to-text converter yet.)  This helps keep OLH from \
hogging all the memory on your workstation. \
\
To have OLH use the appropriate viewer for each document (and NOT convert to \
plain text), select the Use External Viewers option from the Options pop-up \
menu.  You can also use this option to ACTIVATE the conversion behaviour on \
high-end workstations where the default is to use external viewers. \
\
If you still run into memory problems with OLH, try:  help -tty \
"
  setenv XENVIRONMENT /mit/logos/${hosttype}bin/Olh.ad
else
  if (${style} == "ascii") then
# put any important announcements for tty users here...
#        echo -n ""
#	/mit/logos/${hosttype}bin/anykey
  endif
endif


if (-e $olh_program) then
	$olh_program $args
	if ($status != 0) then
		echo "----------------------------------------------------"
		echo "Program exited with an error.  Please type help -tty to use the text \
version of On-Line Help, or call 3-4435 if you encountered errors with the
text version. \
"
	endif
else
	echo "----------------------------------------------------"
	echo "Could not find '${olh_program}'.  To use the text-based \
version of On-Line Help, type   help -tty \
"
	endif
endif
