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