home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 3 Comm / 03-Comm.zip / TE2HOST.ZIP / ACTN_98.SCR < prev    next >
Text File  |  1990-12-27  |  4KB  |  168 lines

  1. global integer MLevelMain
  2. global integer MLevelFile
  3. global integer MLevelMail
  4. global integer MLevelProto
  5. global integer MLevelSysop
  6.  
  7. global integer XFerUpLoad
  8. global integer XFerDownLoad
  9.  
  10. global string  CmdStack
  11. global string  FileSpec
  12. global string  DfltSpec
  13. global integer MenuLevel
  14. global integer XFerType
  15.  
  16. integer mch
  17. integer retcode
  18. string  xferstrg
  19.  
  20. subroutine GetFileSpec
  21.  
  22.   if strlen(CmdStack) == 0
  23.     transmit("^M^J%s a File", xferstrg)
  24.     DfltSpec = ""
  25.     run("getfspec.scr")
  26.   else
  27.     FileSpec = CmdStack
  28.     CmdStack = ""
  29.   endif
  30.  
  31. endsub
  32.  
  33.  
  34.   ;; ------------------------------------------------------------------------
  35.   ;; Receive a file from the user.  If you want to keep a record of what
  36.   ;;  files were uploaded and perhaps prompt the user for a verbose
  37.   ;;  description, this will be easy with XModem and XModem-1K however
  38.   ;;  you'll have to get trickier with the batch protocols.
  39.  
  40. subroutine DoUpload
  41.  
  42.   if connected
  43.     xferstrg = "Upload"
  44.     if mch == 'X'
  45.       gosub GetFileSpec
  46.       if strlen(FileSpec)
  47.         transmit("^M^JBegin your upload procedures^M^J")
  48.         retcode = download(XMODEM, FileSpec)
  49.       else
  50.         retcode = 999
  51.       endif
  52.  
  53.     elseif mch == '1'
  54.       gosub GetFileSpec
  55.       if strlen(FileSpec)
  56.         transmit("^M^JBegin your upload procedures^M^J")
  57.         retcode = download(XMODEM1K, FileSpec)
  58.       else
  59.         retcode = 999
  60.       endif
  61.  
  62.     elseif mch == 'Y'
  63.       transmit("^M^JBegin your upload procedures^M^J")
  64.       retcode = download(YMODEM, NULL)
  65.  
  66.     elseif mch == 'G'
  67.       transmit("^M^JBegin your upload procedures^M^J")
  68.       retcode = download(YMODEMG, NULL)
  69.  
  70.     elseif mch == 'Z'
  71.       transmit("^M^JBegin your upload procedures^M^J")
  72.       retcode = download(ZMODEM, NULL)
  73.  
  74.     endif
  75.  
  76.   endif
  77.  
  78.   if connected and retcode != 999
  79.     sleep(1000)
  80.     if retcode
  81.       transmit("^G^G")
  82.       transmit("^M^JTransfer successful!^m^J")
  83.     else
  84.       transmit("^X^X^X^H^H^H^G^G")
  85.       transmit("^M^JTransfer failed^M^J")
  86.     endif
  87.     sleep(1000)
  88.   endif
  89.  
  90. endsub
  91.  
  92.  
  93.   ;; ------------------------------------------------------------------------
  94.   ;; Send a file to the user.  Once again, the FileSpec is not checked
  95.   ;;  before hand to verify that a lower priv user isn't using a path
  96.   ;;  to access files outside the current directory.
  97.  
  98. subroutine DoDownload
  99.  
  100.   if connected
  101.  
  102.     xferstrg = "Download"
  103.     gosub GetFileSpec
  104.     if strlen(FileSpec)
  105.       transmit("^M^JBegin your download procedures^M^J")
  106.       if !WatchUser
  107.         message("^M^JUser is downloading [%s]", FileSpec)
  108.       endif
  109.       if mch == 'X'
  110.         retcode = upload(XMODEM, FileSpec)
  111.  
  112.       elseif mch == '1'
  113.         retcode = upload(XMODEM1K, FileSpec)
  114.  
  115.       elseif mch == 'Y'
  116.         retcode = upload(YMODEM, FileSpec)
  117.  
  118.       elseif mch == 'G'
  119.         retcode = upload(YMODEMG, FileSpec)
  120.  
  121.       elseif mch == 'Z'
  122.         retcode = upload(ZMODEM, FileSpec)
  123.  
  124.       endif
  125.  
  126.     else
  127.       retcode = 999
  128.  
  129.     endif
  130.  
  131.   endif
  132.  
  133.   if connected and retcode != 999
  134.     sleep(1000)
  135.     if retcode
  136.       transmit("^G^G")
  137.       transmit("^M^JTransfer successful!^m^J")
  138.     else
  139.       transmit("^X^X^X^H^H^H^G^G")
  140.       transmit("^M^JTransfer failed^M^J")
  141.     endif
  142.     sleep(1000)
  143.   endif
  144.  
  145. endsub
  146.  
  147.  
  148.  
  149. program
  150.   mch = asciival(toupper(CmdStack))
  151.   CmdStack = strtrim(substr(CmdStack, 1, 255))
  152.  
  153.   if mch == 'X' or mch == '1' or mch == 'Y' or mch == 'G' or mch == 'Z'
  154.     if XFerType == XFerUpLoad
  155.       gosub DoUpload
  156.     else
  157.       gosub DoDownload
  158.     endif
  159.     MenuLevel = MLevelFile
  160.   elseif mch == 'Q'
  161.     MenuLevel = MLevelFile
  162.   else
  163.     transmit("^G")
  164.     CmdStack = ""
  165.   endif
  166.   end
  167.  
  168.