1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
/*
Test program for the neon resolver interface
Copyright (C) 2002-2003, Joe Orton <joe@manyfish.co.uk>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "config.h"
#include <stdio.h>
#include "ne_socket.h"
int main(int argc, char **argv)
{
ne_sock_addr *addr;
char buf[256];
int ret = 0;
if (argc < 2) {
printf("Usage: %s hostname\n", argv[0]);
return 1;
}
if (ne_sock_init()) {
printf("%s: Failed to initialize socket library.\n", argv[0]);
return 1;
}
addr = ne_addr_resolve(argv[1], 0);
if (ne_addr_result(addr)) {
printf("Could not resolve `%s': %s\n", argv[1],
ne_addr_error(addr, buf, sizeof buf));
ret = 2;
} else {
const ne_inet_addr *ia;
printf("Resolved `%s' OK:", argv[1]);
for (ia = ne_addr_first(addr); ia; ia = ne_addr_next(addr)) {
printf(" <%s>", ne_iaddr_print(ia, buf, sizeof buf));
}
putchar('\n');
}
ne_addr_destroy(addr);
return ret;
}
|