home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR10 / TLXTW110.ZIP / TWASTLOG.SLT < prev    next >
Text File  |  1993-08-22  |  4KB  |  99 lines

  1. // twastlog.slt
  2. //
  3. // Extracts WARNING: No known info for port message
  4. // from twassist.log and writes it to the file defined in outfile[].
  5. //
  6. //  Note: I was using the "Notes" feature in TWAssist to make notes
  7. //  about the blocked ports, but in some certain games they filled up
  8. //  fast.  So I wrote this script to store that info in a seperate file.
  9. //  This is optional, this is called from Twlogoff.slc
  10.  
  11. int     dr, f, h, i, x, y,
  12.         outf,
  13.         old_chk_key,
  14.         statline, statline_color;
  15. str
  16.         f1[64],
  17.         outfile[] = "no_info.prt",
  18.         drs[3],
  19.         buf[128],
  20.         bbsname[8], shortname[3], stuff_buffer[45];
  21. main()
  22. {
  23. update_term();
  24. int old_chk_key; old_chk_key=_scr_chk_key; _scr_chk_key=0;
  25. if (carrier()) ustamp("++ TLXTW : Twastlog ONline  - ", 1, 0);
  26. else ustamp("++ TLXTW : Twastlog OFFline - ", 1, 0); ustamp( _entry_name, 0, 1 );
  27. ///////////////////////////////////////////////////////////////////////////////
  28. //                          Environment Variables
  29. if (getenv("Telix", f1 ) < 1){ soft_wind("^"TELIX^" environment variable not found", 25); _scr_chk_key=1; return(-1); }
  30. if (getenv("f1", f1)  < 1) { soft_wind("F1 environment variable not found",25);  _scr_chk_key=1; return(-1); }
  31. i = strlen(f1); if (subchr(f1, i - 1) != '\') copystr("\", f1, i, 1);
  32. if (getenv("dr", drs) < 1) { soft_wind("DR environment variable not found", 25); _scr_chk_key=1; return(-1); }
  33. dr = stoi(drs);
  34. if (_entry_name == "") if (call("bbsname") == -1) { _scr_chk_key = 1; return(-1); }
  35. bbsname = _entry_name; fill_spaces();
  36. strcat(f1, bbsname); strcat(f1, "\");
  37. subchrs(bbsname, 0, 3, shortname);
  38. newdir(f1);
  39. strcat(f1, "twassist.log");
  40. if (filefind(f1, 0) > 0)
  41. 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);  }
  42. if (( outf = fopen( outfile, "a+" ) ) == 0 ){ fclearerr(f);soft_wind(" Error opening file", 15);soft_wind(outf, 40); _scr_chk_key = 1; return(-1);  }
  43.  
  44. while(!feof(f) && inkey() != 27 )
  45. {
  46.  buf="";
  47.  fgets(buf, 128, f);
  48.  i=strpos(buf, "WARNING: No info for known port in sector", 0);
  49.  if (i > -1)
  50.   {
  51.     date( curtime() , stuff_buffer );
  52.     fputs( stuff_buffer, outf ); fputs( "│ ", outf );
  53.     substr( buf, i, strlen(buf), stuff_buffer );
  54.     fputs( stuff_buffer, outf ); fputs("^M^J", outf );
  55.     prints(""); pstra( stuff_buffer ,  2 );
  56.   }
  57. }
  58. fclose( outf );
  59.  fclose(f);
  60.  if (( f = filesize( outfile )) == 0 ) fdelete( outfile );
  61.  newdir( _telix_dir );
  62. _scr_chk_key=old_chk_key; return;
  63. }
  64. //////////////////////////////////////////////////////////////////////////////
  65. //                         Soft Wind
  66. soft_wind(str message, int duration)
  67. {
  68.  old_chk_key = _scr_chk_key;  _scr_chk_key = 0;
  69.  int l, h, x, y, key = 0, ts;
  70.                   cursor_onoff(0);
  71.                   x=getx(); y=gety();
  72.                   l = strlen(message)/2;
  73.                   h = vsavearea(37-l, 10, 43+l, 14);
  74.                   box(37-l, 10, 43+l, 14, 3, 0, 5 );
  75.                   pstraxy(message, 40-l  , 12, 11 );
  76.                   ts = timer_start(duration);
  77.                   while( !key && !time_up(ts)) key=inkey();
  78.                   vrstrarea(h);
  79.                   cursor_onoff(1);
  80.                   gotoxy(x,y);
  81.                   timer_free(ts);
  82.                   _scr_chk_key = old_chk_key;
  83.                   if (key > 0) return key;
  84.                   return key;
  85. }
  86. //////////////////////////////////////////////////////////////////////////////
  87. fill_spaces()           // Filters out characters illegal in DOS filenames.
  88. {
  89. int i, count = 0; str chr[1];
  90. while (count < 6)
  91. {    if (count == 0) chr = ".";
  92. else if (count == 1) chr = "+";else if (count == 2) chr = " ";
  93. else if (count == 3) chr = "?";else if (count == 4) chr = "*";
  94. else if (count == 5) chr = "/";
  95. i=0; while (1)
  96.  {  i = strpos(bbsname, chr, i);
  97.     if (i == -1) break; setchr(bbsname, i ,'_'); i=i+1; }++count; } return; }
  98. ///////////////////////////////////////////////////////////////////////////////
  99.