home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / computervision / kermit.seof < prev    next >
Text File  |  2020-01-01  |  3KB  |  101 lines

  1. ;  6 aug 85 esj restored send @file support
  2. ; 19 jly 85 esj removed send @file support
  3. ; 16 jly 85 esj converted
  4. ;;;;;;;;;;;;;;;        SEOF          ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  5.       E'F A:S(NWLS)
  6.       E'O SEOF.(X)
  7.  
  8. ;     send an EOF packet to the other KERMIT
  9.  
  10. /INCLUDE BYU.PROG.KERMIT.SYM.EQU.KERCOM
  11. /INCLUDE BYU.PROG.KERMIT.SYM.EQU.KERDEF
  12.  
  13.       I'R NUM,LEN,STATUS,LCLSTATE,TNUM
  14.       I'R TPNAME(132),AONE,BONE,TV1,TV2,TV3
  15.       I'R XREAD
  16.       G'L IFD(*),IFDFLG
  17.  
  18.       XREAD=0
  19.  
  20.       W'R (NUMTRY.GT.MAXTRY)
  21.          LCLSTATE=BIGA        ;exceeded max. # of re-try, give up
  22.          E'E CLOSTEXT.(FD)
  23.  
  24.       O'E
  25.          NUMTRY=NUMTRY+1
  26.          AONE=1
  27.          BONE=1
  28.          TNUM=N
  29.          TV1=BIGZ
  30.          TV2=0
  31.          TV3=0
  32.          E'E SPACK.(TV1,TNUM,TV2,TV3)       ;send an EOF packet to other KE
  33.          STATUS=RPACK.(LEN,NUM,RECPKT)       ;what is its reply ??
  34.  
  35.          W'R (STATUS.EQ.BIGN)             ;we got an NAK
  36.  
  37.                LCLSTATE=STATE
  38.                F'N LCLSTATE
  39.  
  40.          O'R (STATUS.EQ.BIGY)             ;we got a ACK
  41.             W'R (N.NE.NUM)
  42.                LCLSTATE=STATE             ;but it was for the last packet
  43.  
  44.             O'E
  45.                N=(N+1).MOD.64
  46.                NUMTRY=0
  47.                E'E CLOSTEXT.(FD)          ;close the sending disk file ch
  48.  
  49. ;              are we sending multiple files?
  50.                W'R IFDFLG .E. YES
  51.                   R'T
  52. ;                    yes, get the next file
  53.                      E'E NEXTFILE.(IFD, TPNAME)
  54.                      W'R TPNAME .E. 0
  55. ;                       if at eof, close up shop
  56.                         LCLSTATE = BIGB
  57.                         B'K
  58.  
  59.                      O'E
  60. ;                       go for next file
  61.                         LCLSTATE = BIGF
  62.                         STATUS = OPENTEXT.(TPNAME,$RD$, $CV$, FD)
  63.  
  64.                         W'R (STATUS.NE.0)  ;file exist ??
  65. ;                          no, say so and try again
  66.                            E'E TYPOUT.(TPNAME-1,TPNAME(1))
  67.                            E:E TYPEMSG.($ <--- Source file does not exist!$)
  68.                            E'E CLOSTEXT.(FD)
  69.                            LCLSTATE = BIGB
  70.  
  71.                         O'E
  72. ;                          yes, all ok, convert the filename to
  73. ;                          kermit packet format, being careful to not
  74. ;                          include the ! terminator
  75.                            E'E CHTOIN.(TPNAME(1), FILNAME, TPNAME-1)
  76.                            B'K
  77.  
  78.                         E'L
  79.                      E'L
  80.                   F'R
  81.                O'E
  82. ;                 no more files, close up shop
  83.                   LCLSTATE = BIGB
  84.  
  85.                E'L
  86.  
  87.             E'L
  88.  
  89.          O'R (STATUS.EQ.BAD)              ;there was a checksum error
  90.             LCLSTATE=STATE                ;try it again
  91.  
  92.          O'E
  93.             LCLSTATE=BIGA                 ;we got an unexpected packet
  94.             E'E CLOSTEXT.(FD)
  95.                                           ;or error packet, abort
  96.                                           ;transfer mode
  97.          E'L
  98.       E'L
  99.       F'N LCLSTATE
  100.       E'N
  101.