home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / amiga / comms / misc / jwsc0830.lha / jflow.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1992-05-26  |  7.6 KB  |  251 lines

  1. /*
  2.  *      Test of rexxflow.library
  3.  *      Origional Name: FidoInOut.Rexx by Russell McOrmond
  4.  *
  5.  *      Modified to convert 4d style .?LO and .?UT files by
  6.  *                    James McOrmond 1:224/140.0
  7.  *
  8.  *      Can be converted to use regular ?lo/?ut files.
  9.  *
  10.  *      January ?/92 - Converted from FidoInOut.Rexx to Jflow.rexx
  11.  *          *        - (didn't log the modifications)
  12.  *      April 21/92  - fixed logical error in generating filenames
  13.  *      April 22/92  - cleaned up output for faster execution
  14.  *      May   16/92  - more cleaning
  15.  */
  16.  
  17. options results
  18.  
  19. DTF_IFSENT = 128
  20. DTF_DELETE = 64
  21. DTF_TRUNCATE = 32
  22. DTF_REQUEUE = 16
  23.  
  24. DT_TRUNCATE     = DTF_IFSENT+DTF_TRUNCATE+DTF_REQUEUE
  25. DT_FILEATTACH   = DTF_IFSENT+DTF_REQUEUE
  26. DT_DELETE       = DTF_IFSENT+DTF_DELETE+DTF_REQUEUE
  27. DT_SHOW_DELETE  = DT_DELETE
  28. DT_NOTHING      = DT_FILEATTACH
  29. DT_EXTRA_DELETE = DT_DELETE
  30. DT_REQUEST      = DTF_REQUEUE+DTF_DELETE
  31. DT_MAILBUNDLE   = DT_TRUNCATE
  32.  
  33. DTPRI_CRASH = 50
  34. DTPRI_HOLD  = -50
  35.  
  36.  
  37. DTPRI_DIRECT= 30                   /* This one I added; your scheduler
  38.                                     * can/could be updated to send
  39.                                     * Direct files during ZMH.
  40.                                     * If not, 30 should be assumed
  41.                                     * "Normal" as if it came from a .FLO
  42.                                     */
  43. nl='0a'X
  44. cr='0d'X
  45. TRUE = 1
  46. FALSE = 0
  47.  
  48. magicnum = 11111111
  49.  
  50.   flows = GetOutbound()         /* Make sure your Outbound is set */
  51.   if (flows="")then call SetOutbound("outbound:flows")
  52.   flows = upper(GetOutbound())
  53.  
  54.   outbound = "OUTBOUND:"
  55.  
  56.   say "JFlow 0.7 - 4dstyle outbound -> Flow.Library Converter"
  57.   say "Updated May 16, 1992.  By James McOrmond"
  58.  
  59.                                    /* This should list all of the needed
  60.                                     * files: Flow,Direct,Crash & Hold.
  61.                                     */
  62.  
  63. Address Command 'list >t:outlist out:#?.#?.#?.#?.?lo quick nohead'
  64. Address Command 'list >>t:outlist out:#?.#?.#?.#?.?ut quick nohead'
  65.  
  66. if open('in',"Mail:MAGICNUM",'R') then do
  67.     magicnum=readln('in')
  68.         close('in')
  69. end
  70.  
  71.   myaddress.domain = "Fidonet"     /* Put YOUR address here */
  72.   myaddress.zone = 1
  73.   myaddress.net = 224
  74.   myaddress.node = 140
  75.   myaddress.point = 0
  76.   call SetDefaultAddress(myaddress)
  77.  
  78. x=Open('cfgfile',"t:outlist",'R')
  79. if x=0 then do
  80.   say "Error opening outlist"
  81.   Exit 1
  82. end
  83.  
  84.  
  85. i=0
  86.  
  87. do forever
  88.  
  89.   Line=Upper(strip(space(ReadLn('cfgfile'),1),'B'))
  90.  
  91.   if EOF('cfgfile') then Leave
  92.  
  93. /*  say "Found" Line    */
  94.  
  95.   i=i+1
  96.   whichnode.i.domain = "Fidonet"
  97.   whichnode.i.pri = "0"
  98.   node.i = Line                             /* If you want to use regular flo
  99.                                              * files, you parse the list
  100.                                              * differently on this next line
  101.                                              */
  102.   parse var Line whichnode.i.zone"."whichnode.i.net"."whichnode.i.node"."whichnode.i.point"."junk
  103.  
  104.                                             /* This takes care of special
  105.                                              * files; Crash, Hold, Direct.
  106.                                              * All others are sent like a
  107.                                              * .FLO or .OUT.
  108.                                              */
  109.   if Left(junk,1)="C" then whichnode.i.pri = DTPRI_CRASH
  110.   if Left(junk,1)="H" then whichnode.i.pri = DTPRI_HOLD
  111.   if Left(junk,1)="D" then whichnode.i.pri = DTPRI_DIRECT
  112.  
  113. end
  114. x=Close('cfgfile')
  115. if i = 0 then do
  116.   say "No Files found to convert"
  117.   exit
  118. end
  119.  
  120. whichnode.numnodes = i
  121.  
  122. call pragma('D',"mail:")
  123.  
  124. do anode = 1 until anode = whichnode.numnodes
  125.   say " "
  126.   say "ReFlow" node.anode
  127.  
  128.   jnode = left(node.anode,length(node.anode)-3)
  129.  
  130. /*  say "node ="node  */
  131.  
  132.   outname = OUTBOUND||jnode||Left(right(node.anode,3),1)||"UT"
  133.   floname = OUTBOUND||jnode||Left(right(node.anode,3),1)||"LO"
  134.  
  135.                                                          /* Yes i know one
  136.                                                           * these will give
  137.                                                           * NODE.ANODE back,
  138.                                                           * but this way, I
  139.                                                           * don't have to
  140.                                                           * worry about which
  141.                                                           * was which.
  142.                                                           */
  143. /*  say "outname = "outname */
  144. /*  say "floname = "floname */
  145.  
  146.   work_detail = FindDetail(whichnode.anode)
  147.  
  148.   call ScanDetail(work_detail, huge_list)
  149.  
  150.   additout = EXISTS(outname)
  151.  
  152.   if huge_list.numnodes > 0 then do
  153.      do i = 1 until i = huge_list.numnodes
  154.         drop flags
  155.         if upper(huge_list.i.filename) ~= outname then do
  156.           detailnode=AddWorkName(work_detail,huge_list.i.filename,huge_list.i.asname,huge_list.i.flags)
  157.           ChangeDetailPri(work_detail,detailnode,huge_list.i.pri)
  158.         end
  159.      end
  160.   end
  161.  
  162.   if EXISTS(floname) then do
  163.     x=Open('flofile',floname,'R')
  164.     if x=0 then do
  165.       say "Error opening" floname
  166.       Exit 1
  167.       end
  168.  
  169.     do forever
  170.  
  171.       Line=upper(ReadLn('flofile'))
  172.  
  173.       if EOF('flofile') then Leave
  174.  
  175.       flags= DT_NOTHING
  176.       if (LEFT(Line,1) = "#") then do
  177.          flags = DT_TRUNCATE
  178.          Line=DELSTR(Line,1,1)
  179.       end
  180.       if (LEFT(Line,1) = "^") then do
  181.          flags = DT_DELETE
  182.          Line=DELSTR(Line,1,1)
  183.       end
  184.       if (LEFT(Line,1) = "-") then do
  185.          flags = DT_DELETE
  186.          Line=DELSTR(Line,1,1)
  187.       end
  188.      addit = TRUE
  189.  
  190.       if huge_list.numnodes > 0 then do
  191.          do i = 1 until i = huge_list.numnodes
  192.            if upper(huge_list.i.filename) = Line then do
  193.                addit = FALSE
  194.               end
  195.            end
  196.          end
  197.                            /* I'm also checking to see if the file exists here
  198.                             * incase its been deleted already.
  199.                             */
  200.       if EXISTS(Line) = FALSE then do
  201.          Say "File No Longer Exists"
  202.          addit = FALSE
  203.          end
  204.  
  205.       if (addit = TRUE) & (Line ~= outname) then do
  206.          say "Adding: " Line
  207.          cmprs = left(right(line,3),2)
  208.          asfile = Right(d2x(whichnode.anode.net),4,"0") ,
  209.             ||Right(d2x(whichnode.anode.node),4,"0") ,
  210.             ||Right(Line,4)
  211.          if ((cmprs ~= MO) & (cmprs ~= TU) & (cmprs ~= WE) & (cmprs ~= TH) ,
  212.             & (cmprs ~= FR) & (cmprs ~= SA) & (cmprs ~= SU)) then asfile = ""
  213.  
  214.          if asfile ~= "" then do
  215.             detailnode=AddWorkName(work_detail,Line, upper(asfile), flags)
  216.             end
  217.          else detailnode=AddWork(work_detail,Line,flags)
  218.  
  219.          say whichnode.anode.pri
  220.          ChangeDetailPri(work_detail,detailnode,whichnode.anode.pri)
  221.          end
  222.       end
  223.   x=Close('flofile')
  224.   end
  225.  
  226. if (whichnode.anode.net ~= 114) & (whichnode.anode.net ~= 487) then do
  227.                               address command "delete "floname
  228.                               end
  229.                               else say "Not Deleting Flo"
  230.  
  231.   if additout = TRUE then do
  232.       magicnum= magicnum+1
  233.       if ((magicnum > 99999999) | (Magicnum < 11111111)) then magicnum = 11111111 + randu() * 99999
  234. /*       say "Adding It - MagicNum" magicnum         */
  235.        detailnode=AddWorkName(work_detail,outname,magicnum||".PKT", DT_DELETE)
  236.        ChangeDetailPri(work_detail,detailnode,whichnode.anode.pri)
  237.   end
  238.   call freeDetail(work_detail)
  239.   call DumpOutbound(flows)
  240. end
  241.  
  242. if ~open('out',"Mail:MAGICNUM",'W') then do
  243.   say "Can't open numberfile"
  244.   end
  245. else do
  246.   writeln('out',magicnum)
  247.   close('out')
  248. /*  Say "Wrote out Magicnum:"magicnum    */
  249.   end
  250.  
  251. /* We're Outta here!  */