diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2010-07-28 11:50:42 -0700 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2010-07-28 11:50:42 -0700 |
commit | 4c1926e3c21240cc2658dc6696a44f304a5571e9 (patch) | |
tree | bdd6a7e7a3c6c3b7b4bb0c5150146d95c3ec7023 | |
parent | f3e66867ca3d87cc3f6610b9bab2bbf3a1ad5138 (diff) | |
download | connman-4c1926e3c21240cc2658dc6696a44f304a5571e9.tar.gz connman-4c1926e3c21240cc2658dc6696a44f304a5571e9.tar.bz2 connman-4c1926e3c21240cc2658dc6696a44f304a5571e9.zip |
Report human readable status information for resolver result
-rw-r--r-- | tools/resolv-test.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/tools/resolv-test.c b/tools/resolv-test.c index 6112406f..30a6554f 100644 --- a/tools/resolv-test.c +++ b/tools/resolv-test.c @@ -44,6 +44,30 @@ static void sig_term(int sig) g_main_loop_quit(main_loop); } +static const char *status2str(GResolvResultStatus status) +{ + switch (status) { + case G_RESOLV_RESULT_STATUS_SUCCESS: + return "success"; + case G_RESOLV_RESULT_STATUS_ERROR: + return "error"; + case G_RESOLV_RESULT_STATUS_NO_RESPONSE: + return "no response"; + case G_RESOLV_RESULT_STATUS_FORMAT_ERROR: + return "format error"; + case G_RESOLV_RESULT_STATUS_SERVER_FAILURE: + return "server failure"; + case G_RESOLV_RESULT_STATUS_NAME_ERROR: + return "name error"; + case G_RESOLV_RESULT_STATUS_NOT_IMPLEMENTED: + return "not implemented"; + case G_RESOLV_RESULT_STATUS_REFUSED: + return "refused"; + } + + return NULL; +} + static void resolv_result(GResolvResultStatus status, char **results, gpointer user_data) { @@ -54,7 +78,7 @@ static void resolv_result(GResolvResultStatus status, g_print("elapse: %f seconds\n", elapsed); - g_print("status: %d\n", status); + g_print("status: %s\n", status2str(status)); if (results != NULL) { for (i = 0; results[i]; i++) |