#
#  .egtsrc: table-driven default supplier for EGTS (UNIX version)

#	usage:	"source .egtsrc"

# 	this program sets hardware-oriented environment variables
#	that may be required by "egts" (Ethernet Graphic Terminal
#	Server) or application tasks. This information is extracted
#	from the EGTS configuration table.

#	It may select a graphic display by association with the
#	alphanumeric terminal that the present user is using (over
#	a physical terminal line connection).

#	version control:
#	===============
#  	V1.0  KH 22-may-90:	initial version
#  	V1.1  KH 19-nov-90:	bg replaces bics
#  	V1.2  KH 28-nov-90:	BARCO_EGTS_DATA_DIR replaces BARCO_EGTS_CONFIG
#  	V1.3  KH 15-dec-90:	filename of this file becomes ".egtsrc"
#  	V1.4  KH 15-jan-91:	env vars become BG_XXX
#  	V1.5  KH 26-feb-91:	don't set execution path;, is done elsewhere

#	note:
#	====
#	"eline" uses the "rwho" daemon to determine physical line information
#	when terminals are connected over ethernet networks to remote hosts.
#	In order to work, information about other machines, required
#	by "rwho" daemons, ought to be available.

# clear the environment

unsetenv BG_EGTS_ETH_DST
unsetenv BG_EGTS_BOOT_DIR
unsetenv BG_EGTS_RUN_DIR
unsetenv BG_EGTS_DATA_DIR

# fill in individual defaults, then make sure these lines are not commented out

#setenv BG_EGTS_ETH_DST		"02:68:30:7D:03:62"
#setenv BG_EGTS_BOOT_DIR	"$HOME"/egts/boot
#setenv BG_EGTS_RUN_DIR		"$HOME"/egts/run
#setenv BG_EGTS_DATA_DIR	"$HOME"/egts/dat

# connected by a physical terminal line ?

set terminal=`eline`

# terminal line corresponds with a graphic device?

set scanline=`escan GD NONE $terminal`
if ($status != 0) exit

# if so, set environment, accordingly

setenv BG_EGTS_ETH_DST		$scanline[2]
setenv BG_EGTS_GT_IMAGE		$scanline[4]
setenv BG_EGTS_GT_SCRIPT	$scanline[5]
setenv BG_EGTS_GT_MONITOR	$scanline[6]
setenv BG_EGTS_GT_POINT		$scanline[7]
