home *** CD-ROM | disk | FTP | other *** search
/ ftp.wwiv.com / ftp.wwiv.com.zip / ftp.wwiv.com / pub / MISC / TGARTS.ZIP / SAMPLE.ZIP / TGLAST.PAS < prev    next >
Pascal/Delphi Source File  |  1998-12-19  |  3KB  |  77 lines

  1.  
  2. Program TGLast;
  3.  
  4. Uses Crt, dtime;
  5.  
  6. {$I telegard.inc}
  7.  
  8. Var Last_File : File of Lcallers;
  9.     Last_Rec  : Lcallers;
  10.     Filename  : String;
  11.  
  12. Procedure ReaD_Laston;
  13. Begin
  14.    Assign(Last_File, 'Laston.dat');
  15.    Reset(Last_File);
  16.    Read(Last_File, Last_Rec);
  17.    Close(Last_File)
  18. end;
  19.  
  20. Procedure Make_Bulletin;
  21. Var BullFile : Text;
  22.     Cnum,Temp,temp2: String;
  23.     ldt : datetimerec;
  24. Begin
  25.   {Make a bulletin ouf ot the data (does not use all laston.dat fields}
  26.   Assign(BullFile, Filename+'.msg');
  27.   Rewrite(Bullfile); {Overwrites a file BE WARNED}
  28.   Writeln(BullFile, '`0E=-------------------------------------------=');
  29.   Writeln(BullFile, '`0F           Telegard''s Last Caller      ');
  30.   Writeln(BullFile, '`0D The last caller was : `0F'+last_rec.handle);
  31.   Str(last_rec.caller, cnum);
  32.   Writeln(BullFile, '`0E Caller #: `0F'+cnum+'`0E Real Name : `0D'+last_rec.realname);
  33.   Writeln(Bullfile, '`0C From: '+last_rec.location);
  34.   Str(last_rec.logonspeed, temp);
  35.  
  36.   unix2dt(last_rec.logontime, ldt);
  37.   Writeln(Bullfile, '`0F');
  38.   str(ldt.day,temp);   str(ldt.year,temp2);
  39.   Temp := 'User called on '+dlong[ldt.dow]+' '+mlong[ldt.month]+' '+temp+', '
  40.           +temp2+'.';
  41.   {This string takes apart the unixdate with a routine in the Dtime.pas
  42.    unit and I form the string together.  You could use more items like
  43.    the hour and such however}
  44.   Writeln(Bullfile, '`0B'+temp);
  45.   Writeln(Bullfile, '`0E=-------------------------------------------=');
  46.   Close(Bullfile);
  47. end;
  48.  
  49. Procedure Check_Input;
  50. Begin
  51.   IF paramcount=0 then
  52.   Begin
  53.     Clrscr;Gotoxy(10,12);Textcolor(12);
  54.     Writeln('Error: Supply a filename with the program');
  55.     Writeln('Example TGLAST laston.msg');
  56.     Writeln('This creates the bulletin you supply');
  57.     Writeln('Through the command line TGLAST filename');
  58.     Writeln('Do NOT supply the extension, one of .msg will be given');
  59.     Writeln('Use a full drive and directory if you wish to place it elsewhere');
  60.     Writeln('Example c:\tg\text\laston.msg');
  61.     Writeln;Textcolor(10);
  62.     Writeln('*** Execution of program aborted ***');
  63.     Halt;
  64.   end;
  65.   If paramcount=1 then Filename := paramstr(1);
  66.   {No error checking for the filename like digits and such be advised}
  67. end;
  68.  
  69. Begin
  70.   Check_Input;
  71.   Read_LastOn;
  72.   Make_Bulletin;
  73.   Writeln(paramstr(1)+'.msg has been created! Move it to your \text directory');
  74.   Writeln('to view online as a command or use a utilitiy like Tgtype.exe to view it.');
  75. end.
  76.  
  77.