Skip to content
Snippets Groups Projects
Commit da311c73 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Don't use alert() or write() to make this suitable for a web service

Also close the syncterm.lst file so we can read it completely after
load()ing this script.
parent c9320a81
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
...@@ -18,7 +18,7 @@ for(var i in nodelist.entries) { ...@@ -18,7 +18,7 @@ for(var i in nodelist.entries) {
if(entry.down) if(entry.down)
continue; continue;
if(!entry.flags) { if(!entry.flags) {
alert("No flags for " + entry.name); log("No flags for " + entry.name);
continue; continue;
} }
var inet_address = entry.flags.INA; var inet_address = entry.flags.INA;
...@@ -27,7 +27,7 @@ for(var i in nodelist.entries) { ...@@ -27,7 +27,7 @@ for(var i in nodelist.entries) {
if(typeof inet_address != "string") if(typeof inet_address != "string")
inet_address = entry.flags.IBN; inet_address = entry.flags.IBN;
if(typeof inet_address != "string") { if(typeof inet_address != "string") {
alert("No Telnet address available for " + entry.addr + " " + entry.name); log("No Telnet address available for " + entry.addr + " " + entry.name);
continue; continue;
} }
var colon = inet_address.indexOf(':'); var colon = inet_address.indexOf(':');
...@@ -39,11 +39,11 @@ for(var i in nodelist.entries) { ...@@ -39,11 +39,11 @@ for(var i in nodelist.entries) {
var lst = new File(syncterm_listfile); var lst = new File(syncterm_listfile);
if(!lst.open("w")) { if(!lst.open("w")) {
alert("Error " + lst.error + " opening " + lst.name); log("Error " + lst.error + " opening " + lst.name);
exit(1); exit(1);
} }
lst.writeln("; Exported from " + file_getname(nodelist_filename) + " on " + new Date().toString()); lst.writeln("; Exported " + nodelist.entries.length + " from " + file_getname(nodelist_filename) + " on " + new Date().toString());
lst.writeln(); lst.writeln();
var exported = 0; var exported = 0;
for(var i in out) { for(var i in out) {
...@@ -68,4 +68,6 @@ for(var i in out) { ...@@ -68,4 +68,6 @@ for(var i in out) {
lst.writeln("\tComment=" + comment); lst.writeln("\tComment=" + comment);
exported++; exported++;
} }
print("Exported " + exported + " entries to " + syncterm_listfile); log("Exported " + exported + " entries to " + syncterm_listfile);
lst.close();
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment