handy little throwaway
Mike Muuss
mike at BRL.MIL
Tue Nov 27 11:50:57 AEST 1990
Mike's note on $REMOTEHOST prompts me to describe a more complex way of
handling the setting of $DISPLAY. For quite a few years, I have been
able to use the same .login & .cshrc on every machine I have access to,
without modification, be it BSD or SYSV. This takes some effort, but it
well worth it in the long haul. (Thanks to Phil Dykstra & Doug Kingston
for having worked out several parts of this strategy).
For handling the $DISPLAY setting, I have attached an excerpt.
If anybody would like a copy of the complete dot files, let me know.
Best,
-Mike
----
# .login
#
# Done for csh and tcsh login shells (after .[t]cshrc) files.
# Depends on $hostname already being set by .cshrc
# Special handling for various kinds of terminals
switch ($term)
case "": # Establish default here
set term=vi200;
# fall through to...
case vi200:
cat ~mike/.vis200-clear
stty tabs
breaksw
case sun:
switch (`tty`)
case /dev/console:
# In SUN 1.4, 2.0, /usr/suntool/suntools, in 3.0, /usr/bin
set suntools=/usr/bin/suntools
echo -n "Suntools file? "
set ans=$<
switch ($ans)
case "s":
case "sun":
case "sunview":
setenv DEFAULT_FONT /usr/brl/sunfonts/screen.r.12+
exec $suntools
breaksw
case "n":
breaksw
case "":
case "x":
unsetenv DISPLAY
# exec /usr/bin/X11/xinit # X11R3
exec /usr/X11/bin/xinit # X11R4
breaksw
default:
exec $suntools -s $ans
breaksw
endsw
default:
breaksw
endsw
breaksw
case iris*:
switch (`tty`)
case /dev/console:
setenv DISPLAY localhost:0
breaksw
default:
set needDISPLAY=1
endsw
breaksw
case xterm*:
# This is an xterm window, point back to originating workstation
set needDISPLAY=1
breaksw
endsw
# See if DISPLAY needs to be set, for X Window System
if ( $?needDISPLAY > 0 ) then
switch ($?DISPLAY$?REMOTEHOST)
case 01:
# rlogind on SGI 4D machines sets this
setenv DISPLAY ${REMOTEHOST}:0
breaksw
endsw
switch ($?DISPLAY$?LOCHOST)
case 01:
# 4Sight windows on SGI 4D machines have this
setenv DISPLAY ${LOCHOST}:0
breaksw
endsw
switch ($?DISPLAY)
case 0:
# Still no luck.
# "who am i" on BSD machines (and Crays) shows something like:
# sem.brl.mil!phil ttyp2 Apr 25 01:55 (sat)
# In case the "(host)" part is missing (SysV), add protection.
set whoent="`who am i` (localhost)"
# Grab just first remote host part, ignore a second one
set rhost=`echo $whoent | sed -e 's/).*$//' -e 's/.*(//'`
setenv DISPLAY "${rhost}:0"
unset whoent rhost
breaksw
endsw
unset needDISPLAY
endif
More information about the Comp.sys.sgi
mailing list