This is the mail archive of the cygwin-developers@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gethostname() patch


At 01:02 PM 1/10/2003 +0100, Corinna Vinschen wrote:
>I've just removed some old cruft from cygwin_gethostname which had
>the annoying result that always the return value of GetComputerName()
>has been used instead of the return value of gethostname().  Now
>Cygwin's gethostname and hostname(1) report the winsock value of the
>hostname which is lower case.

Here are some experiments, with the old dll. There gethostname calls
GetComputerName if wsock32 isn't loaded, else the wsock gethostname.
With Corinna's change, the wsock gethostname is always called (at least
it's consistent). The third line below is after loading wsock, i.e. the
new value.

Win98 
GetComputerName WORLDNET
gethostname WORLDNET
gethostname worldnet
 Great, that's the desired goal.

NT
GetComputerName PHumblet
gethostname PHumblet
gethostname PHumblet
 No difference, no lower case...

WinME
GetComputerName HPN5170X
gethostname HPN5170X
gethostname Marie-Claire
 Isn't that weird? That's my spouse first name, so somebody must 
have put it there, but I don't find it in any user interface. 
Using regedit I find it in
HKEY_LOCAL_MACHINE\System\CurrenControlSet\Services\VxD\HostName

Here are a few more experiments, first from the box itself
~: ping HPN5170X
Pinging HPN5170X [192.168.0.2] with 32 bytes of data:
~: ping Marie-Claire
Pinging Marie-Claire [192.168.0.2] with 32 bytes of data:
~: ping -a 192.168.0.2
Pinging HPN5170X [192.168.0.2] with 32 bytes of data:

And from the Win98 gateway on my home network
~: ping Marie-Claire
Unknown host Marie-Claire.
~: ping HPN5170x    
Pinging HPN5170x [192.168.0.2] with 32 bytes of data:

so ComputerName is more significant than HostName ....

>My questions is:  Shouldn't uname call this function as well?  Uname
>still uses the upper case value returned from GetComputerName().

Please don't, at least until this is explained.
To the contrary, should gethostname always call GetComputerName ???

Also, calling wsock32 gethostbyname does NOT imply lowercase.
if that's important Cygwin should change the case.

As somebody wrote on the list, those values come from different
registry entries. Why should one be the lowercase of the other?

Pierre


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]