*BSD News Article 17888


Return to BSD News archive

Newsgroups: comp.unix.bsd
Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!agate!howland.reston.ans.net!noc.near.net!das-news.harvard.edu!kepler!jiu
From: jiu@kepler.uucp (Haibin Jiu)
Subject: Re: domain name
Message-ID: <1993Jul2.204948.3004@das.harvard.edu>
Sender: usenet@das.harvard.edu (Network News)
Organization: Harvard University Engineering Labs
References: <1993Jul2.203312.2808@das.harvard.edu>
Date: Fri, 2 Jul 1993 20:49:48 GMT
Lines: 19

I posted it earlier.

In article <1993Jul2.203312.2808@das.harvard.edu> jiu@kepler.uucp (Haibin Jiu) writes:
>Hi!  I am writing a program in which I attempt to get the name of
>the current domain.  On my Sun workstation I use getdomainname(2)
>and it returns the correct string.  But when I try to port it to
>other systems, the returned string varies according to system.  To
>see what your system will return, you can type "domainname" at the
>UNIX prompt.
>
>Does anyone know of a sure way to obtain the correct domainname,
>hostname, or a combination of both?

I think accessing /etc/hosts file is the sure way to get the
corrent host and domain name for your Internet node.

Any comment?

HBJ