1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 #include "test-utils.h"
5 static GMainLoop *loop;
6 static int nlookups = 0;
9 resolve_callback (SoupAddress *addr, guint status, gpointer data)
11 if (status == SOUP_STATUS_OK) {
12 g_print ("Name: %s\n", soup_address_get_name (addr));
13 g_print ("Address: %s\n", soup_address_get_physical (addr));
15 g_print ("Name: %s\n", soup_address_get_name (addr));
16 g_print ("Error: %s\n", soup_status_get_phrase (status));
20 g_object_unref (addr);
24 g_main_loop_quit (loop);
30 g_printerr ("Usage: dns hostname ...\n");
35 main (int argc, char **argv)
43 for (i = 1; i < argc; i++) {
44 addr = soup_address_new (argv[i], 0);
46 g_printerr ("Could not parse address %s\n", argv[1]);
50 soup_address_resolve_async (addr, NULL, NULL,
51 resolve_callback, NULL);
55 loop = g_main_loop_new (NULL, TRUE);
56 g_main_loop_run (loop);
57 g_main_loop_unref (loop);