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

waldo kitty wkitty42 at windstream.net
Tue Apr 9 20:38:27 CEST 2013


On 4/9/2013 14:10, Tomas Hajny wrote:
> On Tue, April 9, 2013 19:51, waldo kitty wrote:
>> On 4/9/2013 04:24, Tomas Hajny wrote:
>   .
>   .
>>> 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...
>
> That depends on what API provided by the respective OS. As far as I
> understand it correctly, Unix does not provide such functionality in the
> basic API (syscalls) but only e.g. in libc (which is in turn used by
> nslookup, etc.), so Pascal code (for Unix) not using libc needs to
> implement this logic (that's what unit netdb does).

ahhhhh... ok... i hadn't yet had a chance to go looking in that unit... trying 
to first complete the email wading for the day ;)

FWIW: if i were to just be hunting and digging, the name of the unit would throw 
me off because it seems to indicate network database functions whereas i 
wouldn't think that DNS lookups and the like are database oriented... not like 
SQL stuff... but i guess the DNS is a form of database, isn't it ;)




More information about the fpc-pascal mailing list