home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / amiga / comms / misc / rf911215.lha / FidoInOut.rexx next >
Encoding:
OS/2 REXX Batch file  |  1991-12-14  |  9.4 KB  |  348 lines

  1. /*
  2.  *        Test of rexxflow.library
  3.  */
  4.  
  5. options results
  6.  
  7. /*  
  8.    The following defines are from work_detail.h for flow.library
  9.  
  10. #define DTB_IFSENT      7     /* Let X= 'sent', else 'end of session' */
  11. #define DTB_DELETE      6     /* delete if X      */
  12. #define DTB_TRUNCATE    5     /* truncate if X    */
  13. #define DTB_REQUEUE     4     /* requeue if not X */
  14. */
  15.  
  16. DTF_IFSENT = 128
  17. DTF_DELETE = 64
  18. DTF_TRUNCATE = 32
  19. DTF_REQUEUE = 16
  20.  
  21.  
  22. DT_TRUNCATE     = DTF_IFSENT+DTF_TRUNCATE+DTF_REQUEUE
  23. DT_FILEATTACH   = DTF_IFSENT+DTF_REQUEUE
  24. DT_DELETE       = DTF_IFSENT+DTF_DELETE+DTF_REQUEUE
  25. DT_SHOW_DELETE  = DT_DELETE
  26. DT_NOTHING      = DT_FILEATTACH
  27. DT_EXTRA_DELETE = DT_DELETE
  28. DT_REQUEST      = DTF_REQUEUE+DTF_DELETE
  29. DT_MAILBUNDLE   = DT_TRUNCATE
  30.  
  31. DTPRI_CRASH = 50
  32. DTPRI_HOLD  = -50 
  33.  
  34. nl='0a'X
  35. cr='0d'X
  36. TRUE = 1
  37. FALSE = 0
  38.  
  39. call pragma('D',"welmat:msg")
  40.  
  41.  
  42. magicnum = 10000000
  43.  
  44.   outbound = GetOutbound()
  45.   if (outbound="")then call SetOutbound("welmat:outbound/")
  46.   outbound = upper(GetOutbound())
  47.   say outbound
  48.  
  49.  
  50. if open('in',outbound||"BUNDLES/MAGICNUM",'R') then do
  51.     magicnum=readln('in')
  52.         close('in')
  53. end
  54.  
  55.   myaddress.domain = "Fidonet"
  56.   myaddress.zone = 1
  57.   myaddress.net = 163
  58.   myaddress.node = 139
  59.   myaddress.point = 0
  60.   call SetDefaultAddress(myaddress)
  61.  
  62.  
  63.   whichnode.numnodes = 15
  64.   whichnode.1.domain = "Fidonet"
  65.   whichnode.1.zone = 1
  66.   whichnode.1.net = 163
  67.   whichnode.1.node = 109
  68.   whichnode.1.point = 0
  69.   whichnode.1.pri = DTPRI_CRASH
  70.  
  71.   whichnode.2.domain = "Fidonet"
  72.   whichnode.2.zone = 1
  73.   whichnode.2.net = 163
  74.   whichnode.2.node = 136
  75.   whichnode.2.point = 0
  76.   whichnode.2.pri = DTPRI_CRASH
  77.  
  78.   whichnode.3.domain = "Fidonet"
  79.   whichnode.3.zone = 1
  80.   whichnode.3.net = 163
  81.   whichnode.3.node = 211
  82.   whichnode.3.point = 0
  83.   whichnode.3.pri = DTPRI_CRASH
  84.  
  85.   whichnode.4.domain = "Fidonet"
  86.   whichnode.4.zone = 1
  87.   whichnode.4.net = 163
  88.   whichnode.4.node = 150
  89.   whichnode.4.point = 0
  90.   whichnode.4.pri = DTPRI_CRASH
  91.  
  92.   whichnode.5.domain = "Fidonet"
  93.   whichnode.5.zone = 1
  94.   whichnode.5.net = 163
  95.   whichnode.5.node = 133
  96.   whichnode.5.point = 0
  97.   whichnode.5.pri = DTPRI_CRASH
  98.  
  99.   whichnode.6.domain = "Fidonet"
  100.   whichnode.6.zone = 1
  101.   whichnode.6.net = 163
  102.   whichnode.6.node = 123
  103.   whichnode.6.point = 0
  104.   whichnode.6.pri = DTPRI_CRASH
  105.  
  106.   whichnode.7.domain = "Fidonet"
  107.   whichnode.7.zone = 1
  108.   whichnode.7.net = 163
  109.   whichnode.7.node = 239
  110.   whichnode.7.point = 0
  111.   whichnode.7.pri = DTPRI_CRASH
  112.  
  113.   whichnode.8.domain = "Fidonet"
  114.   whichnode.8.zone = 1
  115.   whichnode.8.net = 224
  116.   whichnode.8.node = 140
  117.   whichnode.8.point = 0
  118.   whichnode.8.pri = DTPRI_HOLD
  119.  
  120.   whichnode.9.domain = "Fidonet"
  121.   whichnode.9.zone = 1
  122.   whichnode.9.net = 163
  123.   whichnode.9.node = 112
  124.   whichnode.9.point = 0
  125.   whichnode.9.pri = DTPRI_CRASH
  126.  
  127.   whichnode.10.domain = "Fidonet"
  128.   whichnode.10.zone = 1
  129.   whichnode.10.net = 163
  130.   whichnode.10.node = 130
  131.   whichnode.10.point = 0
  132.   whichnode.10.pri = DTPRI_CRASH
  133.  
  134.   whichnode.11.domain = "Fidonet"
  135.   whichnode.11.zone = 1
  136.   whichnode.11.net = 163
  137.   whichnode.11.node = 207
  138.   whichnode.11.point = 0
  139.   whichnode.11.pri = DTPRI_CRASH
  140.  
  141.   whichnode.12.domain = "Fidonet"
  142.   whichnode.12.zone = 1
  143.   whichnode.12.net = 163
  144.   whichnode.12.node = 162
  145.   whichnode.12.point = 0
  146.   whichnode.12.pri = DTPRI_CRASH
  147.  
  148.   whichnode.13.domain = "Fidonet"
  149.   whichnode.13.zone = 1
  150.   whichnode.13.net = 163
  151.   whichnode.13.node = 109
  152.   whichnode.13.point = 10
  153.   whichnode.13.pri = DTPRI_HOLD
  154.   whichnode.13.private = 30056
  155.  
  156.   whichnode.14.domain = "Fidonet"
  157.   whichnode.14.zone = 1
  158.   whichnode.14.net = 163
  159.   whichnode.14.node = 109
  160.   whichnode.14.point = 4
  161.   whichnode.14.pri = DTPRI_HOLD
  162.   whichnode.14.private = 30056
  163.  
  164.   whichnode.15.domain = "Fidonet"
  165.   whichnode.15.zone = 1
  166.   whichnode.15.net = 232
  167.   whichnode.15.node = 301
  168.   whichnode.15.point = 0
  169.   whichnode.15.pri = DTPRI_HOLD
  170.  
  171. /*  call fidoflo2uucp("jammys fido") */
  172.  
  173. do anode = 1 until anode = whichnode.numnodes
  174.   say anode
  175.   if symbol('whichnode.anode.private')=="VAR" then do
  176.     say "Unflow" whichnode.anode.net"/"||whichnode.anode.node||"."||whichnode.anode.point
  177.     floname = upper(outbound||"bundles/"||right(d2x(whichnode.anode.private),4,"0") ,
  178.            ||right(d2x(whichnode.anode.point),4,"0")||".CLO")
  179.   end
  180.   else do
  181.     say "Unflow" whichnode.anode.net"/"||whichnode.anode.node
  182.     floname = upper(outbound||"bundles/"||right(d2x(whichnode.anode.net),4,"0") ,
  183.            ||right(d2x(whichnode.anode.node),4,"0")||".CLO")
  184.   end
  185.   address command "delete "floname
  186.  
  187.   work_detail = FindDetail(whichnode.anode)
  188.   say work_detail
  189.  
  190.   call ScanDetail(work_detail, huge_list)
  191.   if (huge_list.numnodes > 0) then do
  192.        say "InIt-Un"
  193.        x=Open('flofile',floname,'W')
  194.        if x=0 then do
  195.          say "Error opening" floname
  196.          Exit 1  
  197.        end
  198.        do i = 1 until i = huge_list.numnodes
  199.           say huge_list.i.filename
  200.           if index(upper(huge_list.i.filename),outbound||"BUNDLES") then do
  201.              wildchar=''
  202.              drop flags
  203.              if (huge_list.i.flags = DT_TRUNCATE) then wildchar='#'
  204.              if (huge_list.i.flags = DT_DELETE) then wildchar='^'
  205.              call WriteLN('flofile', upper(wildchar||huge_list.i.filename)) 
  206.              say "Writing:" wildchar||huge_list.i.filename
  207.           end
  208.           else do
  209.              drop flags
  210. say "AddWorkName("work_detail","huge_list.i.filename","huge_list.i.asname","huge_list.i.flags")"
  211.              detailnode=AddWorkName(work_detail,huge_list.i.filename,huge_list.i.asname,huge_list.i.flags)
  212. say "ChangeDetailPri("work_detail","detailnode","huge_list.i.pri")"
  213.              ChangeDetailPri(work_detail,detailnode,huge_list.i.pri)
  214.           end
  215.        end
  216.        x=Close('flofile')
  217.     end
  218. /*    FreeDetail(work_detail) */
  219.     call DumpOutbound(outbound)
  220. end
  221.  
  222.  
  223. address command "assign at: t:"
  224. address command "assign mail: welmat:msg"
  225. address command "stack 300000" nl  ,
  226.   "welmat:msg/bin/cm import welmat:msg/areas.bbs -k -n -a rx xarc x"
  227.  
  228. address command "stack 300000" nl ,
  229.   "welmat:msg/bin/cm export welmat:msg/areas.bbs -o "outbound||"BUNDLES/"
  230.  
  231. call netmailscan()   /* Does point remapping/etc */
  232.  
  233. address command "stack 30000" nl ,
  234.   "welmat:msg/bin/ommm -z1"
  235.  
  236. do anode = 1 until anode = whichnode.numnodes
  237.   say anode
  238.   say whichnode.anode.net"/"||whichnode.anode.node
  239.  
  240.   if symbol('whichnode.anode.private')=="VAR" then do
  241.     say "ReFlow" whichnode.anode.net"/"||whichnode.anode.node||"."||whichnode.anode.point
  242.     outname = upper(outbound||"BUNDLES/"||right(d2x(whichnode.anode.private),4,"0") ,
  243.            ||right(d2x(whichnode.anode.point),4,"0")||".CUT")
  244.     floname = upper(outbound||"BUNDLES/"||right(d2x(whichnode.anode.private),4,"0") ,
  245.            ||right(d2x(whichnode.anode.point),4,"0")||".CLO")
  246.   end
  247.   else do
  248.     say "ReFlow" whichnode.anode.net"/"||whichnode.anode.node
  249.     outname = upper(outbound||"BUNDLES/"||right(d2x(whichnode.anode.net),4,"0") ,
  250.            ||right(d2x(whichnode.anode.node),4,"0")||".CUT")
  251.     floname = upper(outbound||"BUNDLES/"||right(d2x(whichnode.anode.net),4,"0") ,
  252.            ||right(d2x(whichnode.anode.node),4,"0")||".CLO")
  253.   end
  254.  
  255.   say outname ":" floname
  256.  
  257.   work_detail = FindDetail(whichnode.anode)
  258.  
  259.   say work_detail
  260.  
  261.   call ScanDetail(work_detail, huge_list)
  262.  
  263.   additout = EXISTS(outname)
  264.   say "numnodes" huge_list.numnodes
  265.  
  266.   if huge_list.numnodes > 0 then do
  267.      say "InIt"
  268.      do i = 1 until i = huge_list.numnodes
  269.         say i
  270.         drop flags
  271.         if upper(huge_list.i.filename) ~= outname then do
  272. say "AddWorkName("work_detail","huge_list.i.filename","huge_list.i.asname","huge_list.i.flags")"
  273.           detailnode=AddWorkName(work_detail,huge_list.i.filename,huge_list.i.asname,huge_list.i.flags)
  274. say "ChangeDetailPri("work_detail","detailnode","huge_list.i.pri")"
  275.           ChangeDetailPri(work_detail,detailnode,huge_list.i.pri)
  276.         end
  277.      end
  278.   end
  279.  
  280.   if EXISTS(floname) then do
  281.     x=Open('flofile',floname,'R')
  282.     if x=0 then do
  283.       say "Error opening" floname
  284.       Exit 1  
  285.     end
  286.  
  287.     do forever
  288.  
  289.       Line=upper(ReadLn('flofile'))
  290.  
  291.       if EOF('flofile') then Leave
  292.  
  293.       say "processing line" Line
  294.  
  295.       flags= DT_NOTHING
  296.       if (LEFT(Line,1) = "#") then do
  297.          flags = DT_TRUNCATE
  298.          Line=DELSTR(Line,1,1)
  299.       end
  300.       if (LEFT(Line,1) = "^") then do
  301.          flags = DT_DELETE
  302.          Line=DELSTR(Line,1,1)
  303.       end
  304.       addit = TRUE
  305.  
  306.       if huge_list.numnodes > 0 then do
  307.         say "InIt1" huge_list.numnodes
  308.  
  309.         do i = 1 until i = huge_list.numnodes
  310.           say i " : " upper(huge_list.i.filename) " || " Line
  311.           if upper(huge_list.i.filename) = Line then do
  312.               addit = FALSE
  313.               say "not adding"
  314.           end
  315.         end
  316.       end
  317.       if (addit = TRUE) & (Line ~= outname) then do
  318.         say "Adding: " Line
  319.         detailnode=AddWork(work_detail,Line, flags)
  320.         ChangeDetailPri(work_detail,detailnode,whichnode.anode.pri)
  321.       end     
  322.      end
  323.      x=Close('flofile')
  324.      address command "delete "floname
  325.   end /* exists floname */
  326.  
  327.   if additout = TRUE then do
  328.       magicnum= magicnum+1
  329.       if ((magicnum > 99999999) | (Magicnum < 10000000)) then magicnum = 10000000
  330.        say "Adding It - MagicNum" magicnum
  331.        detailnode=AddWorkName(work_detail,outname,magicnum||".PKT", DT_DELETE)
  332.        ChangeDetailPri(work_detail,detailnode,whichnode.anode.pri)
  333.   end
  334. /*  freeDetail(work_detail) */
  335.   call DumpOutbound(outbound)
  336. end
  337.  
  338. if ~open('out',outbound||"BUNDLES/MAGICNUM",'W') then do
  339.     say "Can't open numberfile"
  340.   end
  341.   else do
  342.     writeln('out',magicnum)
  343.     close('out')
  344.     Say "Wrote out Magicnum:"magicnum
  345.   end
  346.  
  347. /*  call fidoflo2uucp("jammys UUCP") */
  348.