# @(#)/usr/local/share/etc/env.src  1999-08-07 Markus Gyger <mgyger@gmu.edu>

# This file can be sourced in by different flavours of shells (newer sh,
# ksh, bash, csh, tcsh, etc.) on various OS (Solaris, HP-UX, etc.) so that
# environment variables can be defined in one place and the environments
# of the different shells don't get out of sync.
#
# Put the following at the end of /etc/profile to enable it on sh-like shells:
#
#   if [ -r /usr/local/share/etc/env.src ]
#   then . /usr/local/share/etc/env.src
#   fi
#
# and append the following to /etc/.login for the csh-like shells:
#
#   if (-r /usr/local/share/etc/env.src) source /usr/local/share/etc/env.src
#
# Available keywords (commands):
#
#   setenv   <VAR> <value>      # set environment variable
#   unsetenv <VAR>              # undef environment variable
#   ifndef   <VAR> <value>      # set variable only if not defined yet
#   ifnull   <VAR> <value>      # set variable if not defined or empty
#   append   <VAR> <path>       # append  path separated by :
#   prepend  <VAR> <path>       # prepend path separated by :

# The following sets up above mentioned commands if they are not native
# to the used shell already. It looks a bit cryptic because some shells
# are rather buggy...

test X != "X$path" && goto cshish
setenv()   { eval $1=\$2 export $1; }
unsetenv() { unset "$@"; }
ifndef()   { eval $1=\${$1-\$2} export $1; }
ifnull()   { eval $1=\${$1:-\$2} export $1; }
append()   { eval $1=\${$1:+\$$1${2:+:}}\$2 export $1; }
prepend()  { eval $1=\$2\${$1:+${2:+:}\$$1} export $1; }
cat << \: >/dev/null
cshish:
alias ifndef  'if (! $?\!:1) setenv \!:1 \!:2'
alias ifnull  'if (! $?\!:1) setenv \!:1; eval " \\
      test X != '\''X$\!:1'\'' || setenv \!:1 \!:2"'
alias append  'if (! $?\!:1) setenv \!:1; eval " \\
      test X != '\''X$\!:1'\'' && setenv \!:1 $\!:1\:\!:2 || setenv \!:1 \!:2"'
alias prepend 'if (! $?\!:1) setenv \!:1; eval " \\
      test X != '\''X$\!:1'\'' && setenv \!:1 \!:2\:$\!:1 || setenv \!:1 \!:2"'
:

################################################################################

# Here start the definitions for the environment variables.
# This is an example for Solaris 7. 

# create files with default permissions -rw-r--r-- (or -rwx-r-xr-x)
umask 022

# use most common terminal as default if none is set
ifnull	TERM		vt100
ifndef	OPENWINHOME	/usr/openwin

# default paths (UNIX 98; no /usr/ucb included!)
setenv	PATH	/usr/xpg4/bin:/usr/bin:/usr/proc/bin:/usr/ccs/bin
append  PATH	/usr/dt/bin:/usr/openwin/bin:/usr/local/bin:/opt/SUNWspro/bin
setenv	MANPATH	/usr/share/man:/usr/dt/share/man:/usr/openwin/share/man
append	MANPATH	/usr/local/share/man:/opt/SUNWspro/man

# applications without symbolic link or wrapper in /usr/local/bin
append	PATH	/opt/gnu/bin:/opt/perl/bin
append	MANPATH	/opt/gnu/share/man:/opt/perl/share/man
append	PATH	/opt/tex/bin
append	MANPATH	/opt/tex/share/man

# additional sysadmin commands
#append	PATH	/usr/sbin:/sbin:/usr/lib/nis:/usr/local/sbin
#append	PATH	/usr/opt/SUNWmd/sbin:/usr/bin/nsr:/usr/sbin/nsr
#append	PATH	/opt/SUNWadm/bin:/opt/SUNWrtvc/bin:/opt/patchdiag/sbin
#append	PATH	/opt/SUNWste/bin:/opt/ncdware/bin:/opt/sunscan/bin
append	MANPATH	/usr/opt/SUNWmd/man:/opt/SUNWadm/man:/opt/SUNWpcnfs/man
append	MANPATH	/opt/SUNWrtvc/man:/opt/SUNWste/man:/opt/SUNWtnftl/man
append	MANPATH	/opt/ncdware/man:/opt/SUNWabi/man:/opt/sunscan/man

# personal apps
append	PATH	$HOME/bin
append	MANPATH	$HOME/man

# add current directory as last component
append	PATH	.

# ksh stuff
ifndef	ENV		/usr/local/share/etc/kshrc
ifndef	CDPATH		:..:$HOME
ifndef	HISTSIZE	1000

# pager for man, etc.
#ifndef	PAGER		"less -s"
#ifndef	LESS		-ieM
#ifndef	LESSCHARSET	iso8859
ifndef	MORE		-ie

# just in case -- setting it slows down everything
unsetenv LD_LIBRARY_PATH

# we use IMAP instead of a mail spool
unsetenv MAIL MAILPATH

# site specific for browsers etc.
ifndef	ORGANIZATION	"George Mason University, Fairfax, Virginia, USA"
ifndef	WWW_HOME	http://www.gmu.edu
ifndef	NNTPSERVER	news.feed.net

# nice defaults for vi
ifndef	EXINIT	"set ai exrc ic redraw sw=4"

# local Xt resources and bitmaps (i.e. app-defaults files)
ifndef	XFILESEARCHPATH	%D
append	XFILESEARCHPATH	/usr/local/lib/X11/%T/%N%S
