diff options
author | Daniel Friesel <derf@derf.homelinux.org> | 2009-08-10 00:53:44 +0200 |
---|---|---|
committer | Daniel Friesel <derf@derf.homelinux.org> | 2009-08-10 00:53:44 +0200 |
commit | 01661c8120aa73ae854c344d5c63f176762718a6 (patch) | |
tree | fb88ad5248c07b8893134aca3cb58fe3a4253428 /src | |
parent | 5666ded179caf3cddaee6a6d65ccc5c77b9e8d8f (diff) |
Use an enum for host_type
Diffstat (limited to 'src')
-rw-r--r-- | src/host.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -12,9 +12,6 @@ #include <sys/socket.h> #include <netdb.h> -#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 |