From: et@madmax.aa.nps.navy.mil ()
Newsgroups: comp.os.linux.announce
Subject: Kermit and csh macros for Term
Date: 9 Dec 1993 23:25:07 +0200
Approved: linux-announce@tc.cornell.edu (Lars Wirzenius)
Message-ID: <2e853j$gnn@klaava.Helsinki.FI>

I have put together some kermit and csh  macros.  With
them I just click a button from my fvwm menu and  get
my first trsh prompt.

The macros autodial the number, login to my account,
run the term on both ends, then run the trsh with a
user defined .trshrc on the remote site which runs
txconn for the first trsh  and sets the DISPLAY and
some other stuff.  I get extra trsh windows from my
fvwm menu which also run .trshrc. Upon exiting from
the first trsh, it also makes a clean
auto-disconnect.  It sends 00000 to kill term and then
logs out from the remote site..

I really had all kind of difficulties with setting up
Term and frankly I did not get much help.  I wish
there were some help from the people who had the
experience.  I also think these kind of macros make
life much easier, and should be included in the 
distribution package.

I have modified the following files a little bit.
They are not exactly the same ones I currently use. So
if I messed up something or you run into  problems
with running them, drop me a line..

tuncer


THe following is my .kermrc, you need to make
necessary changes like the phone number, modem init
commands, the way you connect to the remote site  and
your PASSWD..

-----------------------------------------------------------------------------
#
# a .kermrc by  Tuncer, et@madmax.aa.nps.navy.mil
#
set modem-dialer unknown
set line /dev/cua2
set baud 38400
set parity none
set terminal bytesize 8
set flow none
set prompt Linux-kermit >
set escape 29
set block 1
define NPS-TERM  def \%n 6667777 , -
            output at \13, input 5 ok, -
            output at \\N \13, input 5 ok, take .autodial, -  
            input 60 login:, output et\13, -
            input 5 password:, output PASSWD\13, -
            input 8 et %, output set term=xterm \13
            input 3 et %, output term -n on -w1 -s19200 -l .tlog \13, -
            pause 3, !term -n on -s19200 -w1 < \v(line) > \v(line) &, -
            pause 3, !trsh, - 
            pause 3, output 00000\13, input 5 et %, output logout\13, -
            exit

# instead of hardcoding your PASSWD, replace that line with
# the following line for a prompt
#           input 5 password:, askq %p { Password: }, output \%p\13, -
-----------------------------------------------------------------------------


THe following is the .autodial file called from .kermrc

-----------------------------------------------------------------------------
#
#   an autodial macro for kermit by Tuncer, et@madmax.aa.nps.navy.mil
#
:top
    if not defined \%n ask \%n what is the phone number?
    if defined \%1 define \%n \%1
    set count 5 
:_try_again 
    output atdt \%n \13
    input 10 BUSY
    if not failure goto _lbusy
    input 10 NO CARRIER 
    if not failure goto _nocnect
    goto _cnect
:_lbusy
    pause 10
    if count goto _try_again
    echo Maximum number of attempts exceeded\13
    goto _query
:_nocnect
    if count goto _try_again
    echo Maximum number of attempts exceeded\13
:_query
    ask \%y Keep trying (y/n)?
    if not defined \%y goto _query
    if equal \%y y goto top
    if not equal \%y n goto _query 
    hangup
    pause 2
    quit
    stop
:_cnect
-----------------------------------------------------------------------------

put the following line in your .cshrc file to run
.trshrc with your trsh's (this works pretty good but I
am not sure if it is good idea. Since I use  
"# /bin/csh -f " with all my csh scripts, it does not
cause any problems and does not slow me down.. )

-----------------------------------------------------------------------------
set trshrc=`ps -u et | grep  -c "term"` ; if ($trshrc != 0) source ~/.trshrc
-----------------------------------------------------------------------------


The following is my .trshrc file, which runs txconn
only once and sets some variables and all..

-----------------------------------------------------------------------------
set ntx=`ps -e | grep  -c "txconn"` ; if ($ntx == 0) txconn
#echo ""; echo -n "  Run txconn? : "; set junk = $< ;if ($junk == "y") txconn
setenv DISPLAY cfd2.aa.nps.navy.mil:9
setenv SHELL /bin/tcsh
setenv LESS -ci
source .alias 
-----------------------------------------------------------------------------


The following are  two entries to my .fvwmrc menu 

-----------------------------------------------------------------------------
Exec  "NPS-term"   exec rxvt -T Term -n Term -e /usr/bin/kermit -C "nps-term" &
Exec    "Trsh"     exec rxvt -T Trsh -n Trsh -e /usr/local/bin/trsh &
-----------------------------------------------------------------------------
--
Mail submissions for comp.os.linux.announce to: linux-announce@tc.cornell.edu
PLEASE remember Keywords: and a short description of the software.
