From: Bruno Haible Date: Tue, 21 Oct 2003 20:51:24 +0000 (+0000) Subject: Portability to mingw. X-Git-Tag: v0.13~194 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9ae78f58546dc8470e92ad1e8824afafff5e0da1;p=thirdparty%2Fgettext.git Portability to mingw. --- diff --git a/gettext-tools/lib/ChangeLog b/gettext-tools/lib/ChangeLog index 19fb0ba87..94982caf0 100644 --- a/gettext-tools/lib/ChangeLog +++ b/gettext-tools/lib/ChangeLog @@ -1,3 +1,8 @@ +2003-10-21 Bruno Haible + + * canonicalize.c (lstat): Define as an alias to 'stat' on systems + without symbolic links. + 2003-10-21 Bruno Haible * wait-process.c (kill): Define appropriately for native Woe32 API. diff --git a/gettext-tools/lib/canonicalize.c b/gettext-tools/lib/canonicalize.c index 5b7713eb0..ad796c682 100644 --- a/gettext-tools/lib/canonicalize.c +++ b/gettext-tools/lib/canonicalize.c @@ -77,6 +77,10 @@ # define __getcwd(buf, max) getwd (buf) # endif # define __readlink readlink + /* On systems without symbolic links, call stat() instead of lstat(). */ +# if !defined S_ISNLK && !HAVE_READLINK +# define lstat stat +# endif #endif /* Return the canonical absolute name of file NAME. A canonical name diff --git a/gettext-tools/m4/ChangeLog b/gettext-tools/m4/ChangeLog index 8cdabdba7..9116e5d96 100644 --- a/gettext-tools/m4/ChangeLog +++ b/gettext-tools/m4/ChangeLog @@ -1,3 +1,7 @@ +2003-10-21 Bruno Haible + + * canonicalize.m4 (gl_PREREQ_CANONICALIZE): Also test for readlink(). + 2003-10-14 Bruno Haible * sig_atomic_t.m4: New file. diff --git a/gettext-tools/m4/canonicalize.m4 b/gettext-tools/m4/canonicalize.m4 index 60f880ced..57260a5ad 100644 --- a/gettext-tools/m4/canonicalize.m4 +++ b/gettext-tools/m4/canonicalize.m4 @@ -1,4 +1,4 @@ -# canonicalize.m4 serial 1 (gettext-0.12) +# canonicalize.m4 serial 2 (gettext-0.12.2) dnl Copyright (C) 2003 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General @@ -23,5 +23,5 @@ AC_DEFUN([gl_CANONICALIZE], AC_DEFUN([gl_PREREQ_CANONICALIZE], [ AC_CHECK_HEADERS_ONCE(sys/param.h unistd.h) - AC_CHECK_FUNCS(getcwd) + AC_CHECK_FUNCS(getcwd readlink) ]) diff --git a/gettext-tools/src/ChangeLog b/gettext-tools/src/ChangeLog index 57270a612..7e023b414 100644 --- a/gettext-tools/src/ChangeLog +++ b/gettext-tools/src/ChangeLog @@ -1,3 +1,7 @@ +2003-10-21 Bruno Haible + + * hostname.c (xgethostname): Add support for native Woe32 API. + 2003-10-21 Bruno Haible * message.c (message_list_search): Avoid casting a pointer to a local diff --git a/gettext-tools/src/hostname.c b/gettext-tools/src/hostname.c index 854087b6c..975508f0e 100644 --- a/gettext-tools/src/hostname.c +++ b/gettext-tools/src/hostname.c @@ -38,10 +38,15 @@ # include #endif +#ifdef WIN32 +/* Native Woe32 API lacks gethostname() but has GetComputerName() instead. */ +# include +#else /* Some systems, like early Solaris versions, lack gethostname() but have uname() instead. */ -#if !HAVE_GETHOSTNAME -# include +# if !HAVE_GETHOSTNAME +# include +# endif #endif /* Get MAXHOSTNAMELEN. */ @@ -241,7 +246,14 @@ Informative output:\n")); static char * xgethostname () { -#if HAVE_GETHOSTNAME +#ifdef WIN32 + char hostname[MAX_COMPUTERNAME_LENGTH+1]; + DWORD size = sizeof (hostname); + + if (!GetComputerName (hostname, &size)) + error (EXIT_FAILURE, 0, _("could not get host name")); + return xstrdup (hostname); +#elif HAVE_GETHOSTNAME char hostname[MAXHOSTNAMELEN+1]; if (gethostname (hostname, MAXHOSTNAMELEN) < 0)