Mailing-List: contact cygwin-developers-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-developers-owner AT cygwin DOT com Delivered-To: mailing list cygwin-developers AT cygwin DOT com Message-Id: <3.0.5.32.20030110192940.007f78a0@mail.attbi.com> X-Sender: phumblet AT mail DOT attbi DOT com Date: Fri, 10 Jan 2003 19:29:40 -0500 To: cygwin-developers AT cygwin DOT com From: "Pierre A. Humblet" Subject: Re: gethostname() patch In-Reply-To: <20030110130259.E1401@cygbert.vinschen.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" 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