# set the echo variables
# place this in your .cshrc or equivalent file.

if ( ! $?HOSTNAME ) then
	setenv  HOSTNAME `hostname`
endif

# have I executed this script before on this system?
if ( $?E ) then
	#echo "already set the echo variables">/dev/tty
else if ( -f ~/.echo.${HOSTNAME} ) then
	source ~/.echo.${HOSTNAME}
else if ( `echo -n |wc -l`  == 0 ) then
	#echo "built in echo is bsd" >/dev/tty
	echo 'set ech = "echo -n"' >~/.echo.${HOSTNAME}
	echo "set E = `echo a | tr a '\033'`" >> ~/.echo.${HOSTNAME}
	echo "set B = `echo a | tr a '\007'`" >> ~/.echo.${HOSTNAME}
	echo 'set N = ""' >> ~/.echo.${HOSTNAME}
	source ~/.echo.${HOSTNAME}
else 
	#echo "built in echo is sysV" >/dev/tty
	echo 'set ech = "echo"' >~/.echo.${HOSTNAME}
	echo 'set E = "\033"' >> ~/.echo.${HOSTNAME}
	echo 'set B = "\007"' >> ~/.echo.${HOSTNAME}
	echo 'set N = "\c"' >> ~/.echo.${HOSTNAME}
	source ~/.echo.${HOSTNAME}
endif	

if ( $term =~ sun* ) then
# Sun Aliases
 alias Open '${ech}  "${E}[1t${N}"'
 alias Close '${ech}  "${E}[2t${N}"'
 alias Move  '${ech}  "${E}[3;\!:1;\!:2t${N}"'
 alias Resize '${ech}  "${E}[4;\!:1;\!:2t${N}"'
 alias Front '${ech}  "${E}[5t${N}"'
 alias Back '${ech}  "${E}[6t${N}"'
 alias Refresh '${ech}  "${E}[7t${N}"'
 alias RowCol '${ech}  "${E}[8;\!:1;\!:2t${N}"'
 alias Header '${ech}  "${E}]l\!*${E}\${N}"'
 alias IHeader '${ech}  "${E}]L\!*${E}\${N}"'
 alias PageOn '${ech} "${E}[>1h${N}"'
 alias PageOff '${ech} "${E}[>1l${N}"'
 alias ScrollOn '${ech} "${E}[>4h${N}"'
 alias ScrollOff '${ech} "${E}[>4l${N}"'
 alias IsOpen 'GetSunParms icon'
 alias GetPos 'GetSunParms pos'
 alias GetWidthHeight 'GetSunParms wh'
 alias GetRowCol 'GetSunParms rc'
 alias GetIHeader 'GetSunParms ilabel'
 alias GetHeader 'GetSunParms label'
 alias GetPage 'GetSunParms page'
 alias 24x80 "RowCol 24 80"
 alias 34x80 "RowCol 34 80"
 alias Pos1 "Move 320 0;Resize 508 659"
 alias UL "Move 0 0; Resize 420 565"
 alias UR "Move 0 576; Resize 420 565"
 alias LL "Move 450 0; Resize 420 565"
 alias LR "Move 450 576 ; Resize 420 565"
 if ( $?WINDOW_PARENT ) then
	# these don't work in XView, only SunView
	alias IMove '${ech}  "${E}[3t${N}"'
	alias Stretch '${ech}  "${E}[4t${N}"'
	alias Icon '${ech}  "${E}]\!\1:1${E}\${N}"'
 endif
else if ( $term =~ xterm ) then
 alias Header '${ech}  "${E}]2;\!:1${B}${N}"'
 alias IHeader '${ech}  "${E}]1;\!:1${B}${N}"'

endif

