home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 3 Comm / 03-Comm.zip / TE2HOST.ZIP / ACTN_1.SCR < prev    next >
Text File  |  1990-12-27  |  4KB  |  141 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. global integer UserLevel
  16.  
  17. string  buffer
  18. integer mch
  19. integer retcode
  20.  
  21.  
  22.   ;; ------------------------------------------------------------------------
  23.   ;; Show the user a disk directory via a shell to cmd.exe's "dir" command.
  24.   ;;  The user response here is not monitored but it probably should be
  25.   ;;  limited to the current directory for users with lower priv levels.
  26.  
  27. subroutine DiskDirectory
  28.  
  29.   transmit("^M^JFile Directory")
  30.  
  31.   DfltSpec = "*.*"
  32.   run("getfspec")
  33.   transmit("^[[2J")
  34.   message("^M^JUser is obtaining file directory [%s]", FileSpec)
  35.   buffer = sprintf("/c dir %s", FileSpec)
  36.   retcode = rshell("cmd.exe", buffer, 1)
  37.   if (retcode != 0)
  38.     transmit("^M^JError reading directory")
  39.   endif
  40.   transmit("^M^JPress any key to continue...")
  41.   rgetc(30, 1)
  42.  
  43. endsub
  44.  
  45.  
  46.   ;; ------------------------------------------------------------------------
  47.   ;; Perform a verbose listing os the contents of a ZIP, ARC, LZH, or ZOO
  48.   ;;  archive.  If you don't have all of these archive programs, you'll
  49.   ;;  probably want to comment out part of this routine.  Note that the
  50.   ;;  names of the archivers are stored in variables, if they are named
  51.   ;;  something different on your system, or need to be pathed to, they
  52.   ;;  can easily be changed.
  53.  
  54. subroutine ViewArchive
  55.  
  56.   DfltSpec = ""
  57.   run("getfspec")
  58.   if strlen(FileSpec)
  59.  
  60.     ;; If the FileSpec is shorter than 5 characters it CAN'T have and
  61.     ;; extension, add ".zip"
  62.     if strlen(FileSpec) < 5
  63.       FileSpec = FileSpec + ".ZIP"
  64.     endif
  65.  
  66.     ;; Extract the extension into buffer
  67.     buffer = strright(FileSpec, 4)
  68.     buffer = toupper(buffer)
  69.  
  70.     ;; Now, make sure that it IS an extension, if not, add ".zip"
  71.     if asciival(buffer) != asciival(".")
  72.       FileSpec = FileSpec + ".ZIP"
  73.       buffer = ".ZIP"
  74.     endif
  75.  
  76.     transmit("^M^J")
  77.     message("^M^JUser is viewing archive [%s]", FileSpec)
  78.  
  79.     ;; Execute the proper archiver based on extension
  80.     if strcmp(buffer, ".ZIP") == 0
  81.       buffer = sprintf("-v %s", FileSpec)
  82.       retcode = rshell(PkUnZip, buffer, 1)
  83.     elseif strcmp(buffer, ".ARC") == 0
  84.       buffer = sprintf("v %s", FileSpec)
  85.       retcode = rshell(SeaArc, buffer, 1)
  86.     elseif strcmp(buffer, ".LZH") == 0
  87.       buffer = sprintf("-v %s", FileSpec)
  88.       retcode = rshell(LhArc, buffer, 1)
  89.     elseif strcmp(buffer, ".ZOO") == 0
  90.       buffer = sprintf("v %s", FileSpec)
  91.       retcode = rshell(Zoo, buffer, 1)
  92.     else
  93.       transmit("^M^JSorry, don't know how to view ""%s"".", FileSpec)
  94.       retcode = 0
  95.     endif
  96.  
  97.     if retcode != 0
  98.       transmit("^M^JError executing archive program")
  99.     endif
  100.     transmit("^M^JPress any key to continue...")
  101.     rgetc(30, 1)
  102.   endif
  103.  
  104. endsub
  105.  
  106.  
  107.  
  108. program
  109.   mch = asciival(toupper(CmdStack))
  110.   CmdStack = strtrim(substr(CmdStack, 1, 255))
  111.  
  112.   ;; Check invalid user levels
  113.   if mch == 'C' and UserLevel < 2
  114.     mch = 0
  115.   endif
  116.  
  117.   if mch == 'F'
  118.     gosub DiskDirectory
  119.   elseif mch == 'C'
  120.     run("chdir.scr")
  121.   elseif mch == 'U'
  122.     XFerType = XFerUpLoad
  123.     MenuLevel = MLevelProto
  124.   elseif mch == 'D'
  125.     XFerType = XFerDownLoad
  126.     MenuLevel = MLevelProto
  127.   elseif mch == 'T'
  128.     run("typefile.scr")
  129.   elseif mch == 'V'
  130.     run("viewzip.scr")
  131.   elseif mch == 'G'
  132.     run("goodbye")
  133.   elseif mch == 'M'
  134.     MenuLevel = MLevelMain
  135.   else
  136.     transmit("^G")
  137.     CmdStack = ""
  138.   endif
  139.   end
  140.  
  141.