' This program is copyright 1994 and 1995 by Thomas Hopper, all
' rights reserved.  It may be freely distributed and added to so
' long as the original copyright and author notice remains intact.
'
' Some lines must be altered to work with different setups.  Read
' the comment lines to see which ones.
'
' To use, just put this file in your STorm BASIC directory and
' assign a Alt-Key macro (I use Alt-K) that has RUN "KERMIT.BAS"
' as the macro.  Once the system you are connected to is ready
' send and receive files (in "server" mode, with files transfered
' in binary), just press your Alt-key and follow the directions.
'
' There is little error correction.  If a filename is incorrect,
' you will notified and the file will not be downloaded.
'
' DIM sets the maximum number of files that can be downloaded
' at one time.  Alter to suit your needs.
DIM file$(50)
' Change this CD line to whatever your download directory is.
CD "H:\DOWNLOAD\"
b = ALERT(1,"[2][Do you want to Download |or Upload files?][Download| Upload | Cancel ]")
IF b = 3 THEN
  GOTO Prog_End
ELSE
  PRINT
  PRINT
  PRINT "         Kermit Protocol"
  PRINT "       File Transfer Shell"
  PRINT "      for use with C-Kermit"
  PRINT "    CKSNCP.TTP 5A release 189"
  PRINT " by Thomas Hopper copyright 1994"
  PRINT "       all rights reserved"
  PRINT
  PRINT
  IF b = 1 THEN
    GOSUB Down_l
  ELSE
    IF b = 2 THEN
      GOSUB Up_l
    ENDIF
  ENDIF
ENDIF
Prog_End:
END
'
'
'
Down_l:
a = 0
file$(a) = "NULL"
PRINT "Enter filenames to download.  Enter '0'"
PRINT "at the prompt to begin downloading."
WHILE file$(a) <> "0"
  a = a + 1
  INPUT "Filename to download";file$(a)
WEND
IF (file$(a) = "0" AND a = 1) THEN
  GOTO End_Dl
ENDIF
a = 1
WHILE file$(a) <> "0"
' Alter this line to suit your needs; -b xxxx sets the bps, -i sets
' binary, -e sets packet length.
  kerm$ = "-b 2400 -i -e 1000 -g " + file$(a)
' Alter this to your Kermit executables directory.
  EXEC 0,"H:\KERMIT\CKSNCP.TTP",kerm$
  a = a + 1
WEND
' This causes the system you are connected to to exit Kermit mode.
' Alter as needed (-b = bps)
EXEC 0,"H:\KERMIT\CKSNCP.TTP","-b 2400 -f"
End_Dl:
RETURN
'
'
'
Up_l:
n = 1
contin = -1
WHILE (contin)
' Alter this to your upload directory.
  pathfile$ = FSEL$("H:\UPLOAD\*.*","")
  length = LEN(pathfile$)
  IF (length > 0) THEN
    WHILE ( LEFT$( RIGHT$(pathfile$,n),1) <> "\")
      n = n + 1
    WEND
    n = n - 1
    path$ = LEFT$(pathfile$,length - n)
    file$ = RIGHT$(pathfile$,n)
    CD path$
' Alter this line to work with your connection. (as above)
    file$ = "-i -b 2400 -e 1000 -s " + file$
' Set this line to your Kermit directory.
    EXEC 0,"H:\KERMIT\CKSNCP.TTP",file$
  ELSE
    PRINT "No file selected!"
  ENDIF
  b = ALERT(2,"[2][Do you want to |upload another file? ][ YES | NO ]")
  IF (b = 1) THEN
    contin = -1
  ELSE
    contin = 0
  ENDIF
WEND
' This line finishes the Kermit transfer.  Alter to suit.
EXEC 0,"H:\KERMIT\CKSNCP.TTP","-b 2400 -f"
RETURN

