6 #include "libsoup/soup-address.h"
8 static GMainLoop *loop;
9 static int nlookups = 0;
12 resolve_callback (SoupAddress *addr, guint status, gpointer data)
14 if (status == SOUP_STATUS_OK) {
15 printf ("Name: %s\n", soup_address_get_name (addr));
16 printf ("Address: %s\n", soup_address_get_physical (addr));
18 printf ("Name: %s\n", soup_address_get_name (addr));
19 printf ("Error: %s\n", soup_status_get_phrase (status));
25 g_main_loop_quit (loop);
31 fprintf (stderr, "Usage: dns hostname ...\n");
36 main (int argc, char **argv)
47 for (i = 1; i < argc; i++) {
48 addr = soup_address_new (argv[i], 0);
50 fprintf (stderr, "Could not parse address %s\n", argv[1]);
54 soup_address_resolve_async (addr, NULL, NULL,
55 resolve_callback, NULL);
59 loop = g_main_loop_new (NULL, TRUE);
61 g_main_loop_unref (loop);