home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / lan / netcraft / nettest.pas < prev    next >
Pascal/Delphi Source File  |  1988-06-10  |  3KB  |  118 lines

  1. {$R+,S+,I-,D+,T+,F-,V-,B-,N-,L+ }
  2. {$M 32768,0,163840}
  3. program TestNetAPI;
  4.  
  5. uses DOS,NetCraft,NetServ,NetTTS;
  6.  
  7. type
  8.   Str40            = String[40];
  9.  
  10. const
  11.   DayNames         : Array[DayOfTheWeek] of Str9 = ('Sunday',
  12.                                                     'Monday',
  13.                                                     'Tuesday',
  14.                                                     'Wednesday',
  15.                                                     'Thursday',
  16.                                                     'Friday',
  17.                                                     'Saturday');
  18.   MonthNames       : Array[1..12] of Str9 =
  19.                      ('January','February','March',
  20.                       'April','May','June',
  21.                       'July','August','September',
  22.                       'October','November','December');
  23.  
  24. function WordToStr(W : Word) : Str40;
  25.  
  26. var
  27.   S                : Str40;
  28.  
  29. begin
  30.   Str(W,S);
  31.   WordToStr := S
  32. end;
  33.  
  34. function ZeroFillNum(W : Word) : Str9;
  35.  
  36. begin
  37.   if W < 10 then
  38.     ZeroFillNum := '0' + WordtoStr(W)
  39.   else
  40.     ZeroFillNum := WordToStr(W)
  41. end;
  42.  
  43. function FormatTime(Hour,Minute,Second : Word) : Str80;
  44.  
  45. begin
  46.   FormatTime :=  ZeroFillNum(Hour) + ':' + ZeroFillNum(Minute) + ':' +
  47.                 ZeroFillNum(Second);
  48. end;
  49.  
  50. function FormatDateTime(Year,Month,Day,Hour,Minute,Second : Word;
  51.                     WeekDay : DayOfTheWeek) : Str80;
  52. var
  53.   DayStr,MonthStr  : Str9;
  54.  
  55. begin
  56.   DayStr := DayNames[WeekDay];
  57.   MonthStr := MonthNames[Month];
  58.   FormatDateTime := DayStr + ' ' + MonthStr + ' ' +
  59.                     WordToStr(Day) + ', ' + WordToStr(Year) + '  ' +
  60.                     FormatTime(Hour,Minute,Second);
  61. end;
  62.  
  63. procedure ServerInfo;
  64.  
  65. var
  66.   Y,M,D,H,Min,S    : Word;
  67.   WeekDay          : DayOfTheWeek;
  68.   DateTime         : Str80;
  69.  
  70. begin
  71.  
  72.   GetServerDateTime(Y,M,D,H,Min,S,WeekDay);
  73.   DateTime := FormatDateTime(Y,M,D,H,Min,S,WeekDay);
  74.   WriteLn('The server says it is: ',DateTime);
  75.  
  76.   Write('Transaction tracking is ');
  77.   if not TTSAvailable then
  78.     Write('not ');
  79.   WriteLn('available.');
  80.   WriteLn('Connection Number of file server: ',ServerConnNo);
  81. end;
  82.  
  83. procedure WSInfo;
  84.  
  85. var
  86.   Y,M,D,H,Min,S,S100,WD
  87.                    : Word;
  88.   Major,Minor,Rev  : Byte;
  89.   S1,S2,S3         : Str10;
  90.   DateTime         : Str80;
  91.  
  92. begin
  93.  
  94.   GetDate(Y,M,D,WD);
  95.   GetTime(H,Min,S,S100);
  96.   WriteLn('This workstation says it is: ',
  97.           FormatDateTime(Y,M,D,H,Min,S,DayOfTheWeek(WD)));
  98.  
  99.   Write('This workstation ');
  100.   if ConsolePriv then
  101.     Write('has ')
  102.   else
  103.     Write('does not have ');
  104.   WriteLn('console privileges.');
  105.   WriteLn('Connection number of this workstation: ',GetConnNo);
  106. end;
  107.  
  108. begin
  109.   WriteLn('TestNet - A Program to test NetCraft!');
  110.   WriteLn('Version .5 6/10/88');
  111.   WriteLn;
  112.   WriteLn('SERVER INFO:');
  113.   ServerInfo;
  114.   WriteLn;
  115.   WriteLn('WORKSTATION INFO:');
  116.   WSInfo;
  117. end.
  118.