Re: (x)gethostname

2008-01-24 Thread Simon Josefsson
Brian Dessent <[EMAIL PROTECTED]> writes: > Simon Josefsson wrote: > >> 3) Is there any chance that the #define gethostname rpl_gethostname and >> replacement prototype of gethostname in gnulib's unistd.h will cause >> problems? Consider that gethostname in winsock2.h is declared with >> PASCAL c

Re: (x)gethostname

2008-01-24 Thread Brian Dessent
Simon Josefsson wrote: > 3) Is there any chance that the #define gethostname rpl_gethostname and > replacement prototype of gethostname in gnulib's unistd.h will cause > problems? Consider that gethostname in winsock2.h is declared with > PASCAL calling conventions, so the prototype is not the sa

Re: (x)gethostname

2008-01-24 Thread Simon Josefsson
Here is an updated patch to get gethostname working under MinGW. It uses the recent new gnulib module 'sockets'. The module works like this: If the gethostname function is not found on the system, it pulls in gethostname.c into the gnulib library, and defines gethostname to rpl_gethostname. rpl_

Re: (x)gethostname

2008-01-24 Thread Simon Josefsson
Bruno Haible <[EMAIL PROTECTED]> writes: >> > And it is necessary to still override the function, in order to >> > WSAStartup before? >> >> No, this doesn't seem to be necessary, at least under Wine. > > I don't think that you can judge the behaviour of Windows by testing on > Wine. You know that

Re: (x)gethostname

2008-01-18 Thread Simon Josefsson
Bruno Haible <[EMAIL PROTECTED]> writes: > Simon, > >> If we modify gethostname.m4 as I suggested, it will detect that mingw do >> have a gethostname function, and consequently, the gethostname module is >> not be needed. > > Actually, the replacement function is not needed. But the piece of > con

Re: (x)gethostname

2008-01-18 Thread Bruno Haible
Simon, > If we modify gethostname.m4 as I suggested, it will detect that mingw do > have a gethostname function, and consequently, the gethostname module is > not be needed. Actually, the replacement function is not needed. But the piece of configure.ac from modules/gethostname is expanded into c

Re: (x)gethostname

2008-01-18 Thread Simon Josefsson
Simon Josefsson <[EMAIL PROTECTED]> writes: >>> For reference, the Windows documentation for gethostname is: >>> >>> http://msdn2.microsoft.com/en-us/library/ms738527.aspx >> >> Thanks for the reference. So, to accomodate this function, we need a >> rpl_gethostname that calls gethostname and acco

Re: (x)gethostname

2008-01-18 Thread Simon Josefsson
Bruno Haible <[EMAIL PROTECTED]> writes: > Hi Simon, > >> > But this is still not complete: The doc/functions/gethostname.texi file >> > says that the problem is that mingw lacks a gethostname function. >> >> This is not the case now, and I'm not sure it ever was. Where did that >> information c

Re: (x)gethostname

2008-01-18 Thread Simon Josefsson
Bruno Haible <[EMAIL PROTECTED]> writes: > Simon Josefsson wrote: >> For mingw, @GNULIB_GETHOSTNAME@ will be 0 since it has a gethostname (if >> sys/socket.h is pulled in). > > Huh? GNULIB_GETHOSTNAME is set to 1 by the gl_MODULE_INDICATOR([gethostname]) > line, independently of platforms. It is 0

Re: (x)gethostname

2008-01-18 Thread Bruno Haible
Simon Josefsson wrote: > For mingw, @GNULIB_GETHOSTNAME@ will be 0 since it has a gethostname (if > sys/socket.h is pulled in). Huh? GNULIB_GETHOSTNAME is set to 1 by the gl_MODULE_INDICATOR([gethostname]) line, independently of platforms. It is 0 if the gethostname module is not used. Bruno

Re: (x)gethostname

2008-01-18 Thread Bruno Haible
Hi Simon, > > But this is still not complete: The doc/functions/gethostname.texi file > > says that the problem is that mingw lacks a gethostname function. > > This is not the case now, and I'm not sure it ever was. Where did that > information come from? I wrote it: I saw that the .m4 macro on

Re: (x)gethostname

2008-01-17 Thread Simon Josefsson
Bruno Haible <[EMAIL PROTECTED]> writes: > + /* mingw fails to declare gethostname in . */ > + #if @GNULIB_GETHOSTNAME@ && ((defined _WIN32 || defined __WIN32__) && ! > defined __CYGWIN__) > + # include > + #endif > + I tried your patch now, to take care of problem 1), but it doesn't work. F

Re: (x)gethostname

2008-01-17 Thread Simon Josefsson
Simon Josefsson <[EMAIL PROTECTED]> writes: > 1) Modify gethostname module to look for gethostname in winsock2.h and >-lws2_32, similar to what's in getaddrinfo.m4. This will make gethostname >depend on sys/socket.h, just like getaddrinfo does. > > 2) Modify unistd module to make sure it

Re: (x)gethostname

2008-01-17 Thread Simon Josefsson
Bruno Haible <[EMAIL PROTECTED]> writes: > Simon Josefsson wrote: >> 2008-01-16 Simon Josefsson <[EMAIL PROTECTED]> >> >> * lib/unistd.in.h: Include sys/socket.h, to get to winsock2.h, >> which declares gethostname on MinGW. >> >> * modules/unistd (Depends-on): Add sys_socket. >

Re: (x)gethostname

2008-01-16 Thread Bruno Haible
Simon Josefsson wrote: > 2008-01-16 Simon Josefsson <[EMAIL PROTECTED]> > > * lib/unistd.in.h: Include sys/socket.h, to get to winsock2.h, > which declares gethostname on MinGW. > > * modules/unistd (Depends-on): Add sys_socket. Half OK. This patch does too much, IMO: - It

Re: (x)gethostname

2008-01-16 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Simon Josefsson on 1/16/2008 6:55 AM: | According to m4/sys_socket_h.m4, just checking for winsock2.h and | including that file would break cygwin. It is claimed that cygwin never | wants winsock2.h to be included, instead things should

(x)gethostname

2008-01-16 Thread Simon Josefsson
Building shishi on mingw leads to: ../../../src/shishi-0.0.34/gl/xgethostname.c: In function 'xgethostname': ../../../src/shishi-0.0.34/gl/xgethostname.c:61: warning: implicit declaration of function 'gethostname' According to http://www.opengroup.org/onlinepubs/009695399/functions/gethostname.