1000 REM Convert the output from pathalias to a Jnet (tm Joiner Associates) 1010 REM format routing table. 1020 REM V1.0-00 - 10-Mar-90 - tmk - Original coding 1025 REM V1.0-01 - 16-Apr-90 - tmk - Fix assorted problems with aliases 1030 REM 1040 REM First convert the pathalias map to an indexed file 1050 REM 1060 adjnode$ = "" 1070 numnodes = 0 1080 print "Preprocessing the map file:" 1090 map (pathsfile) string nodename$ = 8%, nextnode$ = 8%, hops$ = 4% 1100 on error goto 1660 1110 kill "PATOJNET.TMP" 1120 on error goto 1670 1130 open "NETMAP" for input as file #1%, & recordtype any, & recordsize 4096% 1140 on error goto 1680 1150 open "PATOJNET.TMP" as file #2%, & organization indexed, & recordsize 20%, & map pathsfile, & primary key nodename$, & extendsize 127%, & temporary 1160 on error goto 0 1170 REM Special-case the local host as it needs no links or routes, and is 1180 REM always first in the output map file. 1190 input line #1%, rawrecord$ & \ thishost$ = edit$(left(rawrecord$, instr(1%, rawrecord$, & chr$(9%)) - 1%), 32%) & \ nodename$ = thishost$ & \ nextnode$ = thishost$ & \ hops$ = "0001" & \ put #2% & \ numnodes = numnodes + 1 1200 on error goto 1690 1210 input line #1%, rawrecord$ 1220 on error goto 0 1230 hops% = 0% & \ i% = 1% 1240 j% = instr(i%, rawrecord$, "!") \ goto 1250 if j% = 0% & \ i% = j% + 1% & \ hops% = hops% + 1% & \ goto 1240 1250 i% = instr(1%, rawrecord$, chr$(9%)) & \ j% = instr(1%, rawrecord$, "!") & \ nodename$ = edit$(left(rawrecord$, i% - 1%) + space$(9% - i%), 32%) & \ nextnode$ = edit$(mid(rawrecord$, i% + 1%, j% - i% - 1%) + & space$(9% - j% - i%), 32%) & \ hops$ = mid(str$(hops% + 10000%), 2%, 4%) & \ goto 1260 if hops% > 1% & \ adjnode$ = adjnode$ + "," + nodename$ & \ nextnode$ = thishost$ if nextnode$ = " " & \ adjnode$ = adjnode$ + " (alias for " + nextnode$ + ")" if & nodename$ <> nextnode$ & \ hops$ = "0001" if hops% = 0% 1260 mapvers$ = nodename$ if left(nodename$, 5%) = "LINKS" 1270 versvers$ = nodename$ if left(nodename$, 4%) = "VERS" 1280 on error goto 1700 1290 put #2% & \ numnodes = numnodes + 1 1300 on error goto 0 1310 print num1$(numnodes); " "; if numnodes/100 = int(numnodes/100) 1320 goto 1200 1330 close #1% 1340 REM Now we have the pathalias map loaded, apply the information to 1350 REM the BITNET.LINKS file and generate the NETINIT file. First we 1360 REM need to check for a version match between the files. 1370 REM 1380 print num1$(numnodes); " [done]" & \ print "Checking versions:" 1390 on error goto 1710 1400 open "BITNET:BITNET.LINKS" for input as file #1%, & recordtype any 1410 on error goto 0 1420 linkvers$ = "" 1430 on error goto 1720 1440 input line #1%, rawrecord$ & \ goto 1440 if mid(rawrecord$, 6%, 5%) <> "LINKS" & \ linkvers$ = mid(rawrecord$, 6%, 8%) & \ goto 1460 1450 on error goto 0 & \ goto 1460 if len(linkvers$) = 8% & \ print "%PATOJNET-E-VERNOTPRES, missing version information in "; & "BITNET.LINKS file" & \ goto 1750 1460 goto 1470 if linkvers$ = mapvers$ & \ print "%PATOJNET-E-VERSERR, BITNET.LINKS file version "; linkvers$; & " does not match map file version "; mapvers$ & \ goto 1750 1470 \ print "[ok]" & \ print "Generating routing database:" & \ numnodes = 0 & \ outfile$ = thishost$ + ".NETINIT" & \ open outfile$ for output as file #3%, & organization sequential variable 1480 stars$ = "!" + string$(68%, ascii("*")) & \ skip$ = "!" + space$(67%) + "*" 1490 print #3%, stars$ & \ print #3%, "! JNET ROUTING STATEMENTS FOR NODE "; thishost$; & space$(31% - len(thishost$)) + "*" & \ print #3%, skip$ & \ print #3%, "! Nodes file update level: EARN - "; versvers$; & space$(19%); "*" & \ print #3%, "!"; space$(31%); "BITNET - "; linkvers$; space$(19%); & "*"; & \ print #3%, skip$ & \ print #3%, "! Generation date: "; date$(0%); " "; time$(0%); & space$(26%); "*" & \ print #3%, skip$ & \ print #3%, stars$ 1500 print #3%, "!"; space$(22%); "LIST OF ADJACENT NODES"; space$(23%) ;"*" \ print #3%, skip$ 1510 goto 1530 if len(adjnode$) < 2% & \ for i% = len(adjnode$) to 1% step -1% & \ goto 1520 if mid(adjnode$, i%, 1%) = "," & \ next i% 1520 i$ = mid(adjnode$, i% + 1%, len(adjnode$)) & \ adjnode$ = mid(adjnode$, 1%, i% - 1%) & \ print #3%, "! "; i$; space$(66% - len(i$)); "*" & \ goto 1510 1530 print #3%, skip$ & \ print #3%, stars$ & \ print #3%, "!"; space$(21%); "JNET ROUTE SPECIFICATIONS"; & space$(21%); "*" & \ print #3%, stars$ & \ print #3%, "!"; space$(31%); "Interm."; space$(29%); "*" & \ print #3%, "!"; space$(33%); "(|) Country"; space$(23%); "*" & \ print #3%, "! Node Vianode Nodes| Institute/"; & "Location *" & \ print #3%, "!------|---------------|-----------|--|--|---------"; & "-----------------*" 1540 close #1% & \ open "BITNET:BITNET.LINKS" for input as file #1%, & recordtype any 1550 on error goto 1730 1560 input line #1%, rawrecord$ & \ goto 1560 if left(rawrecord$, 1%) = "*" 1570 on error goto 0 1580 blnodename$ = mid(rawrecord$, 6%, 8%) & \ for i% = len(rawrecord$) to 1% step -1% & \ goto 1590 if mid(rawrecord$, i%, 1%) = "," & \ next i% 1590 blcountry$ = mid(rawrecord$, i% + 2%, 2%) & \ bldescrip$ = left(rawrecord$, i% - 1%) & \ bldescrip$ = left(rawrecord$, i% - 5%) if mid(rawrecord$, i%, 3%) = & mid(rawrecord$, i% - 4%, 3%) & ! The above is due to duplication of country info in BITNET.LINKS & ! (some sort of administrative error). For example: Foo Univ, US, US 1600 bldescrip$ = mid(bldescrip$, 25%, len(bldescrip$)) & \ if len(bldescrip$) > 30% then bldescrip$ = left(bldescrip$, 30%) 1610 on error goto 1740 1620 get #2%, key #0% eq blnodename$ & \ numnodes = numnodes + 1 & \ print num1$(numnodes); " "; if numnodes/100 = int(numnodes/100) & \ goto 1550 if hops$ = "0001" & ! Skip adjacent node(s) and/or alias(es) 1630 on error goto 0 1640 ehops$ = mid(hops$, 3%, 2%) & \ ehops$ = " " + mid(hops$, 4%, 1%) if mid(hops$, 3%, 1%) = "0" \ print #3%, "DEFINE "; blnodename$; " /ROUTE="; nextnode$; " !("; & ehops$; ") "; blcountry$; ","; bldescrip$ & \ goto 1550 1650 close #3% & \ print num1$(numnodes); " [done]" & \ print "Table generation complete. Results in "; outfile$ \ goto 1750 1660 resume 1120 1670 print "%PATOJNET-E-NOMAPFILE, unable to open map file" & \ resume 1760 1680 print "%PATOJNET-E-WRKFILERR, unable to open temporary work file" & \ close #1% & \ resume 1760 1690 resume 1330 1700 print "" & \ print "%PATOJNET-E-DUPLNODE, duplicate node '"; nodename$; & "' in database" & \ resume 1750 1710 print "%PATOJNET-E-NOLINKFILE, unable to open BITNET:BITNET.LINKS" & \ close #2% & \ resume 1760 1720 resume 1450 1730 resume 1650 1740 print "" & \ print "%PATOJNET-W-NOROUTE, no route for node "; blnodename$; & ", node skipped" & \ resume 1550 1750 close #1% & \ close #2% & \ resume 1760 1760 end