home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
High Voltage Shareware
/
high1.zip
/
high1
/
DIR10
/
TLXTW110.ZIP
/
TWASTLOG.SLT
< prev
next >
Wrap
Text File
|
1993-08-22
|
4KB
|
99 lines
// twastlog.slt
//
// Extracts WARNING: No known info for port message
// from twassist.log and writes it to the file defined in outfile[].
//
// Note: I was using the "Notes" feature in TWAssist to make notes
// about the blocked ports, but in some certain games they filled up
// fast. So I wrote this script to store that info in a seperate file.
// This is optional, this is called from Twlogoff.slc
int dr, f, h, i, x, y,
outf,
old_chk_key,
statline, statline_color;
str
f1[64],
outfile[] = "no_info.prt",
drs[3],
buf[128],
bbsname[8], shortname[3], stuff_buffer[45];
main()
{
update_term();
int old_chk_key; old_chk_key=_scr_chk_key; _scr_chk_key=0;
if (carrier()) ustamp("++ TLXTW : Twastlog ONline - ", 1, 0);
else ustamp("++ TLXTW : Twastlog OFFline - ", 1, 0); ustamp( _entry_name, 0, 1 );
///////////////////////////////////////////////////////////////////////////////
// Environment Variables
if (getenv("Telix", f1 ) < 1){ soft_wind("^"TELIX^" environment variable not found", 25); _scr_chk_key=1; return(-1); }
if (getenv("f1", f1) < 1) { soft_wind("F1 environment variable not found",25); _scr_chk_key=1; return(-1); }
i = strlen(f1); if (subchr(f1, i - 1) != '\') copystr("\", f1, i, 1);
if (getenv("dr", drs) < 1) { soft_wind("DR environment variable not found", 25); _scr_chk_key=1; return(-1); }
dr = stoi(drs);
if (_entry_name == "") if (call("bbsname") == -1) { _scr_chk_key = 1; return(-1); }
bbsname = _entry_name; fill_spaces();
strcat(f1, bbsname); strcat(f1, "\");
subchrs(bbsname, 0, 3, shortname);
newdir(f1);
strcat(f1, "twassist.log");
if (filefind(f1, 0) > 0)
f = fopen(f1, "r"); if(ferror(f)){ fclearerr(f);soft_wind(" Error opening file", 15);soft_wind(f1, 40); _scr_chk_key = 1; return(-1); }
if (( outf = fopen( outfile, "a+" ) ) == 0 ){ fclearerr(f);soft_wind(" Error opening file", 15);soft_wind(outf, 40); _scr_chk_key = 1; return(-1); }
while(!feof(f) && inkey() != 27 )
{
buf="";
fgets(buf, 128, f);
i=strpos(buf, "WARNING: No info for known port in sector", 0);
if (i > -1)
{
date( curtime() , stuff_buffer );
fputs( stuff_buffer, outf ); fputs( "│ ", outf );
substr( buf, i, strlen(buf), stuff_buffer );
fputs( stuff_buffer, outf ); fputs("^M^J", outf );
prints(""); pstra( stuff_buffer , 2 );
}
}
fclose( outf );
fclose(f);
if (( f = filesize( outfile )) == 0 ) fdelete( outfile );
newdir( _telix_dir );
_scr_chk_key=old_chk_key; return;
}
//////////////////////////////////////////////////////////////////////////////
// Soft Wind
soft_wind(str message, int duration)
{
old_chk_key = _scr_chk_key; _scr_chk_key = 0;
int l, h, x, y, key = 0, ts;
cursor_onoff(0);
x=getx(); y=gety();
l = strlen(message)/2;
h = vsavearea(37-l, 10, 43+l, 14);
box(37-l, 10, 43+l, 14, 3, 0, 5 );
pstraxy(message, 40-l , 12, 11 );
ts = timer_start(duration);
while( !key && !time_up(ts)) key=inkey();
vrstrarea(h);
cursor_onoff(1);
gotoxy(x,y);
timer_free(ts);
_scr_chk_key = old_chk_key;
if (key > 0) return key;
return key;
}
//////////////////////////////////////////////////////////////////////////////
fill_spaces() // Filters out characters illegal in DOS filenames.
{
int i, count = 0; str chr[1];
while (count < 6)
{ if (count == 0) chr = ".";
else if (count == 1) chr = "+";else if (count == 2) chr = " ";
else if (count == 3) chr = "?";else if (count == 4) chr = "*";
else if (count == 5) chr = "/";
i=0; while (1)
{ i = strpos(bbsname, chr, i);
if (i == -1) break; setchr(bbsname, i ,'_'); i=i+1; }++count; } return; }
///////////////////////////////////////////////////////////////////////////////