Simon Josefsson wrote: > I think MinGW actually does have a gethostname, but you need to > link to -lws2_32 to see it. Yup. I actually have a local tree of > gnulib that implements this test. Patch below, but it is ancient and > there were likely some reason this was never installed.
There are 2 reasons for not committing it as-is: 1) The spec of gethostname() in Windows is different from the one in Unix, see [1]. In particular, it does not set errno, and requires prior use of WSAStartup(). 2) It requires the introduction of a Makefile variable LIBGETHOSTNAME. See also the discussion that started in [2]. Bruno [1] http://msdn.microsoft.com/en-us/library/ms738527(VS.85).aspx [2] http://lists.gnu.org/archive/html/bug-gnulib/2008-01/msg00199.html