~ubuntu-branches/ubuntu/dapper/fpc/dapper

« back to all changes in this revision

Viewing changes to packages/base/netdb/testnet.pp

  • Committer: Bazaar Package Importer
  • Author(s): Carlos Laviola
  • Date: 2004-08-12 16:29:37 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20040812162937-moo8ulvysp1ln771
Tags: 1.9.4-5
fp-compiler: needs ld, adding dependency on binutils.  (Closes: #265265)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{
 
2
    $Id: testnet.pp,v 1.2 2003/05/17 20:54:03 michael Exp $
 
3
    This file is part of the Free Pascal run time library.
 
4
    Copyright (c) 2003 by the Free Pascal development team
 
5
 
 
6
    test netdb unit, network part
 
7
    
 
8
    See the file COPYING.FPC, included in this distribution,
 
9
    for details about the copyright.
 
10
 
 
11
    This program is distributed in the hope that it will be useful,
 
12
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
14
 
 
15
 **********************************************************************}
 
16
program testhst;
 
17
 
 
18
uses netdb;
 
19
 
 
20
Procedure DumpNetEntry(Const N : TNetworkEntry);
 
21
 
 
22
begin
 
23
  With N do
 
24
    begin
 
25
    Writeln('Name     : ',Name);
 
26
    Writeln('Addr     : ',HostAddrToStr(Addr));
 
27
    Writeln('Aliases  : ',Aliases);
 
28
    Writeln;
 
29
    end;
 
30
end;
 
31
 
 
32
Procedure TestAddr(Addr : string);
 
33
 
 
34
Var
 
35
  N : TNetworkEntry;
 
36
 
 
37
begin
 
38
  If GetNetworkByAddr(StrToHostAddr(Addr),N) then
 
39
    DumpNetEntry(N)
 
40
  else
 
41
    Writeln('No entry for address ',Addr)  
 
42
end;
 
43
 
 
44
Procedure TestName(Const Net : string);
 
45
 
 
46
Var
 
47
  N : TNetworkEntry;
 
48
 
 
49
begin
 
50
  If GetNetworkByName(Net,N) then
 
51
    DumpNetEntry(N)
 
52
  else
 
53
    Writeln('No entry for netname ',Net)  
 
54
end;
 
55
 
 
56
begin
 
57
  testaddr('127.0.0.0');
 
58
  testname('loopback');
 
59
end.
 
60
 
 
61
{
 
62
  $Log: testnet.pp,v $
 
63
  Revision 1.2  2003/05/17 20:54:03  michael
 
64
  + uriparser unit added. Header/Footer blocks added
 
65
 
 
66
}