home *** CD-ROM | disk | FTP | other *** search
/ Troubleshooting Netware Systems / CSTRIAL0196.BIN / attach / pcc / v08n03 / netwrk.exe / FAXBAT13.ZIP / LOGMON.PAS < prev    next >
Pascal/Delphi Source File  |  1994-04-27  |  1KB  |  49 lines

  1. {$I-}   {File error checking must be off.}
  2.  
  3. {    Program to monitor the log file from QL2FAX and set the error level
  4.      appropriately.  -  Peter Summers  24 Apr 94 }
  5.  
  6. program logmon;
  7.  
  8. uses crt;
  9.  
  10. const
  11.   logfilename = 'c:\ql2fax\faxsend.log';
  12.   index    : byte = 1;
  13.   tabcount : byte = 0;
  14.  
  15. var
  16.   logfile : text;
  17.   line    : string;
  18.  
  19.   begin
  20.     assign(logfile,logfilename);
  21.  
  22.     repeat
  23.       writeln('Trying to open '+logfilename+', Press Esc key to quit.');
  24.       if keypressed and (readkey=chr(27)) then halt(1);
  25.       reset(logfile);
  26.       delay(10000);
  27.     until IOResult=0;
  28.  
  29.     readln(logfile,line);
  30.     if (IOResult<>0) then
  31.       begin
  32.         writeln('Can''t read from '+logfilename+'.');
  33.         halt(2);
  34.       end;
  35.  
  36.     repeat
  37.       if line[index]=chr(9) then tabcount := tabcount + 1;
  38.       index := index + 1;
  39.     until (tabcount=8) or (index>length(line));
  40.  
  41.     if line[index]='E' then
  42.       begin
  43.         writeln('Fax log indicates error in sending fax.');
  44.         halt(3);
  45.       end;
  46.  
  47.     writeln('Fax log indicates fax sent correctly.');
  48.     halt(0);
  49.   end.