home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / RAFL-V10.ZIP / RAFL.CMD next >
OS/2 REXX Batch file  |  1992-10-03  |  3KB  |  120 lines

  1. /*┌──────────────────────────────────────────────────────────────────────────┐
  2.   │                                                                          │
  3.   │    RAFL.CMD -- A REXX Archive File Lister      by Russel Havens          │
  4.   │                                                  on 10-02-92             │
  5.   │                                                                          │
  6.   │              Written in OS/2 REXX using Visual REXX                      │
  7.   │                                                                          │
  8.   │  This requires VREXX.EXE in the PATH, VREXX.DLL & DEVBASE.DLL in the     │
  9.   │  DLL Path (DPATH), and UNZIP.EXE, UNARJ.EXE and LH.EXE in the PATH.      │
  10.   │    These programs are all free for personal use and are available        │
  11.   │  in their separate archives.                                             │
  12.   │    This also uses EPM.EXE, which is included with the OS/2 package.      │
  13.   │                                                                          │
  14.   └──────────────────────────────────────────────────────────────────────────┘*/
  15.  
  16. '@echo off'
  17. call RxFuncAdd 'VInit', 'VREXX', 'VINIT'
  18. initcode = VInit()
  19. if initcode = 'ERROR' then signal CLEANUP
  20.  
  21. signal on failure name CLEANUP
  22. signal on halt name CLEANUP
  23. signal on syntax name CLEANUP
  24.  
  25.  
  26. /* Begin with Visual REXX's VFileBox */
  27. BEGIN:
  28. result = 1
  29. DO WHILE result = 1
  30.     call VDialogPos 20, 50
  31.     button = VFileBox('Pick an archive file...', '*.ZIP', 'file')
  32.     if button = OK then
  33.         filename = file.vstring
  34.     else
  35.         call CLEANUP
  36.     call WHICH
  37.     result = ENDQ()
  38. END
  39. call CLEANUP
  40.  
  41. /*  This subroutine determines which type of archiver to call  */
  42. WHICH:
  43. signature = CHARIN(filename,1,5);
  44. if (substr(signature,1,2) = 'PK') then
  45.     do
  46.         temp = stream(filename,'c','close')
  47.         call VIEWZIP
  48.     end
  49. else
  50.     if (substr(signature,1,2) = '`Ω') then
  51.         do
  52.             temp = stream(filename,'c','close')
  53.             call VIEWARJ
  54.         end
  55.     else
  56.         if (substr(signature,3,3) = '-lh') then
  57.             do
  58.                 temp = stream(filename,'c','close')
  59.                 call VIEWLZH
  60.             end
  61.         else
  62.             call BADARCHIVE
  63. RETURN
  64.  
  65.  
  66.  
  67. /*  View ARJ file  */
  68. VIEWARJ:
  69.     'unarj l' filename '> afl%%tmp.$$$'
  70.     'epm afl%%tmp.$$$'
  71.     'del afl%%tmp.$$$'
  72. RETURN
  73.  
  74. /*  View ZIP file  */
  75. VIEWZIP:
  76.     'unzip -v' filename '> afl%%tmp.$$$'
  77.     'epm afl%%tmp.$$$'
  78.     'del afl%%tmp.$$$'
  79. RETURN
  80.  
  81.  
  82. /*  View LZH file  */
  83. VIEWLZH:
  84.     'lh l' filename '> afl%%tmp.$$$'
  85.     'epm afl%%tmp.$$$'
  86.     'del afl%%tmp.$$$'
  87. RETURN
  88.  
  89.  
  90. /* Report that archive was not ZIP, ARJ or LZH */
  91. BADARCHIVE:
  92.     msg.0 = 1
  93.     msg.1 = 'Only ZIP, ARJ and LZH archives are supported'
  94.  
  95.     call VDialogPos 50, 50
  96.     rb = VMsgBox('Archive File Lister', msg, 1)
  97. RETURN
  98.  
  99. /* Query for End of Program */
  100. ENDQ:
  101.  
  102. msg.0 = 1
  103. msg.1 = '  Do you wish to see another .ZIP file? '
  104.  
  105. call VDialogPos 50, 50
  106. rb = VMsgBox('Archive File Lister', msg, 6)
  107. if rb = 'YES' then do
  108.     RETURN 1
  109. end
  110. else RETURN 0
  111.  
  112.  
  113. /* Deinitialize Visual REXX and EXIT */
  114. CLEANUP:
  115.    call VExit
  116.  
  117. exit
  118.  
  119. /* end of CMD file */
  120.