#!	/bin/csh -f
#
# Copyright 1993, 1994, 1995 by the Regents of the University of California.
# see the file "Copyright" in the distribution for conditions of use.
#
#
#	turn "mesg" on/off for future sessions
#
if( $#argv != 1 ) then
	echo "*** usage: mesg [y|n]"
	exit 1
endif
#
set temp = `mktemp -c`
set temph = `mktemp -c -p .tmp -d ~`
if( $1 == "on" ) then
	echo "mesg y" > $temp
else
	echo "mesg n" > $temp
endif
grep -v '^mesg ' ~/.login >> $temp

/bin/cp $temp $temph
if( $status ) goto error
/bin/mv $temph ~/.login
echo '"mesg"' option will be $1 in future login sessions.

done:
/bin/rm -f $temp $temph
exit

error:

cat << "EOT"

The change could not be made; possibly due to disk quota problems.

"EOT"
goto done
