diff options
Diffstat (limited to 'tests/dns2-test.c')
-rw-r--r-- | tests/dns2-test.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/tests/dns2-test.c b/tests/dns2-test.c new file mode 100644 index 0000000..03ffa20 --- /dev/null +++ b/tests/dns2-test.c @@ -0,0 +1,56 @@ +/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- */ + +/* Lac - Library for asynchronous communication + * Copyright (C) 2002 Søren Sandmann (sandmann@daimi.au.dk) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ +#include <lac.h> + +int +main (int argc, char *argv[]) +{ + int i; + LacAddress *addr; + + lac_set_verbose (TRUE); + + if (argc > 1) + { + for (i = 1; i < argc; ++i) + { + GError *err = NULL; + addr = lac_gethostbyname (argv[i], &err); + + if (!addr) + { + g_print ("%s: error (%s)\n", argv[i], err->message); + g_error_free (err); + } + else + { + g_print ("%s: %s\n", argv[i], lac_address_to_str (addr)); + lac_address_unref (addr); + } + } + return 0; + } + else + { + g_print ("usage %s <names>\n", argv[0]); + return 1; + } +} |