#!/bin/csh -f

setenv OS `uname`
setenv USER `whoami`

if ( -e $DTOOL/bin/neartool ) setenv HAVE_NEARTOOL "yes"
if ( ! $?HAVE_NEARTOOL ) setenv HAVE_NEARTOOL "no"
if ( ! $?HAVE_ATRIA ) setenv HAVE_ATRIA "no"

set host=$HOST
if ( ! $?TERM ) setenv TERM "none"
if ( $TERM == "iris-ansi" || $TERM == "iris-ansi-net" ) then
  alias ctshowprojs 'echo -n "\033P1.y"$USER"@"$host" -- "$CTPROJS"\033\\"; echo -n "\033P3.y"`echo $CTPROJS | cut -f1 -d:`\($host\)"\033\\"'
else if ( $TERM == "xterm" || $TERM == "color-xterm" || $TERM == "cygwin" ) then
  alias ctshowprojs 'echo -n "\033]2;"$USER"@"$host" -- "$CTPROJS"\007"; echo -n "\033]1;"`echo $CTPROJS | cut -f1 -d:`\($host\)"\007"'
else
  alias ctshowprojs 'echo $CTPROJS'
endif

alias ctattach 'source `ctattach.drv \!*`; ctshowprojs'
alias cta 'ctattach'
alias cta-ship 'setenv CTSAVE $CTDEFAULT_FLAV ; setenv CTDEFAULT_FLAV ship ; ctattach \!* ; setenv CTDEFAULT_FLAV $CTSAVE ; unsetenv CTSAVE'
alias cta-release 'setenv CTSAVE $CTDEFAULT_FLAV ; setenv CTDEFAULT_FLAV release ; ctattach \!* ; setenv CTDEFAULT_FLAV $CTSAVE ; unsetenv CTSAVE'
alias cta-install 'setenv CTSAVE $CTDEFAULT_FLAV ; setenv CTDEFAULT_FLAV install ; ctattach \!* ; setenv CTDEFAULT_FLAV $CTSAVE ; unsetenv CTSAVE'
alias ctunattach 'source `ctunattach.drv \!*`; ctshowprojs'
alias ctuna 'ctunattach'

#Modifications to emacs alias by Jason
#To allow for NTEmacs to run like emacs on unix boxes
if (($OS == "CYGWIN_NT-4.0") || ($OS == "CYGWIN_NT-5.0" ) || ($OS == "CYGWIN_NT-5.1" )) then
  alias emacs 'emacs -T "$USER@$HOST  $CTPROJS" -xrm "Emacs*iconName: `echo $CTPROJS | cut -f1 -d:`($HOST)" -bg #002040 -fg #00C0FF -cr yellow -ms yellow -l `cygpath -w ~/.emacs` $CTEMACS_OPTS'
else
  alias emacs 'emacs -T "$USER@$HOST  $CTPROJS" -xrm "Emacs*iconName: `echo $CTPROJS | cut -f1 -d:`($HOST)" $CTEMACS_OPTS'
endif

alias rlogin 'rlogin \!*; ctshowprojs'
alias telnet 'telnet \!*; ctshowprojs'
