/* -*- 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 static void callback (const LacAddress *addr, gpointer data, const GError *err) { gchar *name = data; g_print ("%s: ", name); if (err) { g_print (" (%p) ", err->message); g_print ("%s\n", err->message); } else { g_print ("%s\n", lac_address_to_string (addr)); } } int main (int argc, char *argv[]) { int i; GMainLoop *main_loop; lac_set_verbose (TRUE); if (argc > 1) { for (i = 1; i < argc; ++i) lac_address_new_lookup_from_name (argv[i], callback, argv[i]); } else { g_print ("usage %s \n", argv[0]); return 1; } main_loop = g_main_loop_new (NULL, TRUE); g_assert (main_loop); g_main_loop_run (main_loop); return 0; }