Sender: richdawe AT bigfoot DOT com Message-ID: <373B3EFD.93C37956@bigfoot.com> Date: Thu, 13 May 1999 22:07:09 +0100 From: Richard Dawe X-Mailer: Mozilla 4.08 [en] (X11; I; Linux 2.2.1 i586) MIME-Version: 1.0 To: djgpp-workers AT delorie DOT com Subject: Re: $HOSTNAME doesn't override library code References: <199905130055 DOT UAA17585 AT envy DOT delorie DOT com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Hello. Alain Magloire wrote: > Should not the application be link with the library > > cc -o app app.c -lsocket > > libsocket.a should overide libc .. no ? libsocket doesn't override libc's hostname - it provides a function lsck_gethostname() instead. It does, however, provide getdomainname() (& lsck_getdomainname(), which is the same function). lsck_gethostname() uses libc's gethostname() function to obtain the host name if it can't get it via any other method. lsck_gethostname() can find the proper DNS name of the computer from Win9x's registry. I guess libsocket's lsck_gethostname() should really override gethostname(). Which order are the libraries linked by gcc? i.e. if I do: gcc -o wotsit wotsit.c -lsocket does libc get linked before/after libsocket? If the latter is true then I will make libsocket override libc's gethostname(). My comment about $HOSTNAME was aimed at using DJGPP without libsocket, e.g. using hostname from shellutils. In bash try: export HOSTNAME=thingy.foo.com hostname hostname will just output the LAN Manager name, rather than the set environment variable. The environment variable is only used if the LAN Manager name cannot be found, i.e. when LAN Manager APIs aren't present, e.g under plain old DOS. What is the position on placing network-enabled versions of the relevant utilities on Simtelnet? I think libsocket's Windows code will soon be stable enough to make this viable. -- ========================================================================== Rich Dawe - 4th-year MSci Physicist @ Bristol University, UK richdawe AT bigfoot DOT com, http://www.bigfoot.com/~richdawe/ ==========================================================================