-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypeasc.js
84 lines (71 loc) · 1.52 KB
/
typeasc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// typeasc.js
// Convert plain-text with (optional) Synchronet attribute (Ctrl-A) codes to HTML
// $Id: typeasc.js,v 1.7 2009/02/10 09:53:06 deuce Exp $
load("sbbsdefs.js");
load("asc2htmlterm.js");
var f;
var title='';
var filename='';
var mode=P_NONE;
var i;
for(i in argv) {
if(filename=='') {
switch(argv) {
case '-noatcodes':
mode |= P_NOATCODES;
break;
case '-noabort':
mode |= P_NOABORT;
break;
case '-saveatr':
mode |= P_SAVEATR;
break;
case '-openclose':
mode |= P_OPENCLOSE;
break;
case '-nopause':
mode |= P_NOPAUSE;
break;
case '-nocrlf':
mode |= P_NOCRLF;
break;
default:
if(this.f==undefined) {
this.f = new File(file_getcase(argv[i]));
filename=this.f.name.replace(/^.*[\\\/]/,'');
}
}
}
else {
if(title.length)
title+=' ';
title+=argv[i];
}
}
if(this.f==undefined) {
print("usage: typeasc [-noatcodes|-noabort|-saveatr|-openclose|-nopause|-nocrlf] <filename> [HTML title]");
exit(1);
}
if(title=='')
title=filename;
if(user.settings & USER_HTML) {
if(!f.open("rb",true,f.length)) {
alert("Error " + errno + " opening " + f.name);
exit(errno);
}
var buf=f.read(f.length);
f.close();
console.clear(7);
buf=asc2htmlterm(buf,true,false, mode);
/* Disable autopause */
var os = bbs.sys_status;
bbs.sys_status |= SS_PAUSEOFF;
bbs.sys_status &= ~SS_PAUSEON;
console.write("\x08Done!");
console.write(buf);
bbs.sys_status=os;
if(!(mode & P_NOPAUSE))
console.getkey();
}
else
console.printfile(f.name, mode);