# Kermit 95 setup script for SSH to Cunix at Columbia University.
# Frank da Cruz - CUIT - The Kermit Project - http://kermit.columbia.edu
# Thu Feb 18 14:42:36 2010
#
.\%o = 0

define HR {
    echo "______________________________________________________"
    echo
}
define BAILOUT {
    if \f_status(\%o) fclose \%o
    echo "Problem creating \v(desktop)Cunix.ksc..."
    echo "  \v(errstring)"
    echo "  \f_errmsg()"
    hr
    set command color lgray black
    stop 1
}
set term font courier_new 12
set command height 30
cls
hr
set command color lgreen black
echo "Welcome to Kermit 95 - Columbia University Site License."
xecho "Creating Cunix SSH access icon on your desktop..."

kcd desktop
if fail {
    echo "ERROR: Can't CD to to \v(desktop)"
    bailout
}
undef uni
while not def uni {
    ask /gui uni "Please enter your Columbia UNI"
}
undef height
ask /gui height "Enter desired screen height (default 52 lines)"
if not def height .height = 52

fopen /write \%o \v(desktop)Cunix.ksc
if fail bailout
fwrite /line \%o "# Kermit 95 2.1.2 for Windows"
if fail bailout
fwrite /line \%o "# [\v(host)] \v(desktop)cunix.ksc"
fwrite /line \%o "# Created \v(timestamp)"
fwrite /line \%o "#"
fwrite /line \%o "SET LOGIN USER \m(uni)"
fwrite /line \%o "SET SSH COMPRESSION OFF"
fwrite /line \%o "SET TERMINAL TYPE VT220"
fwrite /line \%o "SET TERM CHARACTER-SET CP1252"
fwrite /line \%o "SET GUI WINDOW RESIZE-MODE CHANGE-DIMENSIONS"
fwrite /line \%o "SET GUI WINDOW POSITION 70 50"
fwrite /line \%o "SET TERM FONT COURIER_NEW 12"
fwrite /line \%o "SET TERM COLOR TERM LGRAY BLUE"
fwrite /line \%o "SET TERM HEIGHT \m(height)"
fwrite /line \%o "SSH cunix.cc.columbia.edu"
fclose \%o

echo " [OK]"
echo "\v(desktop)Cunix.ksc created successfully."
echo "You should see a Columbia Crown Cunix icon on your desktop."
echo "You can start a secure SSH shell session to Cunix simply by"
echo "double-clicking the icon."
echo
echo "Cunix.ksc is plain-text file; here is what's in it:"
echo
set command color yellow black
type \v(desktop)Cunix.ksc
if success echo
set command color lgreen black
echo "You can edit this file with Notepad to make any desired changes."
set command color lgray black
hr
getok /gui "OK to quit Cunix setup? "
if success exit
echo "Use the Page Up / Page Down keys to see previous screens..."
echo "Type 'exit' at the prompt to quit."
echo
stop 0
