[fpc-pascal] Portable (or at least working) version of GetDomainName()?

waldo kitty wkitty42 at windstream.net
Tue Apr 9 19:51:26 CEST 2013

On 4/9/2013 04:24, Tomas Hajny wrote:
> On Tue, April 9, 2013 10:14, Mark Morgan Lloyd wrote:
>> waldo kitty wrote:
>>> i note that both, GetDomainName and GetHostName both use the same var
>>> (Sysn : utsname) but just different fields in what is apparently a
>>> record of some type...
>> It might be notable that Debian doesn't volunteer a domain name unless
>> it's able to contact DNS. I'll get onto nslookup, or just use temporary
>> text (it's only salt for a password hash, and is stored).
> Have you tried using unit netdb from package fcl-net? It doesn't support
> Windows (and some other platforms yet), but it should work for Unix
> targets. I believe that the two approaches for finding out the domain are
> either getting it from the DNS or having it specified in /etc/resolv (and
> both are used by unit netdb - search for DefaultDomainList).

shouldn't the OS' lookup routines handle whether the value from HOSTS or DNS is 
used automatically? i know that on some systems, one can specify to use HOSTS 
first (ie: USE_HOSTS_FIRST=1 [OS2] or /etc/host.conf [*nix])... i've seen it in 
winwhatever once upon a long time ago...

or am i misunderstanding this aspect and the apps used to perform DNS lookups 
are reacting to this setting and using one value or the other depending on the 
results returned from the initial query?

More information about the fpc-pascal mailing list