🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.programmer
Article #967

Re: Easy way to find hostname/domainname

#967
From: Mark Towfiq
Date: Wed, 03 Oct 1990 14:38
21 lines
1514 bytes
In article <1990Sep28.162012.14325@saukh.rd.jvd.su>
nms@saukh.rd.jvd.su (Nickolay Saukh) writes:

   I need advice/software to figure out the hostname & domain name for C
   programs and shell scripts. In C for hostname it seems to be quite easy:

   [how to get hostname deleted]

   But how to find domain name? Look at some file with magic name? What the
   name should be (with portabily issues in mind)?

In C, I would do a gethostbyname() to get the FQDN, and then take
everything after the first "." to be the domain.

   The same problem for shell scripts. I know about 'hostname' command in
   BSD world, 'uuname -l' for SV world (and 'uname' also).

So you want the FQDN in a shell script?  I do not know of a portable
way to do this.  You could look for /etc/resolv.conf, or you could
look for a program like "host", or "nslookup", and maybe AWK its
output?
Technical Details
Message-ID: <TOWFIQ.90Oct3103801@slam.InterLan.COM>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!samsung!interlan.InterLan.COM!interlan.interlan.com!towfiq
References: <1990Sep28.162012.14325@saukh.rd.jvd.su>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!samsung!interlan.InterLan.COM!interlan.interlan.com!towfiq
From: towfiq@interlan.Interlan.COM (Mark Towfiq)
Newsgroups: comp.unix.programmer,comp.unix.questions
Subject: Re: Easy way to find hostname/domainname
Message-ID: <TOWFIQ.90Oct3103801@slam.InterLan.COM>
Date: 3 Oct 90 14:38:01 GMT
References: <1990Sep28.162012.14325@saukh.rd.jvd.su>
Sender: news@interlan.Interlan.COM (No News is BAD News)
Organization: Racal InterLan, Inc., Boxborough, MA (1-800-LAN-TALK)
Lines: 21
In-Reply-To: nms@saukh.rd.jvd.su's message of 28 Sep 90 16:20:12 GMT
Nntp-Posting-Host: slam.interlan.com