home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / varc10b3.zip / VArc.cmd next >
OS/2 REXX Batch file  |  1993-01-07  |  26KB  |  685 lines

  1. /*****************************************************************************/
  2. /* PM Archive Interface for OS/2 v2.x                                        */
  3. /* (c) Paul Gallagher 1992                                                   */
  4. /* This REXX/VREXX script is copywrite, but freely distributable.            */
  5. /* See VArc.txt for notes on usage, implementation and enhancement.          */
  6. /* Comments are welcome - mail to paulg@a1.resmel.bhp.com.au                 */
  7. /* {snail mail: PO Box 731 Mt Waverley 3149 Australia}                       */
  8. /*****************************************************************************/
  9. '@echo off'
  10. versionStr='v1.0b3'
  11. /*---------------------------------------------------------------------------*/
  12. /* Load REXXUTIL and VREXX                                                   */
  13. /*---------------------------------------------------------------------------*/
  14. If RxFuncQuery('SysLoadFuncs') \= 0 Then
  15.   If RxFuncAdd('SysLoadFuncs','RexxUtil','SysLoadFuncs') <>0 Then Do
  16.     Say 'Unable to init REXX Utility function loader.'
  17.     Exit
  18.   End
  19. Call SysLoadFuncs
  20. /* register VREXX procedures as necessary */
  21. Call RxFuncAdd 'VInit', 'VREXX', 'VINIT'
  22. If VInit()='ERROR' Then Do
  23.   Say 'This script requires VREXX running under OS/2 v2.0'
  24.   Say 'If VREXX is installed on this machine, then it is likely that a prior'
  25.   Say 'VREXX process has terminated uncleanly. Restart your workstation to fix'
  26.   Say 'this problem.'
  27.   Exit
  28. End
  29.  
  30. /*---------------------------------------------------------------------------*/
  31. /* init some variables                                                       */
  32. /*---------------------------------------------------------------------------*/
  33. dir.home=Directory()
  34. dir.work=dir.home
  35. options.0=2
  36. options.1='Include subdirectories'
  37. options.1.state='YES'
  38. options.2='Always display archive utility output             '
  39. options.2.state='NO'
  40.  
  41. arcfile=''
  42. msgwin='CLOSED'
  43. mainwin='CLOSED'
  44.  
  45. /*---------------------------------------------------------------------------*/
  46. /* Set error traps                                                           */
  47. /*---------------------------------------------------------------------------*/
  48. signal on failure name ExitProc
  49. signal on halt name ExitProc
  50. signal on syntax name ExitProc
  51.  
  52. /*---------------------------------------------------------------------------*/
  53. /* Set initial dialog position                                               */
  54. /*---------------------------------------------------------------------------*/
  55. call VDialogPos 60, 50
  56.  
  57. /*---------------------------------------------------------------------------*/
  58. /* Do initial parse of command line and call help message if required        */
  59. /*---------------------------------------------------------------------------*/
  60. /* get the command line arguments */
  61. Parse Arg params
  62. /* call help routine if required */
  63. If Pos(Translate(params),"/?/HELP") > 0 Then Do
  64.   Call HelpInfo
  65.   Signal ExitProc
  66. End
  67.  
  68. /*---------------------------------------------------------------------------*/
  69. /* Setup archive utility parameters and the main window                      */
  70. /*---------------------------------------------------------------------------*/
  71. Call SetArcParams
  72. Call SetupMainWin
  73.  
  74. /*---------------------------------------------------------------------------*/
  75. /* get a temp file name to use for communication with archive utilities      */
  76. /*---------------------------------------------------------------------------*/
  77. tempfile=SysTempFileName(dir.home'\VARC???.TMP','?')
  78. If tempfile='' Then Call ErrorExit 'Failed file operation'
  79.  
  80. /*---------------------------------------------------------------------------*/
  81. /* get an initial archive file                                               */
  82. /*---------------------------------------------------------------------------*/
  83. logged='NO'
  84. Do While logged='NO'
  85.   arcfile=SelectArchive(params)
  86.   If arcfile='' Then Signal ExitProc
  87.   logged=LogArchive()
  88.   If logged='NO' Then params=arcmask
  89. End
  90.  
  91. /*---------------------------------------------------------------------------*/
  92. /* main program loop - process the menu commands                             */
  93. /*---------------------------------------------------------------------------*/
  94. Do Forever
  95.   action=GetAction()
  96.   Select
  97.     When action='Add/update a file' Then
  98.       If AddFile()=0 Then Call LogArchive
  99.     When action='Add/update some files' Then
  100.       If MAddFile()=0 Then Call LogArchive
  101.     When action='Extract all files' Then 
  102.       Call ExAllFile
  103.     When action='Extract some files' Then 
  104.       Call MExFile
  105.     When action='Delete a file' Then 
  106.       If DelFile()=0 Then Call LogArchive
  107.     When action='Show output of last operation' Then
  108.       'e' tempfile
  109.     When action='Set options' Then Do
  110.       Call SetOptions
  111.       Call UpdateDisplay
  112.     End
  113.     When action='Set working directory' Then Call XWorkDir
  114.     When action='Another archive' Then Do
  115.       logged='NO'
  116.       Do While logged='NO'
  117.         arctemp=SelectArchive(arcmask)
  118.         If arctemp\='' Then Do
  119.           arcfile=arctemp
  120.           logged=LogArchive()
  121.         End
  122.         Else logged='-'
  123.       End
  124.     End
  125.     When action='QUIT' Then 
  126.       Signal ExitProc
  127.     Otherwise
  128.       If arcnew='YES' Then Call InfoMsg('New archive - nothing to display.')
  129.       Else
  130.         Call VTableBox  arcfile 'Archive Contents', arcdata, 1, 70, 10, 1
  131.   End
  132. End
  133.  
  134. /*---------------------------------------------------------------------------*/
  135. /* Error exit procedure                                                      */
  136. /*---------------------------------------------------------------------------*/
  137. ErrorExit:
  138.   Call LineOut tempfile
  139.   msg.0 = 1
  140.   msg.1 = ARG(1)
  141.   call VMsgBox 'Error', msg, 1
  142.   Drop msg.
  143.  
  144. /*---------------------------------------------------------------------------*/
  145. /* "normal" exit procedure                                                   */
  146. /*---------------------------------------------------------------------------*/
  147. ExitProc:
  148.   If mainwin\='CLOSED' Then Call VCloseWindow mainwin
  149.   If msgwin\='CLOSED' Then Call VCloseWindow msgwin
  150.  
  151.   Call Directory dir.home
  152.  
  153.   If SysFileTree(tempfile, 'file', 'F') > 0 Then Call ErrorExit 'Not enough memory'
  154.   Else If file.0>0 Then Do
  155.     /* just to make sure the temp file is closed */
  156.     Call LineIn tempfile
  157.     Call LineOut tempfile
  158.     /* delete it */
  159.     Call SysFileDelete tempfile 
  160.   End
  161.   Drop tempfile file.
  162.  
  163.   /* cleanup VREXX lib */
  164.   Call VExit
  165.  
  166.   /* drop variables */
  167.   Drop params
  168.   Drop dir. options.
  169.   Drop msgwin mainwin
  170.   Drop arcfile arcdata. arcnew
  171.   Drop arcproto. arcselect arcmask
  172.   Drop logged
  173.   Drop versionStr
  174. Exit
  175. /*****************************************************************************/
  176.  
  177. /*****************************************************************************/
  178. /* Routine to get user action                                                */
  179. /*****************************************************************************/
  180. GetAction: Procedure Expose arcfile
  181.   list.0 = 10
  182.   list.1 = 'Show contents                   '
  183.   list.2 = 'Add/update a file'
  184.   list.3 = 'Add/update some files'
  185.   list.4 = 'Extract all files'
  186.   list.5 = 'Extract some files'
  187.   list.6 = 'Delete a file'
  188.   list.7 = 'Show output of last operation'
  189.   list.8 = 'Set working directory'
  190.   list.9 = 'Set options'
  191.   list.10= 'Another archive'
  192.   If VRadioBox('Select action for' FileSpec("N",arcfile), list, 3)<>'CANCEL' Then ret = list.vstring
  193.   Else ret='QUIT'
  194.   Drop list.
  195. Return ret
  196.  
  197. /*****************************************************************************/
  198. /* Routine to get user to select an archive                                  */
  199. /*****************************************************************************/
  200. SelectArchive: 
  201.   arcnew='NO'
  202.   arctemp=ARG(1)
  203.   file.0=2
  204.  
  205.   /* if something passed as parameter, lets see what we can do with it */
  206.   IF Length(arctemp)>0 Then Do
  207.     /* if no ext, add default */
  208.     If Pos('.',arctemp)=0 Then arctemp=arctemp''arcproto.arcselect.ext
  209.     /* if no match, and mask a valid filename then see if create new */
  210.     If SysFileTree(arctemp, 'file', 'FO') > 0 Then Call ErrorExit 'Not enough memory'
  211.     If (file.0=0) & (ValidFile(arctemp)='YES') Then Do
  212.       If MsgDlg('Help me...','Create a new archive ('arctemp')?', 6)\='YES' Then Do
  213.         file.0=2
  214.         arctemp=arcmask
  215.       End
  216.       Else arcnew='YES'
  217.     End
  218.     Else 
  219.       If ValidFile(arctemp)='YES' Then file.0=1
  220.       Else file.0=2
  221.   End
  222.   Else arctemp=arcmask
  223.  
  224.   Do While file.0>1
  225.     If VFileBox('Select an archive file...', arctemp, 'name')='OK' Then Do
  226.       arctemp=name.vstring
  227.       If SysFileTree(arctemp, 'file', 'FO') > 0 Then Call ErrorExit 'Not enough memory'
  228.       If (file.0=0) & (ValidFile(arctemp)='YES') Then
  229.         If MsgDlg('Help me...','Create a new archive ('arctemp')?', 6)\='YES' Then Do
  230.           file.0=2
  231.           arctemp=arcmask
  232.         End
  233.         Else arcnew='YES' 
  234.     End
  235.     Else Do
  236.       file.0=0
  237.       arctemp=''
  238.     End
  239.   End
  240.  
  241.   If arctemp\='' Then Do
  242.     /* if existing file, get proper path spec */
  243.     If file.0=1 Then Parse Upper Var file.1 arctemp
  244.     Else arctemp=Translate(arctemp)  
  245.  
  246.     /* see if we can handle the specified file */
  247.     i=0
  248.     cont='Y'
  249.     Do While cont='Y'
  250.       i=i+1
  251.       If i>arcproto.number Then cont='F'
  252.       Else
  253.         If Pos(arcproto.i.ext,arctemp)>0 Then Do
  254.           If (SysSearchPath('PATH',arcproto.i.arcexe)\='') & (SysSearchPath('PATH',arcproto.i.unarcexe)\='') Then Do
  255.             arcselect=i
  256.             cont='S'
  257.           End
  258.         End
  259.     End
  260.     If cont='F' Then Do
  261.       Call FindError FileSpec("N",arctemp)
  262.       arctemp=''
  263.     End
  264.   End
  265.   Drop cont
  266. Return arctemp
  267.  
  268. /*****************************************************************************/
  269. /* Routine to change working directory                                       */
  270. /*****************************************************************************/
  271. XWorkDir:
  272.   prompt.0=1
  273.   prompt.1='Enter new working directory  '
  274.   prompt.vstring=dir.work
  275.   If VInputBox('Set working directory...',prompt,40,3)='OK' Then Do
  276.     dir.work=prompt.vstring
  277.     Call Directory dir.work
  278.     Call UpdateDisplay
  279.   End
  280.   Drop prompt. file.
  281. Return
  282.  
  283. /*****************************************************************************/
  284. /* Routine to log archive contents                                           */
  285. /*****************************************************************************/
  286. LogArchive: 
  287.   Call UpdateDisplay
  288.   If SysFileTree(arcfile, 'file', 'FO') > 0 Then Call ErrorExit 'Not enough memory'
  289.   If (file.0\=1) Then Do
  290.     arcnew='YES'
  291.     Return arcnew
  292.   End
  293.   Else arcnew='NO'
  294.  
  295.   Call ExecMsgWin 'Loading archive details...'
  296.   status='-'
  297.   /* just to make sure the temp file is closed */
  298.   Call LineIn tempfile
  299.   Call LineOut tempfile
  300.  
  301.   /* construct 'list' command from archive prototype */
  302.   listcmd=arcproto.arcselect.list '>' tempfile
  303.   /* get rid of '~filemask~' */
  304.   listcmd=DelWord(listcmd,WordPos('~filemask~',listcmd),1)
  305.   /* replace '~archive~' with archive file name */
  306.   i=Pos('~archive~',listcmd)
  307.   listcmd=DelStr(listcmd,i,Length('~archive~'))
  308.   listcmd=Insert(arcfile,listcmd,i-1)
  309.  
  310.   /* do list command */
  311.   listcmd
  312.  
  313.   /* lets process the list */ 
  314.   arcdata.cols = 3
  315.   arcdata.label.1 = 'Size'
  316.   arcdata.label.2 = 'Date'
  317.   arcdata.label.3 = 'Name'
  318.   arcdata.width.1 = 10
  319.   arcdata.width.2 = 15
  320.   arcdata.width.3 = 150
  321.  
  322.   /* find first line with "----" in it */
  323.   Do While status='-'
  324.     dummy=LineIn(tempfile)
  325.     If Pos(arcproto.arcselect.startdelim,Dummy)>0 Then status='YES'
  326.     If Lines(tempfile)=0 Then Do
  327.       Call ErrorMsg 'Incompatible version of' arcproto.arcselect.unarcexe 'or corrupt archive.'
  328.       status='NO'
  329.     End
  330.   End
  331.  
  332.   If status='YES' Then Do
  333.     i=0
  334.     status='-'
  335.     Do While status='-'
  336.       dummy=LineIn(tempfile)
  337.       Select
  338.       When Lines(tempfile)=0 Then Do
  339.         status='NO'
  340.         Call ErrorMsg 'Incompatible version of' arcproto.arcselect.unarcexe
  341.       End
  342.       When Pos(arcproto.arcselect.enddelim,Dummy)>0 Then status='YES'
  343.       Otherwise
  344.           Interpret 'Parse Var dummy 'arcproto.arcselect.parse
  345.           i=i+1
  346.           arcdata.i.1=fsize
  347.           arcdata.i.2=fyy'/'fmm'/'fdd
  348.           arcdata.i.3=fname
  349.       End
  350.     End
  351.     arcdata.rows=i
  352.   End
  353.  
  354.   Call LineOut tempfile
  355.   Call ExecMsgWin
  356.   Drop fsize fdd fmm fyy fname d.
  357.   Drop i dummy
  358.   Drop listcmd
  359. Return status
  360.  
  361. /*****************************************************************************/
  362. /* Routine to add a single file to archive                                   */
  363. /*****************************************************************************/
  364. AddFile:
  365.   If VFileBox('Select a file to add to this archive...', '*.*', 'prompt')\='OK' Then Return 1
  366.   Call DoArcCmd prompt.vstring, arcproto.arcselect.arcnosub, 'Adding' FileSpec('N',prompt.vstring) 'to archive...'
  367.   Drop prompt.  
  368. Return 0
  369.  
  370. /*****************************************************************************/
  371. /* Routine to add a multiple files to archive                                */
  372. /*****************************************************************************/
  373. MAddFile: 
  374.   prompt.0=1
  375.   prompt.1='Enter file mask  '
  376.   prompt.vstring='*'
  377.   If VInputBox('Add files to archive...',prompt,40,3)\='OK' Then Return 1
  378.   /* construct 'archive' command from archive prototype 
  379.   - assume options.1 is 'Include subdirectories' */
  380.   If options.1.state='YES' Then
  381.     Call DoArcCmd prompt.vstring, arcproto.arcselect.arc, 'Adding' FileSpec('N',prompt.vstring) 'to archive...'
  382.   Else
  383.     Call DoArcCmd prompt.vstring, arcproto.arcselect.arcnosub, 'Adding' FileSpec('N',prompt.vstring) 'to archive...'
  384.   Drop prompt.
  385. Return 0
  386.  
  387. /*****************************************************************************/
  388. /* Routine to extract a single file from archive                             */
  389. /*****************************************************************************/
  390. ExAllFile:
  391.   /* construct 'archive' command from archive prototype 
  392.   - assume options.1 is 'Include subdirectories' */
  393.   If options.1.state='YES' Then
  394.     Call DoArcCmd '', arcproto.arcselect.unarc, 'Extracting all files from archive...' 
  395.   Else
  396.     Call DoArcCmd '', arcproto.arcselect.unarcnosub, 'Extracting all files from archive...'
  397. Return
  398.  
  399. /*****************************************************************************/
  400. /* Routine to extract multiple files from archive                            */
  401. /*****************************************************************************/
  402. MExFile: 
  403.   prompt.0=1
  404.   prompt.1='Enter file mask  '
  405.   prompt.vstring='*'
  406.   If VInputBox('Extract files from archive...',prompt,40,3)\='OK' Then Return
  407.   /* construct 'archive' command from archive prototype 
  408.   - assume options.1 is 'Include subdirectories' */
  409.   If options.1.state='YES' Then
  410.     Call DoArcCmd prompt.vstring, arcproto.arcselect.unarc, 'Extracting' FileSpec('N',prompt.vstring) 'from archive...' 
  411.   Else
  412.     Call DoArcCmd prompt.vstring, arcproto.arcselect.unarcnosub, 'Extracting' FileSpec('N',prompt.vstring) 'from archive...'
  413.   Drop prompt.
  414. Return
  415.  
  416. /*****************************************************************************/
  417. /* Routine to delete a selected file from archive                            */
  418. /*****************************************************************************/
  419. DelFile: 
  420.   If VTableBox('Select file to delete from' arcfile, arcdata, 1, 70, 10, 1)='CANCEL' Then Return 1
  421.   i=arcdata.vstring
  422.   Call DoArcCmd arcdata.i.3, arcproto.arcselect.del, 'Deleting' FileSpec('N',arcdata.i.3) 'from archive...' 
  423.   Drop i prompt.
  424. Return 0
  425.  
  426. /*****************************************************************************/
  427. /* Generic archive command                                                   */
  428. /* ARG(1) = filemask                                                         */
  429. /* ARG(2) = command line prototype                                           */
  430. /* ARG(3) = message to display while working                                 */
  431. /*****************************************************************************/
  432. DoArcCmd:
  433.   Call ExecMsgWin ARG(3)
  434.   status='-'
  435.   /* just to make sure the temp file is closed */
  436.   Call LineIn tempfile
  437.   Call LineOut tempfile
  438.  
  439.   /* construct 'extract' command */
  440.   cmd=ARG(2) '>' tempfile
  441.   /* replace '~filemask~' with speced file */
  442.   i=Pos('~filemask~',cmd)
  443.   cmd=DelStr(cmd,i,Length('~filemask~'))
  444.   cmd=Insert(ARG(1),cmd,i-1)
  445.   /* replace '~archive~' with archive file name */
  446.   i=Pos('~archive~',cmd)
  447.   cmd=DelStr(cmd,i,Length('~archive~'))
  448.   cmd=Insert(arcfile,cmd,i-1)
  449.  
  450.   /* do list command */
  451.   cmd
  452.   Call ExecMsgWin
  453.  
  454.   /* potential to show archive output in tempfile (not implemented) */
  455.   Call LineIn tempfile
  456.   Call LineOut tempfile
  457.   If options.2.state='YES' Then 'e' tempfile 
  458.  
  459.   Drop cmd
  460. Return
  461.  
  462. /*****************************************************************************/
  463. /* Set options                                                               */
  464. /*****************************************************************************/
  465. SetOptions: Procedure Expose options.
  466.   j=0
  467.   do i=1 to options.0
  468.     list.i=options.i
  469.     If options.i.state='YES' Then Do
  470.        j=j+1
  471.        sel.j=options.i
  472.     End
  473.   End
  474.   list.0 = options.0
  475.   Sel.0=j 
  476.   If VCheckBox('Set archiving options', list, sel, 3)<>'CANCEL' Then Do
  477.     Do i=1 to options.0
  478.       options.i.state='NO'
  479.       If sel.0>0 Then Do j=1 to sel.0
  480.         If options.i=sel.j Then options.i.state='YES'
  481.       End
  482.     End
  483.   Drop i j list. sel.
  484. Return
  485.  
  486. /*****************************************************************************/
  487. /* setup main window  (with handle mainwin)                                  */
  488. /*****************************************************************************/
  489. SetupMainWin:
  490.   win.left   = 2
  491.   win.right  = 60
  492.   win.top    = 98
  493.   win.bottom = 65
  494.   mainwin = VOpenWindow('VArc' versionStr '(c) Paul Gallagher 1992', 'YELLOW', win)
  495.   Call UpdateDisplay
  496.   Drop win.
  497. Return
  498.  
  499. UpdateDisplay:
  500.   call VClearWindow mainwin
  501.   call VForeColor mainwin, 'BLUE'
  502.   Call VSetFont mainwin, 'HELVB', 18
  503.   call VSay mainwin, 10, 900, 'LZH-ZIP-ZOO-ARC Archive Manager'
  504.   call VForeColor mainwin, 'BLACK'
  505.   Call VSetFont mainwin, 'TIME', 14
  506.   call VSay mainwin, 10, 720, 'Work Directory    :' dir.work
  507.   call VSay mainwin, 10, 600, 'Current Archive   :' arcfile
  508.   call VSay mainwin, 10, 480, 'Program Options'
  509.   Call VSetFont mainwin, 'HELV', 10
  510.   call VSay mainwin, 10, 830, 'REXX / VREXX Rules!'
  511.   y=400
  512.   do i=1 to options.0
  513.     Call VSay mainwin, 40, y, options.i ':' options.i.state
  514.     y=y-100
  515.   End 
  516.   Drop i y
  517. Return
  518.  
  519. /*****************************************************************************/
  520. /* exec message window  (with handle msgwin)                                 */
  521. /*****************************************************************************/
  522. ExecMsgWin: Procedure Expose msgwin
  523.   If msgwin='CLOSED' Then Do
  524.     mwin.left   = 25
  525.     mwin.right  = 75
  526.     mwin.top    = 55
  527.     mwin.bottom = 45
  528.     msgwin = VOpenWindow('VArc says...', 'CYAN', mwin)
  529.     /* do some initial stuff in the window */
  530.     call VForeColor msgwin, 'BLACK'
  531.     Call VSetFont msgwin, 'HELVB', 16
  532.     call VSay msgwin, 10, 500, ARG(1)
  533.     Drop mwin.
  534.   End
  535.   Else Do
  536.     Call VCloseWindow msgwin
  537.     msgwin='CLOSED'
  538.   End
  539. Return
  540.  
  541. /*****************************************************************************/
  542. /* set parameters for using the archive programs                             */
  543. /*****************************************************************************/
  544. SetArcParams:
  545.   arcmask='*.*z*'
  546.   arcproto.number=5  /* number of different archive programs supported */
  547.   arcselect=1  /* current config selected */
  548.   /* settings for LH */
  549.   arcproto.1.ext='.LZH'
  550.   arcproto.1.arcexe='LH.EXE'
  551.   arcproto.1.unarcexe='LH.EXE'
  552.   arcproto.1.arc='lh a ~archive~ ~filemask~ /os'
  553.   arcproto.1.arcnosub='lh a ~archive~ ~filemask~ /o'
  554.   arcproto.1.unarc='lh x ~archive~ ~filemask~ /os'
  555.   arcproto.1.unarcnosub='lh x ~archive~ ~filemask~ /o'
  556.   arcproto.1.list='lh l ~archive~ ~filemask~ /o'
  557.   arcproto.1.del='lh d ~archive~ ~filemask~ /o'
  558.   arcproto.1.parse="fsize fyy'-'fmm'-'fdd fname"
  559.   arcproto.1.startdelim='---'
  560.   arcproto.1.enddelim='---'
  561.   /* settings for ZIP/UNZIP */
  562.   arcproto.2.ext='.ZIP'
  563.   arcproto.2.arcexe='ZIP.EXE'
  564.   arcproto.2.unarcexe='UNZIP.EXE'
  565.   arcproto.2.arc='zip -r ~archive~ ~filemask~'
  566.   arcproto.2.arcnosub='zip -j ~archive~ ~filemask~'
  567.   arcproto.2.unarc='unzip -o ~archive~ ~filemask~'
  568.   arcproto.2.unarcnosub='unzip -jo ~archive~ ~filemask~'
  569.   arcproto.2.list='unzip -v ~archive~ ~filemask~'
  570.   arcproto.2.del='zip -d ~archive~ ~filemask~'
  571.   arcproto.2.parse="fsize d.1 d.2 d.3  fdd'-'fmm'-'fyy d.4 d.5  fname"
  572.   arcproto.2.startdelim='---'
  573.   arcproto.2.enddelim='---'
  574.   /* settings for PKZIP2/PKUNZIP2 */
  575.   arcproto.3.ext='.ZIP'
  576.   arcproto.3.arcexe='PKZIP2.EXE'
  577.   arcproto.3.unarcexe='PKUNZIP2.EXE'
  578.   arcproto.3.arc='pkzip2 -apr ~archive~ ~filemask~'
  579.   arcproto.3.arcnosub='pkzip2 ~archive~ ~filemask~'
  580.   arcproto.3.unarc='pkunzip2 -o -d ~archive~ ~filemask~'
  581.   arcproto.3.unarcnosub='pkunzip2 -o ~archive~ ~filemask~'
  582.   arcproto.3.list='pkunzip2 -vb ~archive~ ~filemask~'
  583.   arcproto.3.del='pkzip2 -d ~archive~ ~filemask~'
  584.   arcproto.3.parse="fsize d.1 d.2 d.3 fmm'-'fdd'-'fyy d.4 fname"
  585.   arcproto.3.startdelim='---'
  586.   arcproto.3.enddelim='---'
  587.   /* settings for ZOO */
  588.   arcproto.4.ext='.ZOO'
  589.   arcproto.4.arcexe='ZOO.EXE'
  590.   arcproto.4.unarcexe='ZOO.EXE'
  591.   arcproto.4.arc='zoo a ~archive~ ~filemask~'
  592.   arcproto.4.arcnosub='zoo a: ~archive~ ~filemask~'
  593.   arcproto.4.unarc='zoo x.O ~archive~ ~filemask~'
  594.   arcproto.4.unarcnosub='zoo x:O ~archive~ ~filemask~'
  595.   arcproto.4.list='zoo -l ~archive~ ~filemask~'
  596.   arcproto.4.del='zoo DP ~archive~ ~filemask~'
  597.   arcproto.4.parse="fsize d.1 d.2 fdd fmm fyy d.3 d.4 fname"
  598.   arcproto.4.startdelim='---'
  599.   arcproto.4.enddelim='---'
  600.   /* settings for ARC */
  601.   arcproto.5.ext='.ARC'
  602.   arcproto.5.arcexe='ARC.EXE'
  603.   arcproto.5.unarcexe='ARC.EXE'
  604.   arcproto.5.arc='arc a ~archive~ ~filemask~'
  605.   arcproto.5.arcnosub='arc a ~archive~ ~filemask~'
  606.   arcproto.5.unarc='arc x ~archive~ ~filemask~'
  607.   arcproto.5.unarcnosub='arc x ~archive~ ~filemask~'
  608.   arcproto.5.list='arc l ~archive~ ~filemask~'
  609.   arcproto.5.del='arc d ~archive~ ~filemask~'
  610.   arcproto.5.parse="fname fsize fdd fmm fyy"
  611.   arcproto.5.startdelim='==='
  612.   arcproto.5.enddelim='==='
  613. Return
  614.  
  615. /*****************************************************************************/
  616. /* reports error for file not on path                                        */
  617. /* ARG(1) = name of file                                                     */
  618. /*****************************************************************************/
  619. FindError:
  620.   msg.0 = 2
  621.   msg.1 = 'Cannot process' ARG(1)
  622.   msg.2 = 'Archive utility not found on PATH'
  623.   call VMsgBox 'Error', msg, 1
  624.   Drop msg.
  625. Return
  626.  
  627. /* standard routines */
  628. /*****************************************************************************/
  629. /* routine to display help message                                           */
  630. /*****************************************************************************/
  631. HelpInfo: Procedure Expose versionStr
  632.   msg.0 = 5
  633.   msg.1 ='VArc Archive Manager' versionStr
  634.   msg.2 ='(c) Paul Gallagher 1992,1993'
  635.   msg.3 ='Problems: paulg@a1.resmel.bhp.com.au'
  636.   msg.4 ='Requires OS/2 versions of the appropriate archive'
  637.   msg.5 ='utilities on the PATH to work.'
  638.   call VMsgBox 'Info', msg, 1
  639.   Drop msg.
  640. Return
  641.  
  642. /*****************************************************************************/
  643. /* info message procedure                                                    */
  644. /* ARG(1) = message to display                                               */
  645. /*****************************************************************************/
  646. InfoMsg: Procedure
  647.   msg.0 = 1
  648.   msg.1 = ARG(1)
  649.   call VMsgBox 'Info', msg, 1
  650.   Drop msg.
  651. Return
  652.  
  653. /*****************************************************************************/
  654. /* error message procedure                                                    */
  655. /* ARG(1) = message to display                                               */
  656. /*****************************************************************************/
  657. ErrorMsg: Procedure
  658.   msg.0 = 1
  659.   msg.1 = ARG(1)
  660.   call VMsgBox 'Error', msg, 1
  661.   Drop msg.
  662. Return
  663.  
  664. /*****************************************************************************/
  665. /* question procedure                                                        */
  666. /* ARG(1) = dialog box title                                                 */
  667. /* ARG(2) = message to display                                               */
  668. /* ARG(3) = buttons required (value)                                         */
  669. /* returns button name pressed                                               */
  670. /*****************************************************************************/
  671. MsgDlg: Procedure
  672.   msg.0 = 1
  673.   msg.1 = ARG(2)
  674.   ret = VMsgBox(ARG(1), msg, ARG(3))
  675.   Drop msg.
  676. Return ret
  677.  
  678. /*****************************************************************************/
  679. /* determine if filename valid                                               */
  680. /* ARG(1) = filename                                                         */
  681. /*****************************************************************************/
  682. ValidFile:
  683.   If (Pos('*',ARG(1))>0) | (Pos('?',ARG(1))>0) Then ans='NO'
  684.   Else ans='YES'
  685. Return ans