home *** CD-ROM | disk | FTP | other *** search
Wrap
/* * Origional Name: FidoInOut.Rexx by Russell McOrmond * * Modifications To Create Bundler For .OUT files. * by James McOrmond * * * Revision History as JBundle.rexx * * Feb 11/92 Bundler options * Feb 13/92 Configurable compressors * Feb 13/92 Hold, Crash, Norm, Direct priorities * Feb 14/92 Fixed bundle naming scheme * Feb 16/92 Added use of TestLock utility by Russell * Feb 16/92 Multiple Outbound Directories * Feb 17/92 Deletes bundles under 5 bytes in size before arc'ng to it * Feb 17/92 Restructure sub-directories - "NONE" compression handled * Feb 17/92 Improves processing time when there is nothing to do * Feb 18/92 Fixed Bug in "NONE" compression directories. * Mar 25/92 Now creates uppercase names * Mar 26/92 Uses standard Us-Them filenames for transit. * Mar 26/92 Generates more random .pkt filenames. * Mar 27/92 Added Us-Them for pointnet addresses. * Apr 7/92 Fixed Support for Archivers that don't like 4d filenames. * Apr 7/92 Complete re-did the archiving procedure. * Apr 13/92 Fixed Bug in Bundle Naming Scheme. * Apr 22/92 fixes sent in by Rick Morrow updated. * May 1?/92 Cleaned up naming scheme, minor changes * Jul 31/92 pkt naming scheme used as suggested by Walt Sullivan. * Aug 8/92 Minor cleaning up. Removal of DLGMail specific. * * * * Configure your address in lines 83 - 90. * Set your Directorys in lines 59 - 62 * If you want this as fast as possible, uncomment lines 161-166 */ options results DTF_IFSENT = 128 DTF_DELETE = 64 DTF_TRUNCATE = 32 DTF_REQUEUE = 16 DT_TRUNCATE = DTF_IFSENT+DTF_TRUNCATE+DTF_REQUEUE DT_FILEATTACH = DTF_IFSENT+DTF_REQUEUE DT_DELETE = DTF_IFSENT+DTF_DELETE+DTF_REQUEUE DT_SHOW_DELETE = DT_DELETE DT_NOTHING = DT_FILEATTACH DT_EXTRA_DELETE = DT_DELETE DT_REQUEST = DTF_REQUEUE+DTF_DELETE DT_MAILBUNDLE = DT_TRUNCATE DTPRI_CRASH = 50 DTPRI_HOLD = -50 DTPRI_DIRECT= 30 nl='0a'X cr='0d'X TRUE = 1 FALSE = 0 PACKETS = "OUTBOUND:" /* where #?.#?.#?.#?.out's are found */ BUNDLES = "OUTBOUND:" /* bundles in here, temp sub-dirs */ QUEUE = "outbound:flows/" /* Welmats .FLOW files */ CONFIGS = "mail:" /* jbundle.cfg */ Numeric digits 8 outbound = GetOutbound() /* Makes sure your Outbound is set */ if (outbound="")then call SetOutbound(QUEUE) outbound = upper(GetOutbound()) say say "JBundle.rexx 4d.out -> Flow.Library Bundler 1.02" say "Updated Aug 6, 1992 by James McOrmond" say say "Working..." myaddress.domain = "Fidonet" /* Put YOUR address here */ myaddress.zone = 1 myaddress.net = 224 myaddress.node = 140 myaddress.point = 0 call SetDefaultAddress(myaddress) myaddress.pointnet = 30125 x=Open('cfgfile',CONFIGS||"jbundle.cfg",'R') if x=0 then DO say "Error opening jbundle.cfg" Exit 1 END i=0 DO forever Line=Upper(strip(space(ReadLn('cfgfile'),1),'B')) if EOF('cfgfile') then Leave if Left(Line,1)=";" then Iterate if line="" then Iterate i=i+1 tonode.i.domain = "Fidonet" parse var Line fromnode.i.zone":"fromnode.i.net"/"fromnode.i.node"."fromnode.i.point" "tonode.i.zone":"tonode.i.net"/"tonode.i.node"."tonode.i.point" "tmp.1" "tmp.2 TONODE.I.PRI = "0" ARCHIVER.I = "lha -2 -u -P-5 m " j = 0 DO j = j + 1 UNTIL j = 2 if left(tmp.j, 2) = "AR" then ARCHIVER.I = "arc mw " if left(tmp.j, 2) = "ZO" then ARCHIVER.I = "zoo aq:M " if left(tmp.j, 2) = "ZI" then ARCHIVER.I = "zip -m -q -k -j -s " if left(tmp.j, 2) = "LZ" then ARCHIVER.I = "lharc -u m " if left(tmp.j, 3) = "NON" then ARCHIVER.I = "none" if left(tmp.j, 2) = "CR" then TONODE.I.PRI = DTPRI_CRASH if left(tmp.j, 2) = "HO" then TONODE.I.PRI = DTPRI_HOLD if left(tmp.j, 2) = "DI" then TONODE.I.PRI = DTPRI_DIRECT if datatype(tmp.j) = "NUM" then TONODE.I.PRI = TMP.J END END x=Close('cfgfile') if EXISTS(BUNDLES||"temps") < 1 then Address Command 'makedir' BUNDLES||"temps" if EXISTS(BUNDLES||"none") < 1 then Address Command "makedir" BUNDLES||"none" tonode.numnodes = i DO anode = 1 until anode = tonode.numnodes pat = PACKETS||fromnode.anode.zone||"."||fromnode.anode.net||"."||fromnode.anode.node||"."||fromnode.anode.point||".out" say say "Pattern is" pat if archiver.anode = "none" then toname = "none" else toname = tonode.anode.zone||"."||tonode.anode.net||"."||tonode.anode.node||"."||tonode.anode.point dirname = BUNDLES||"temps/"||toname if EXISTS(dirname) < 1 then Address Command 'makedir 'dirname say "Routing to :" toname Options Failat 21 Address Command 'rename >nil:' pat dirname||"/ QUIET" Options failat 10 if archiver.anode = "none" then Iterate /* By commenting the following section, the script slows down, but it has * a side effect of cleaning up a bit. If you would rather have the speed, * just uncomment this next section. */ /* Options Failat 21 * Address Command 'delete' dirname * if (RC=0) then Iterate * Options Failat 10 */ say "Priority :" tonode.anode.pri i = 0 xbun = 0 Address command 'list >t:jbun.tmp' BUNDLES||toname||".(MO?|TU?|WE?|TH?|FR?|SA?|SU?) quick nohead" address command 'type t:jbun.tmp' x=Open('xbun','t:jbun.tmp', 'R') if x=0 then DO say "Error opening t:jbun.tmp" exit 1 END Line=upper(ReadLn('xbun')) If EOF('xbun') | Left(Line,1)=":" then DO dayt = Date(w) END else do /* fixed minor bug :-( */ dayt=Right(Line,3) i = right(line,1) end x=Close('xbun') DO forever bunname = upper(BUNDLES||TONAME||"."||LEFT(Left(dayt,2)||i,3)) address command 'testlock' bunname if (RC ~= 1) then Leave Say "Bumping I" i i = i + 1 END say 'bunname' bunname if (EXISTS(bunname) & (word(StateF(bunname),2) < 5)) then Address Command 'delete' bunname work_detail = FindDetail(tonode.anode) call ScanDetail(work_detail, huge_list) if huge_list.numnodes > 0 then DO DO i = 1 until i = huge_list.numnodes if ((upper(huge_list.i.filename) ~= bunname) & (EXISTS(huge_list.i.filename))) then DO detailnode=AddWorkName(work_detail,huge_list.i.filename,huge_list.i.asname,huge_list.i.flags) ChangeDetailPri(work_detail,detailnode,huge_list.i.pri) END END END Options Failat 21 Address Command 'list >t:jbun.tmp' dirname||'/#?.(?UT|PKT) quick nohead' Options Failat 10 if ~Open('tmpfile','t:jbun.tmp', 'R') then Exit 1 arcit = 0 DO forever Line=ReadLn('tmpfile') if EOF('tmpfile') then Leave clock = time('Normal') magicnum = substr(date('Normal'),1,2) || substr(clock,1,2) || substr(clock,4,2) || substr(clock,7,2) Address Command 'rename' dirname||"/"||Line dirname||"/"magicnum||".pkt" arcit = 1 END x=Close('tmpfile') if arcit then DO Options Failat 21 Address Command "rename >nil: " bunname bundles||"tmparc."||left(archiver.anode,3) lformat= '"'archiver.anode bundles||"tmparc."||left(archiver.anode,3) dirname||"/%s"'"' Address Command "list >t:jbundle.tmp" dirname||"/#?.pkt quick lformat=" lformat Address Command "type t:jbundle.tmp" Address Command "execute t:jbundle.tmp" Address Command "rename" bundles||"tmparc."||left(archiver.anode,3) bunname END Options Failat 21 Address Command 'delete >nil:' dirname Options Failat 10 if EXISTS(bunname) then DO say 'adding' bunname tonode.node = tonode.anode.node tonode.net = tonode.anode.net if ((tonode.anode.node = myaddress.node) & (tonode.anode.net = myaddress.net)) then do tonode.net = myaddress.pointnet tonode.node = tonode.anode.point end say "Packet Address" tonode.net||"/"||tonode.node asfile = UPPER(d2x(65536+myaddress.net-tonode.net,4) , ||d2x(65536+myaddress.node-tonode.node,4) , ||right(bunname,4)) detailnode=AddWorkName(work_detail,bunname,asfile,DT_DELETE) ChangeDetailPri(work_detail,detailnode,tonode.anode.pri) END call DumpOutbound(outbound) END say Options Failat 21 Address Command 'rename' PACKETS||"#?.(D|C|H)UT" BUNDLES||"temps/none/" Options Failat 10 Address Command 'list >t:jbun.tmp' BUNDLES||"temps/none/#?.(?UT|PKT) QUICK NOHEAD" if EXISTS(PACKETS||"pkts") < 1 then Address Command 'makedir' PACKETS||"pkts" x=Open('none',"t:jbun.tmp",'R') if x=0 then Exit 1 do forever Line = Upper(strip(space(ReadLn('none'),1),'B')) if EOF('none') then Leave if left(line,1) = ":" then Leave Say "Processing" Line node.pri = 1 node.domain = "FidoNet" Parse var Line node.zone"."node.net"."node.node"."node.point"."junk if Left(junk,1)= "C" then node.pri = DTPRI_CRASH+1 if Left(junk,1)= "H" then node.pri = DTPRI_HOLD+1 if Left(junk,1)= "D" then node.pri = DTPRI_DIRECT+1 work_detail = FindDetail(node) call ScanDetail(work_detail, huge_list) if huge_list.numnodes > 0 then DO Do i = 1 until i = huge_list.numnodes if Exists(huge_list.i.filename) then DO detailnode = AddworkName(work_detail,huge_list.i.filename,huge_list.i.asname,huge_list.i.flags) changedetailpri(work_detail,detailnode,huge_list.i.pri) END END END clock = time('Normal') magicnum = substr(date('Normal'),1,2) || substr(clock,1,2) || substr(clock,4,2) || substr(clock,7,2) asfile = magicnum||".pkt" Address Command 'rename' BUNDLES||"temps/none/"||Line PACKETS||"pkts/"||asfile Address Command 'filenote' PACKETS||"pkts/"||asfile Line detailnode = AddWorkName(work_detail,PACKETS||"pkts/"||asfile,asfile, DT_DELETE) changedetailpri(work_detail,detailnode,node.pri) call DumpOutBound(outbound) END x=Close('none') /* Address Command 'delete >nil: t:jbun.tmp' */ say say 'JBundle Finished!' say /* We're outa here! */ exit