From 01661c8120aa73ae854c344d5c63f176762718a6 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 10 Aug 2009 00:53:44 +0200 Subject: Use an enum for host_type --- src/host.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/host.c b/src/host.c index 88e06a5..aa4372e 100644 --- a/src/host.c +++ b/src/host.c @@ -12,9 +12,6 @@ #include #include -#define INPUT_HOST 1 -#define INPUT_IP 2 - /** * \brief Print some usage information */ @@ -57,7 +54,11 @@ int main(int argc, char **argv) { char hostname[NI_MAXHOST]; char ip_address[INET6_ADDRSTRLEN]; int ret; - int input_type = 0; + enum { + INPUT_NONE, + INPUT_IP, + INPUT_HOST + } input_type = INPUT_NONE; char option; while ((option = getopt(argc, argv, "46")) != -1) { @@ -88,7 +89,7 @@ int main(int argc, char **argv) { for (address = result; address != NULL; address = address->ai_next) { if (addr_to_ip(address, ip_address, sizeof(ip_address)) == 0) continue; - if (input_type == 0) { + if (input_type == INPUT_NONE) { if (strcmp(ip_address, argv[optind]) == 0) input_type = INPUT_IP; else -- cgit v1.2.3