home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / extract4.zip / dumpall.cmd < prev    next >
OS/2 REXX Batch file  |  1996-11-06  |  4KB  |  139 lines

  1. /* DUMPALL.CMD: This Rexx program runs the show for EXTRACT/MERGER
  2.    package.
  3.    (C)1994-1996 Turgut Kalfaoglu, All Rights Reserved
  4.  
  5.    This program is the one to run. It will do the following:
  6.     * Loads EXTRACT.CFG to learn paths and message separator string
  7.     * Deletes the S.UUE file
  8.     * Runs DUMPGRP.EXE to load everything into the S.UUE file
  9.       (the names of the groups to be loaded are taken from
  10.        DUMPGRP's own configuration file, DUMPGRP.CFG)
  11.     * Checks to see if DUMPGRP created S.UUE; exit if not.
  12.     * Runs EXTRACT, which reads S.UUE, and outputs 'partial files'
  13.       into the <PARTIALDIR> directory (location defined in EXTRACT.CFG)
  14.     * Runs MERGER which reads EXTRACT.SUM and decides which partial
  15.       files' pieces have all arrived, and merges the partial pieces
  16.       into actual files. Merger then deletes the partial pieces that
  17.       were successfully processed.
  18. */
  19. parse arg site
  20. /* if no news site was entered, we will default to the LAST one
  21.    of the following list:
  22. */
  23.  
  24. if site = '' then do
  25.   site = "news.metu.edu.tr"
  26.   site = 'news.uni-hohenheim.de'
  27.   site = 'liberty.uc.wlu.edu'
  28.   site = 'baum02.ege.edu.tr'
  29.   site = 'omega.gmd.de'
  30.   site = 'news.ege.edu.tr'
  31.   site = 'news.raksnet.com.tr'
  32.   site = 'tomcat.msrcnavo.navy.mil'
  33. end
  34.  
  35. /* This is what will be put between each message. This needs to be
  36.  the same for EXTRACT.CFG as well.
  37. */
  38.  
  39. /* This is new with V.4; we read EXTRACT.CFG to learn paths and
  40.    signature separator
  41. */
  42. t = time('R')
  43. f='EXTRACT.CFG'
  44. say time() 'Parsing' f
  45. goodvars = 'DOCSDIR PARTIALDIR ARCDIR SEPARATOR'
  46. parse value '' with docsdir partialdir arcdir separator
  47. do while lines(f)
  48.    r = LINEIN(f)
  49.    Parse var r before'='after
  50.    If after=''  Then Iterate
  51.    If before='' Then Iterate
  52.    before=strip(before)
  53.    after=strip(after)
  54.    If pos(before,goodvars)=0 Then Iterate
  55.    interpret before'= "'after'"'
  56. End
  57. r = LINEOUT(f,,)
  58. If words(docsdir partialdir arcdir separator)<4 Then Do
  59.    Say time() 'Error reading' f', or variable assignments in error in' f
  60.    Exit
  61. End
  62.  
  63. 'CD' docsdir
  64. if rc<>0 Then Exit rc
  65.  
  66. 'DEL' ARCDIR'\S.UUE'
  67. "DUMPGRP -s"site "-r -l"separator
  68. If rc<>0 Then say 'DUMPGRP returns:' rc
  69. if rc =  1 then exit rc
  70. if rc = -1 then exit rc
  71.  
  72. /* Does S.UUE exist? */
  73. If lines(ARCDIR'\S.UUE') < 1 Then Do
  74.    Say time() 'No' ARCDIR'\S.UUE file -- quitting.'
  75.    Signal Done
  76. End
  77. r = lineout(ARCDIR'\S.UUE',,)
  78.  
  79. 'CD' arcdir
  80. if rc<>0 then Exit rc
  81.  
  82. 'ERASE INCOMP.ZUP'
  83. 'REN S.UUE INCOMP.ZUP'
  84.  
  85. /* NOEOF removes CTRL-Z that may be present in file.. Its usage is
  86.   optional.
  87. '..\NOEOF'
  88. */
  89.  
  90. if lines('INCOMP.OUT') > 0 Then Do
  91.   r = lineout('INCOMP.OUT',,)
  92.   'DEL INCOMP.ZUP'
  93.   'REN INCOMP.OUT INCOMP.ZUP'
  94. end
  95.  
  96. 'CD' DOCSDIR
  97. 'EXTRACT'
  98. 'MERGER'
  99. 'CD' ARCDIR
  100.  
  101. 'DEL INCOMP.BAK'
  102. 'REN INCOMP.ZUP INCOMP.BAK'
  103. 'CD' DOCSDIR
  104. call DEUUE
  105. '@RXQUEUE /CLEAR'
  106. Call Carry '*.ZIP'
  107. Call Carry '*.ARJ'
  108. Call Carry '*.GIF'
  109. Call Carry '*.JPG'
  110. Call Carry '*.MPG'
  111. Call Carry '*.DL'
  112.  
  113. Done:
  114. secs = trunc(time('E'))
  115. Say time() 'Normal completion of DUMPALL. Runtime was' secs 'seconds.'
  116. exit
  117.  
  118. Carry:
  119. arg pattern .
  120.  '@DIR /B' pattern '| RXQUEUE'
  121.  Do queued()
  122.    parse pull fn .
  123.    'COPY' fn arcdir
  124.    If rc<>0 Then Exit rc
  125.    'DEL' fn
  126.  End
  127.  Return
  128.  
  129. /* Here we decode the received pieces: */
  130. DeUUE:
  131. 'FORALL *.GI : UUDDEL "@S" "@N.GIF"'
  132. 'FORALL *.JP : UUDDEL "@S" "@N.JPG"'
  133. 'FORALL *.ZI : UUDDEL "@S" "@N.ZIP"'
  134. 'FORALL *.MP : UUDDEL "@S" "@N.MPG"'
  135. 'FORALL *.DL : UUDDEL "@S" "@N.DL_"'
  136. 'FORALL *.AR : UUDDEL "@S" "@N.ARJ"'
  137. Return
  138.  
  139.