X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=tools%2Fdhcp-test.c;h=a6c3e9931d4d0f3de9fd6f3d062d3eda82a1fdd2;hb=b397386967c5057c4dcf73f63f7ffa16141efea4;hp=1fbf1f9da8c4058b12d55d57e0e49066324218a5;hpb=fe57f3b830d591f0771229ae91f7eb04fdb9c3fb;p=platform%2Fupstream%2Fconnman.git diff --git a/tools/dhcp-test.c b/tools/dhcp-test.c old mode 100644 new mode 100755 index 1fbf1f9..a6c3e99 --- a/tools/dhcp-test.c +++ b/tools/dhcp-test.c @@ -2,7 +2,7 @@ * * Connection Manager * - * Copyright (C) 2007-2010 Intel Corporation. All rights reserved. + * Copyright (C) 2007-2012 Intel Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -33,10 +33,11 @@ #include #include #include -#include #include +#include "../src/connman.h" + static GTimer *timer; static GMainLoop *main_loop; @@ -102,7 +103,7 @@ static void lease_available_cb(GDHCPClient *dhcp_client, gpointer user_data) address = g_dhcp_client_get_address(dhcp_client); printf("address %s\n", address); - if (address == NULL) + if (!address) return; option_value = g_dhcp_client_get_option(dhcp_client, G_DHCP_SUBNET); @@ -143,7 +144,7 @@ int main(int argc, char *argv[]) printf("Create DHCP client for interface %d\n", index); dhcp_client = g_dhcp_client_new(G_DHCP_IPV4, index, &error); - if (dhcp_client == NULL) { + if (!dhcp_client) { handle_error(error); exit(0); } @@ -170,15 +171,19 @@ int main(int argc, char *argv[]) timer = g_timer_new(); - g_dhcp_client_start(dhcp_client); + g_dhcp_client_start(dhcp_client, NULL); memset(&sa, 0, sizeof(sa)); sa.sa_handler = sig_term; sigaction(SIGINT, &sa, NULL); sigaction(SIGTERM, &sa, NULL); + __connman_util_init(); + g_main_loop_run(main_loop); + __connman_util_cleanup(); + g_timer_destroy(timer); g_dhcp_client_unref(dhcp_client);