head	1.1;
access;
symbols;
locks; strict;
comment	@# @;


1.1
date	95.03.23.02.51.45;	author svalente;	state Exp;
branches;
next	;


desc
@env_setup
@


1.1
log
@Initial revision
@
text
@# Prototype file for setting up course-specific environment
# $Author: mar $
# $Source: /source/config/dotfiles/system/RCS/env_setup,v $
# $Header: /source/config/dotfiles/system/RCS/env_setup,v 1.4 1992/04/27 13:47:46 mar Exp cfields $

# Just in case this alias is not already set,
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'

echo "Attaching $SUBJECT ... "
set setup_dir = `/bin/athena/attach -p $SUBJECT`

if (! $status) then

	# Record information to remove setup later
	set setup_filsys = $SUBJECT

	# Set prompt to reflect changed environment
	set prompt = "$SUBJECT% "

	if ( -r $setup_dir/.attachrc) then
		unsetenv SUBJECT	# to prevent infinite loops
		echo "Running commands in $setup_dir/.attachrc ... "
		source $setup_dir/.attachrc
        else
		# Do minimal environment setup
		extend PATH $setup_dir/${bindir}
		extend MANPATH $setup_dir/man
        endif  
else
	echo ""
        echo "The $SUBJECT filesystem could not be attached."
	set filsys = `hesinfo $SUBJECT filsys`
	if ($#filsys < 3) then
		echo "Check your spelling of the filesystem name."
	else
		echo -n "The $filsys[1] fileserver"
		if ($filsys[1] != AFS) echo -n " named $filsys[3]"
		echo " may be down."
	endif
	if ($?XSESSION) then
		echo "Type exit to get rid of this window."
	else
		kill -HUP $$	# cause shell to exit
	endif
endif
unsetenv SUBJECT	# to prevent infinite loops
@
