/*
* client.c -- connect to a server
*
- * $Id$
- *
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
* complete copyright information.
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
-
-#ifdef HAVE_ARPA_INET_H
-# include <arpa/inet.h>
-#endif
-
-#define TRUE 1
-#define FALSE 0
+#include <arpa/inet.h>
#define MAXARGS 1000
}
memset(&hints, 0, sizeof(hints));
+#ifdef AI_ADDRCONFIG
hints.ai_flags = AI_ADDRCONFIG;
+#endif
hints.ai_family = PF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
if (connect(sd, ai->ai_addr, ai->ai_addrlen) == 0) {
freeaddrinfo(res);
- client_freelist(ap);
+ client_freelist(arguments);
return sd;
}
freeaddrinfo(res);
}
- client_freelist(ap);
+ client_freelist(arguments);
strncpy (response, "no servers available", len_response);
return NOTOK;
}
static void
client_freelist(char **list)
{
- while (*list++ != NULL)
- free(*list);
+ free(*list);
}