vcpkg/ports/gettext/win-gethostname.patch
Kai Pastor 6b3a1a2188
[gettext] Update to 0.21.1 (#29113)
* Use VERSION

* Update to 0.21.1

* Update win unicode paths patch

* Revise uwp patches

* Cleanup

* Build tools for uwp in CI

* tools not supported on uwp

* Add license GPL3.0-or-later.

gettext.c has:

   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 3 of the License, or
   (at your option) any later version.

* Fix license, but better.

* Version database

---------

Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
2023-01-27 07:25:29 -08:00

46 lines
1.5 KiB
Diff

diff --git a/gettext-tools/src/hostname.c b/gettext-tools/src/hostname.c
index e909637..c2e8065 100644
--- a/gettext-tools/src/hostname.c
+++ b/gettext-tools/src/hostname.c
@@ -29,7 +29,9 @@
#include <locale.h>
#if defined _WIN32
+# if !HAVE_GETHOSTNAME
# define WIN32_NATIVE
+# endif
#endif
/* Get gethostname(). */
@@ -56,6 +58,9 @@
/* Support for using gethostbyname(). */
#if HAVE_GETHOSTBYNAME
+# if HAVE_WINSOCK2_H
+# include <winsock2.h>
+# else
# include <sys/types.h>
# include <sys/socket.h> /* defines AF_INET, AF_INET6 */
# include <netinet/in.h> /* declares ntohs(), defines struct sockaddr_in */
@@ -76,6 +81,7 @@
# endif
# endif
# include <netdb.h> /* defines struct hostent, declares gethostbyname() */
+# endif
#endif
/* Include this after <sys/socket.h>, to avoid a syntax error on BeOS. */
diff --git a/libtextstyle/lib/unistd.in.h b/libtextstyle/lib/unistd.in.h
index fd69a48..4ebdcaa 100644
--- a/libtextstyle/lib/unistd.in.h
+++ b/libtextstyle/lib/unistd.in.h
@@ -1240,7 +1240,7 @@ _GL_WARN_ON_USE (getgroups, "getgroups is unportable - "
Null terminate it if the name is shorter than LEN.
If the host name is longer than LEN, set errno = EINVAL and return -1.
Return 0 if successful, otherwise set errno and return -1. */
-# if @UNISTD_H_HAVE_WINSOCK2_H@
+# if @UNISTD_H_HAVE_WINSOCK2_H@ && !@HAVE_GETHOSTNAME@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef gethostname
# define gethostname rpl_gethostname