#!/bin/csh -f
# $Header: /afs/athena.mit.edu/astaff/project/layerdev/src/conf/RCS/login_athena,v 1.1 93/09/24 17:51:19 mar Exp $


# setup environment

setenv KRBTKFILE /tmp/tkt_$user
setenv hosttype `/bin/athena/machtype`
setenv HOSTTYPE $hosttype
setenv WGFILE /tmp/wg.$$


# do things normally done in the athena login program

/usr/athena/bin/kinit $user
/bin/athena/attach $user
/usr/athena/bin/get_message
if ( -f /usr/athena/bin/quota ) /usr/athena/bin/quota


# get most athena shell setup here

if ( -f /usr/athena/lib/init/cshrc ) then
	source /usr/athena/lib/init/cshrc
	unalias logout
else
	set path=(/bin/athena /usr/athena/bin $path)
	set bindir=${hosttype}bin
	alias renew 'kinit $USER && fsid -a && zctl load /dev/null'
	#   aliases dealing with adding locker programs
	#   'add -v locker' will be verbose about it
	alias extend 'if (-d \!:2) if ("$\!:1" \!~ *"\!:2"*) set extendyes && \\
	if ($?extendyes && $?verboseadd) echo \!:2 added to end of \$\!:1 && \\
	if ($?extendyes) setenv \!:1 ${\!:1}:\!:2 && \\
	unset extendyes'
	alias add 'set locker=\!:1 && \\
	if ("x\!:$" == x-v) set verboseadd locker=\!:1 && \\
	if ("x\!:1" == x-v) set verboseadd locker=\!:$ && \\
	if $?verboseadd attach -n -h $locker &&\\
	set dir = `attach -p $locker` && \\
	if ("$PATH" =~ *"$dir/$bindir"*) rehash && \\
	extend PATH $dir/$bindir && \\
	extend MANPATH $dir/man && \\
	unset dir verboseadd locker'

endif


# do X if necessary

if ( $?DISPLAY ) then
	if ( -f /usr/athena/lib/init/xsession ) then
		source /usr/athena/lib/init/xsession
	else
		dash &
		zwgc
		(olc who &) >& /dev/null
	endif
else
	if ( -f /usr/athena/lib/init/login ) then
		source /usr/athena/lib/init/login
	else
		zwgc -ttymode
		(olc who &) >& /dev/null
	endif
endif

