Bruno Haible writes:
> You are right. In summary:
>
>- GetComputerNameEx(ComputerNameDnsHostname,...) returns the right
> hostname,
> but it hard to use portably:
>- It requires defining _WIN32_WINNT to at least 0x0500.
>- With mingw, it also requires
> "#define
Martin Lambers wrote:
> This requires to include limits.h in gethostname.c, to get INT_MAX.
>
> Martin
>
>
> diff --git a/lib/gethostname.c b/lib/gethostname.c
> index ef58a40..422184a 100644
> --- a/lib/gethostname.c
> +++ b/lib/gethostname.c
> @@ -76,6 +76,9 @@ gethostname (char *name, size_t
On Sun, 02. Aug 2009, 12:04:53 +0200, Bruno Haible wrote:
> Simon Josefsson wrote:
> > Avoiding -lws2_32 is good, but if the application links to -lws2_32
> > anyway, there will be no saving.
> > [...]
>
> [...]
> I'm now convinced that linking with -lws2_32 is the least evil.
> I have applied you
Simon Josefsson wrote:
> > I'm undecided.
>
> Avoiding -lws2_32 is good, but if the application links to -lws2_32
> anyway, there will be no saving.
> ...
> Some additional questions:
>
> 1) How do I use it? This doesn't seem to work:
>
> j...@mocca:~$ cat foo.c
> #define WINVER 0x0500
> #inclu
I managed to rewrite the code in GSS to not need the gethostname
function at all, so I don't care strongly about the patch to make
gethostname work under mingw anymore. My initial patch could be used,
but Bruno's concern about linking to -lws2_32 may be a reason against.
/Simon
Bruno Haible writes:
> 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 fo
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 gethos
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