#   Generic .login file
#
#   We ensure that the the terminal type is set (interactively if
#   necessary) and that the standard environment variables get set.
#
#   Note that there is nothing specific to the ALIAS environment
#   in this file, and that all aliases should appear in the .cshrc file.

onintr resettty
set noglob

if ($?term == 0) then
    set term=unknown
endif

if (-f /unix) set four_d
if (-f /etc/chown) set bsd

if ($term == unknown || $term == network) then
    echo -n "Terminal type? [4d=4D console, v=vt52, w=wyse30, i=iris, other ] "

    set term=$<
    if ($term == "") then
        set term = dumb
    else
        switch ($term)
        case "v":
            set term=vt52
            breaksw
        case "w":
            set term = wy30
            breaksw
        case "4d":
        case "ia":
            set term=iris-ansi
            breaksw
        case "i":
            set term=wsiris
            breaksw
        endsw
    endif
endif

setenv MORE          -c
setenv SHELL         /bin/csh

if ($?four_d) then
    setenv EDITOR    /usr/bin/vi
    setenv PAGER     /usr/bsd/more
    if (`/bin/tty` == /dev/console) then
        xset m 5 2
    endif
else if ($?bsd) then
    setenv EDITOR    /usr/ucb/vi
    setenv PAGER     /usr/ucb/more
else
    setenv EDITOR    /bin/vi
    setenv PAGER     /bin/more
endif

if ($?bsd) then
    stty erase ^H kill ^U intr ^? crt -tabs
else
    stty erase ^H kill ^U intr ^C echoe 
endif

# Set environment variables (-s), suppress ouputting
# terminal initialization strings (-I) and suppress
# kill and erase character messages (-Q) when executing tset.

eval `tset -sIQ`    

unset noglob
exit 0

resettty:
unset noglob
exit 1
