Simon Josefsson wrote: > The current gethostname module will return an empty string on mingw: > > strcpy (name, ""); /* Hardcode your system name if you want. */ > > This is sub-optimal since Windows has a gethostname function in > -lws2_32. > > The following patch should make gethostname return proper values. > Tested on x86 debian lenny and mingw cross-compile. Any objections to > installing it?
Well, I don't much like the dependency on an external library for the modules 'gethostname' and 'uname' (later, when we get an 'uname' module). I did some experiments with the GetComputerNameEx function [1], which is present in kernel32.dll. The parameters ComputerNameDnsHostname and ComputerNamePhysicalDnsHostname returned the same value as gethostname() for me, except that gethostname() returns a lowercased result (which can be simulated in 3 lines of code). OTOH, the gethostname() in -lws2_32 is a "Unixy" API, and it seems idiotic want to use a "Windozy" API instead. I'm undecided. Bruno [1] http://msdn.microsoft.com/en-us/library/ms724301(VS.85).aspx