summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2009-08-10 00:53:44 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2009-08-10 00:53:44 +0200
commit01661c8120aa73ae854c344d5c63f176762718a6 (patch)
treefb88ad5248c07b8893134aca3cb58fe3a4253428
parent5666ded179caf3cddaee6a6d65ccc5c77b9e8d8f (diff)
Use an enum for host_type
-rw-r--r--src/host.c11
1 files 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 <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