summaryrefslogtreecommitdiff
path: root/tests/rdns-test.c
blob: b5fa0be0ea778196e00eb02ce479a7ded3613ca1 (plain)
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
/* -*- 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_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;
    }
}