#
# .profile	-- Commands executed at login for Restricted Korn shell users
#
#	@(#) profile 1.1 90/03/13 
#
# Copyright (c) 1990, The Santa Cruz Operation, Inc.
# All rights reserved.
#
# This Module contains Proprietary Information of the Santa Cruz
# Operation, Inc., and should be treated as Confidential. 
#
#	The Restricted Korn Shell is identical to the Standard
#	Korn Shell except that the user may _not_:
#	  (1)  cd,
#	  (2)  Set PATH, SHELL, or ENV,
#	  (3)  Use command names containing slashs ("/"), and
#	  (4)  Re-direct output with ">", ">|", "<>", or ">>".
#	Any shell script, however, is run by the unrestricted Korn
#	Shell -- which means that the user should not have both write
#	and execute permission for any directory listed in PATH.
#
#		NOTE TO THE SYSTEM ADMINISTRATOR
#		--------------------------------
# Each Restricted Korn Shell user should have a customized version
# of this script installed in their home directory as ".profile".
# They should also have a suitably customized ".kshrc" file.
#
# The required customizations depend on the what the user is allowed
# to do (or should be prevented from doing).  Typically, the user's
# private $HOME/bin should contain only the commands the user is
# allowed to execute, and the PATH environment variable should be
# set to _only_ search the user's $HOME/bin directory.  Futhermore,
# the user's current working directory should be changed to be some
# directory _other_ than their home, and the user should not have
# both write and execute permissions in that directory.
#
#	Please examine, edit, and test each user's customized
#	copy of this script before allowing that user to log
#	onto the system.
#
# CAUTION - When this script is executed at login time,
#	the restrictions of the Restricted Korn shell
#	are not yet in effect.  The restrictions start
#	to apply as soon as this script, and the ENV script
#       (i.e., ".kshrc") are done executing.  (If the user
#	tries to interrupt either script while it is executing,
#	the Restricted Korn Shell exits.)
#
# The following setting of PATH applies _only_ for the duration
# of this script; the user's PATH is set at the very end (below).
#
PATH=/bin:/usr/bin
export PATH

#
# PWD	-- Korn shell's idea of the current working directory
#
#	This is only for efficency; assumes the initial cwd is HOME.
#
if [ -z "$PWD" ]; then
	PWD=$HOME
	export PWD
fi

#
# SHELL	-- What shell program a command's shell escape is to run
#
#	If the user is allowed to run a program which has a shell escape,
#	pray and hope that that program respects the SHELL environment
#	variable -- otherwise, via the shell escape, the user can run
#	an unrestricted shell.
#
SHELL=/bin/rksh
readonly SHELL
export SHELL

#
# ENV	-- Restricted Korn shell startup file
#
#	This file is executed each time a Korn shell (restricted or not)
#	is started.  It should not be writable and should not be placed
#	in directory writable by the user.
#
if [ -f $HOME/.rkshrc -a -r $HOME/.rkshrc ]; then
	ENV=$HOME/.rkshrc
	export ENV
fi

#
# MAIL	-- Where the user's system mailbox is located
#
#	If the user is not allowed to run "mail", this setting
#	of the MAIL envirnoment variable should be removed.
#
MAIL=/usr/spool/mail/`logname`
readonly MAIL
export MAIL

#
# Normal-style user setup goes here.
#

# use default system file creation mask (umask)

# If job control is enabled, set the suspend character to ^Z (control-z):
case $- in
*m*)	stty susp '^z'
	;;
esac

eval `tset -m ansi:ansi -m :\?ansi -r -s -Q`

set -o ignoreeof			# don't let control-d logout

PS1='!$ '				# include command number in prompt
export PS1

#
# PATH -- Where commands are searched for
#
#	The PATH should not include either /bin (else the user can run "sh",
#	the un-restricted Bourne Shell), or /usr/bin (for similar reasons).
#
PATH=$HOME/bin
readonly PATH
export PATH

#
# Current working directory
#
#	It is inadvisable to have a Restricted Korn Shell user's
#	current working directory be the same as thier home directory.
#	Hence, we chdir to $HOME/work, making that directory be the
#	user's current working directory.
#
cd $HOME/work

#
# Done.  The ENV file (i.e., "kshrc") will now be executed,
# and then the restrictions of the Restricted Korn Shell will
# be applied.
#
