aboutsummaryrefslogtreecommitdiffstats
path: root/missing_d
diff options
context:
space:
mode:
Diffstat (limited to 'missing_d')
-rw-r--r--missing_d/ChangeLog10
-rw-r--r--missing_d/getaddrinfo.c16
-rw-r--r--missing_d/getaddrinfo.h2
-rw-r--r--missing_d/snprintf.c10
4 files changed, 29 insertions, 9 deletions
diff --git a/missing_d/ChangeLog b/missing_d/ChangeLog
index 19d57042..83f5b93e 100644
--- a/missing_d/ChangeLog
+++ b/missing_d/ChangeLog
@@ -1,3 +1,7 @@
+2016-10-23 Arnold D. Robbins <arnold@skeeve.com>
+
+ * General: Remove trailing whitespace from all relevant files.
+
2016-09-07 Arnold D. Robbins <arnold@skeeve.com>
* setenv.c: Update license text in setenv.c. Thanks
@@ -16,6 +20,12 @@
* 4.1.2: Release tar ball made.
+2015-02-27 Arnold D. Robbins <arnold@skeeve.com>
+
+ * getaddrinfo.h (gai_strerror): Add declaration.
+ * getaddrinfo.c (gai_strerror): New function.
+ (getaddrinfo): Return errno values instead of just -1.
+
2014-04-08 Arnold D. Robbins <arnold@skeeve.com>
* 4.1.1: Release tar ball made.
diff --git a/missing_d/getaddrinfo.c b/missing_d/getaddrinfo.c
index 677f27d0..f24ac598 100644
--- a/missing_d/getaddrinfo.c
+++ b/missing_d/getaddrinfo.c
@@ -12,6 +12,8 @@
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
+#include <errno.h>
+#include <string.h> /* strerror */
#include "getaddrinfo.h"
@@ -29,12 +31,12 @@ getaddrinfo(const char *hostname, const char *portname,
{
struct addrinfo *out;
if (res == NULL)
- return -1;
+ return EINVAL;
out = (struct addrinfo *) malloc(sizeof(*out));
if (out == NULL) {
*res = NULL;
- return -1;
+ return ENOMEM;
}
memset(out, '\0', sizeof(*out));
@@ -42,7 +44,7 @@ getaddrinfo(const char *hostname, const char *portname,
if (out->ai_addr == NULL) {
free(out);
*res = NULL;
- return -1;
+ return ENOMEM;
}
out->ai_socktype = SOCK_STREAM;
@@ -78,7 +80,7 @@ getaddrinfo(const char *hostname, const char *portname,
= ((struct in_addr *)he->h_addr_list[0])->s_addr;
} else {
freeaddrinfo(out);
- return -1;
+ return EADDRNOTAVAIL;
}
} else {
if (!(out->ai_flags & AI_PASSIVE))
@@ -109,4 +111,10 @@ getaddrinfo(const char *hostname, const char *portname,
return 0;
}
+
+const char *
+gai_strerror(int errcode)
+{
+ return strerror(errcode);
+}
#endif
diff --git a/missing_d/getaddrinfo.h b/missing_d/getaddrinfo.h
index 3d816c93..873d67df 100644
--- a/missing_d/getaddrinfo.h
+++ b/missing_d/getaddrinfo.h
@@ -29,3 +29,5 @@ void freeaddrinfo(struct xaddrinfo * res);
int getaddrinfo(const char * hostname, const char * portname,
struct xaddrinfo * hints, struct xaddrinfo ** res);
+
+const char *gai_strerror(int errcode);
diff --git a/missing_d/snprintf.c b/missing_d/snprintf.c
index 6cee2bed..9d692d5a 100644
--- a/missing_d/snprintf.c
+++ b/missing_d/snprintf.c
@@ -2,22 +2,22 @@
* snprintf.c - Implement snprintf and vsnprintf on platforms that need them.
*/
-/*
+/*
* Copyright (C) 2006, 2007 the Free Software Foundation, Inc.
- *
+ *
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
- *
+ *
* GAWK 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 3 of the License, or
* (at your option) any later version.
- *
+ *
* GAWK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA