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

Patch by @acn to include a non-interactive mode, fix point paths, and tic pw

parent 635c258d
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
#!/usr/bin/env -S jsexec -n
load("sbbsdefs.js");
load("uifcdefs.js");
load("fidocfg.js");
......@@ -209,7 +211,8 @@ function hatch_file(file, area, origin, replaces)
return false;
}
pw = sbbsecho.get_pw(link);
pw = sbbsecho.get_ticpw(FIDO.parse_addr(link).toString());
if (pw===undefined)
pw = '';
......@@ -226,6 +229,13 @@ function hatch_file(file, area, origin, replaces)
outb = sbbsecho.outbound.replace(/[\\\/]+$/g, '');
if (addr.zone !== defzone)
outb += format(".%03x", addr.zone);
if (addr.point !== undefined) {
outb += format("/%04x", addr.net);
outb += format("%04x", addr.node);
outb += ".pnt"
}
outb = fullpath(outb);
outb = backslash(outb);
......@@ -237,7 +247,7 @@ function hatch_file(file, area, origin, replaces)
}
tf.write('Area '+area+'\r\n');
tf.write('Origin '+origin+'\r\n');
tf.write('From '+system.fido_addr_list[0]+'\r\n');
tf.write('From '+origin+'\r\n');
tf.write('To '+link+'\r\n');
tf.write('File '+file.name+'\r\n');
if (file_getcase(file.path).length > file.path.length) {
......@@ -268,7 +278,11 @@ function hatch_file(file, area, origin, replaces)
tf.close();
// Create bsy file...
flobase = outb+format("%04x%04x", addr.net, addr.node);
if (addr.point !== undefined) {
flobase = outb+format("0000%04x", addr.point);
} else {
flobase = outb+format("%04x%04x", addr.net, addr.node);
}
bf = new File(flobase+'.bsy');
while (!bf.open('wxb+')) {
// TODO: This waits forever...
......@@ -294,7 +308,7 @@ function hatch_file(file, area, origin, replaces)
return true;
}
function main() {
function interactive() {
var file;
var area;
var origin;
......@@ -329,4 +343,92 @@ function main() {
}
}
function main() {
var dir;
var file;
var area;
var origin;
var replace;
for(var i = 0; i < argc; i++) {
var arg = argv[i];
if(arg[0] == '-') {
var opt = arg;
while(opt[0] == '-')
opt = opt.slice(1);
if(opt == "help" || opt == "?" || opt == "h") {
writeln("usage: hatchit.js [option]");
writeln("options:");
writeln(" -dir=<filedir> File directory Internal Code");
writeln(" -file=<filename> Name of file to hatch");
writeln(" -area=<areatag> File area of file to hatch");
writeln(" -origin=<FTN AKA> Origin FTN AKA");
writeln(" -replace File replaces older version");
writeln("");
writeln("If no option is given, HatchIT will start in interactive mode.");
exit(0);
}
if(opt.indexOf("dir=") == 0) {
var indir = opt.slice(4);
dir = file_area.dir[indir.toLowerCase()];
if (!dir) {
alert("File directory not found: " + indir);
exit(1);
}
continue;
}
if(opt.indexOf("area=") == 0) {
var inarea = opt.slice(5);
area = inarea.toUpperCase();
if (!tickit.acfg[inarea.toLowerCase()]) {
alert("File area not found: " + area);
exit(1);
}
continue;
}
if(opt.indexOf("file=") == 0) {
infile = opt.slice(5);
var fb = new OldFileBase(dir.code.toLowerCase());
fb.forEach(function(f) {
if (f.name == infile) {
file = f;
}
});
if (!file) {
alert("Cannot open file: " + infile);
exit(1);
}
continue;
}
if(opt.indexOf("origin=") == 0) {
origin = opt.slice(7);
if (system.fido_addr_list.indexOf(origin) == -1) {
alert("Origin is not in list of AKAs: " + origin);
exit(1);
}
continue;
}
if(opt.indexOf("replace") == 0) {
replace = true;
} else {
replace = false;
}
continue;
}
}
if (dir == undefined && area == undefined && file == undefined && origin == undefined && replace == undefined)
interactive()
writeln("File : " + file.name);
writeln("Area : " + area);
writeln("Origin : " + origin);
writeln("Desc : " + file.desc);
if (replace) writeln("Replace: yes");
else writeln("Replace: no");
if (file.extdesc) writeln("LDesc : " + file.extdesc);
hatch_file(file, area, origin, replace);
}
main();
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment