#######################################################################
# Copyright (c) 2000 Roman Shakin <rshakin@unixfreak.org>.
# All rights reserved.
#
# Permission to use, copy, modify, and distribute this software for
# any purpose with or without fee is hereby granted, provided that the
# above copyright notice, this permission notice, and the following
# disclaimer appear on all copies.
#
# This software is provided by Roman Shakin on as is basis and all 
# warranties expressed or implied are disclaimed.  In no event 
# shall the author be held liable for any direct or indirect 
# damages however caused arising from the use of this software.
#   
#######################################################################

# USER SETTINGS (see above for descriptions)
set   notify
set   addsuffix
unset autocorrect
set   autoexpand
set   autolist = ambiguous
set   autologout = 0
set   backslash_quote
unset cdpath
set   color
unset echo
set   edit
unset ellipsis
unset fignore
set   histdup
set   histlit
set   ignoreof = 1
set   inputmode = insert
unset implicitcd
set   listjobs = long
set   listlinks
unset listmax
unset listmaxrows
set   matchbeep = nomatch
unset nobeep
unset noclobber
set   rmstar
set   savehist
set   time = ( 5 "%U user, %S system, %E real" )
set   symlinks = chase
set   watch = ( all 10 10 )
set   editor		= "vim"
set   pager		= "more"
set   mailpath	= (/var/mail/$USER)
unset cvsroot
umask 022

#### RESOURCE LIMITS
limit coredumpsize 0

#### REMOVE ALL CURRENT ALIASES
unalias *

# AUTOMATIC SETTINGS
if (-d /usr/local)		set	havelocal
if (-d /opt)			set	haveopt
if (-d /usr/pkg)		set	havepkg
if (-d /usr/X11R6)		set	havex11
if (-x $home/bin/chrepo)	set	havechrepo
if ($home == "/root")		set	weareroot

# ALIASES SETUP

alias ls            'ls -F'
alias l             'ls -l'
alias la            'ls -a'
alias ll            'ls -lag'
alias ld            'ls -d *'
alias lld           'ls -ld *'
alias lm            'ls -l | more'
alias llm           'ls -lag | more'
alias cp            'cp -i'
alias mv            'mv -i'
alias rm            'rm -i'
alias pwd           'echo $cwd'
alias h             'history \!* | head -39 | more'
alias more          'less'
alias m             'more'
alias t             'tail'
alias tf            'tail -f'
alias lynx          'lynx -nocolor'
alias ..            'set dot=$cwd;cd ..'
alias ,             'cd $dot '
alias open          'chmod go+r'
alias shut          'chmod go-r'
alias close         'chmod g-w,o-rwx'
alias ma       	    'make all'
alias mc            'make clean'
alias mdc           'make distclean'
alias mde           'make depend'
alias mi            'make install'
alias ms            'make spotless'
alias r        	    'rehash'
alias s             'source \!*'
alias sr            'screen -d -r'
alias u             'uptime'
alias vi            'vim \!*'
alias vio           'co -l \!* && vim \!*'
alias ws       	    'finger | sort -u +1 -2'
alias psg           'ps -ax | grep \!* | grep -v grep'
alias nuke          'set j = `ps x | grep \!* | grep -v grep`; kill -9 $j[1]; echo "kill -9 $j[1]"'
alias compile       'gcc -Wall -o \!* -lm'
alias untar         'tar xfv'
alias unpack        'gunzip \!* | tar xvf \!*'
alias ex            'exit'
alias lo            'logout'
alias klo           'logout'


# ENVIRONMENT SETUP


if ($?editor) then
	setenv		EDITOR		$editor
endif

if ($?pager) then
	setenv		PAGER		$pager
endif

if ($?mailpath) then
	setenv		MAIL		$mailpath[1]
endif

if ($?cvsroot) then
	setenv		CVSROOT		$cvsroot
endif

setenv				BLOCKSIZE	K


# SEARCH PATH SETUP
set	mkpath_basic	= ("/bin /usr/bin"				\
			   "/bin /sbin /usr/bin /usr/sbin")
set	mkpath_local	= ("/usr/local/bin"				\
			   "/usr/local/bin /usr/local/sbin")
set	mkpath_opt	= ("/opt/bin"					\
			   "/opt/bin /opt/sbin")
set	mkpath_pkg	= ("/usr/pkg/bin"				\
			   "/usr/pkg/bin /usr/pkg/sbin")
set	mkpath_x11	= ("/usr/X11R6/bin"				\
			   "")
set	mkpath_suffix	= ("$HOME/bin"					\
			   "$HOME/bin")

set			mkpi	= 1
if ($?weareroot) set	mkpi	= 2

set	tmppath
set			    tmppath = ($tmppath $mkpath_basic[$mkpi])
if ($?havelocal)	set tmppath = ($tmppath $mkpath_local[$mkpi])
if ($?haveopt)		set tmppath = ($tmppath $mkpath_opt[$mkpi])
if ($?havepkg)		set tmppath = ($tmppath $mkpath_pkg[$mkpi])
if ($?havex11)		set tmppath = ($tmppath $mkpath_x11[$mkpi])
set			    tmppath = ($tmppath $mkpath_suffix[$mkpi])

set	path	= ($tmppath)
unset	mkpath_*
unset	tmppath
unset	mkpi



# INTERACTIVE PARAMETERS SETUP
if ($?prompt) then
	set			prompt		= "$user@`hostname -s` # "
	if ($?weareroot) set	prompt		= "$user@`hostname -s` % "

	set			filec
	set			history		= 100
	set			savehist	= 100
	if ($?mailpath) then
		set		mail		= ($mailpath)
	endif

	mesg n
endif



# CLEAN UP (unset all the variables only used within this script)
unset	editor pager mailpath cvsroot
unset	havelocal haveopt havepkg havex11 havechrepo
unset	weareroot mkpath_* mkpi
