testsvc.pp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 2003 by the Free Pascal development team
  5. test netdb unit, services part
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. program testsvc;
  13. uses netdb;
  14. Procedure DumpServiceEntry(Const E : TserviceEntry);
  15. begin
  16. With E do
  17. begin
  18. Writeln('Name : ',Name);
  19. Writeln('Protocol : ',Protocol);
  20. Writeln('Port : ',Port);
  21. Writeln('Aliases : ',Aliases);
  22. Writeln;
  23. end;
  24. end;
  25. Procedure TestPort(P : Word; Const Proto : string);
  26. Var
  27. E : TServiceEntry;
  28. begin
  29. If GetServiceByPort(P,Proto,E) then
  30. DumpServiceEntry(E)
  31. else
  32. Writeln('No entry for port ',P)
  33. end;
  34. Procedure TestName(Const N,Proto : string);
  35. Var
  36. E : TServiceEntry;
  37. begin
  38. If GetServiceByName(N,Proto,E) then
  39. DumpServiceEntry(E)
  40. else
  41. Writeln('No entry for service ',N)
  42. end;
  43. begin
  44. testport(25,'');
  45. testport(23,'');
  46. testport(53,'udp');
  47. testname('mail','');
  48. testname('ftp','');
  49. testname('domain','udp');
  50. end.
  51. {
  52. $Log$
  53. Revision 1.2 2003-05-17 20:54:03 michael
  54. + uriparser unit added. Header/Footer blocks added
  55. }