This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
+ the Free Software Foundation; either version 3, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
/* Get memcpy, strdup. */
#include <string.h>
+/* Get snprintf. */
+#include <stdio.h>
+
#include <stdbool.h>
#include "gettext.h"
#define N_(String) String
#include "inet_ntop.h"
-#include "snprintf.h"
extern int h_errno;
/* Translate name of a service location and/or a service name to set of
socket addresses. */
int
-getaddrinfo (const char *restrict nodename,
- const char *restrict servname,
- const struct addrinfo *restrict hints,
- struct addrinfo **restrict res)
+getaddrinfo (const char *nodename,
+ const char *servname,
+ const struct addrinfo *hints,
+ struct addrinfo **res)
{
struct addrinfo *tmp;
int port = 0;
{
struct servent *se = NULL;
const char *proto =
- (hints && (hints->ai_socktype == SOCK_DGRAM)) ? "udp" : "tcp";
+ (hints && hints->ai_socktype == SOCK_DGRAM) ? "udp" : "tcp";
- if ((hints == NULL) || !(hints->ai_flags & AI_NUMERICSERV))
- {
- /* FIXME: Use getservbyname_r if available. */
- se = getservbyname (servname, proto);
- }
+ if (hints == NULL || !(hints->ai_flags & AI_NUMERICSERV))
+ /* FIXME: Use getservbyname_r if available. */
+ se = getservbyname (servname, proto);
if (!se)
{
cur = ai;
ai = ai->ai_next;
- if (cur->ai_canonname) free (cur->ai_canonname);
+ free (cur->ai_canonname);
free (cur);
}
}
-int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen,
- char *restrict node, socklen_t nodelen,
- char *restrict service, socklen_t servicelen,
+int getnameinfo(const struct sockaddr *sa, socklen_t salen,
+ char *node, socklen_t nodelen,
+ char *service, socklen_t servicelen,
int flags)
{
#ifdef WIN32_NATIVE