www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/05/13/08:57:56

Date: Thu, 13 May 1999 15:55:04 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Richard Dawe <richdawe AT bigfoot DOT com>
cc: djgpp-workers AT delorie DOT com
Subject: Re: $HOSTNAME doesn't override library code
In-Reply-To: <3738C473.D2105F0D@meridian22.net>
Message-ID: <Pine.SUN.3.91.990513155446.12629D-100000@is>
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Wed, 12 May 1999, Richard Dawe wrote:

> I've just been looking at the source file
> src/libc/compat/unistd/gethostn.c and I noticed that you cannot override
> the string returned by gethostname() by setting $HOSTNAME. Would it not be
> better to let the user override it?

The value of $HOSTNAME is a fallback, not an override.  The code calls
the network-aware function which returns whatever name you system has
been configured to.  This is what a Unix machine would do as well.

> This behaviour seems to contradict the approach taken with $USER.

There's no contradiction: $USER overrides the default "dosuser"
exactly as $HOSTNAME overrides the default "pc".  The difference is
that in the case of gethostname there is a DOS function that returns
the actual name of a machine, whereas there's no DOS function that
returns the name of the user.  So the call to Int 21h/AH=5Eh is *in
addition* to the environment override.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019