Re: Getting the domain name
- From: Daniel Rudy <spamthis@xxxxxxxxxxxx>
- Date: Sat, 24 Mar 2007 08:40:55 GMT
At about the time of 3/23/2007 11:06 AM, Michael B Allen stated the
following:
Can anyone recommend a portable way of getting the domain name of the
local machine? I find it amazing that there's no builtin method for
doing this (gethostname does not necessarily contain the domain).
Mike
I had the exact same problem a few years ago. I wrote a tool to do just
that. I'm running FreeBSD, so I just do this:
DOMAINNAME="`hostname | domain`"
That's using FreeBSD's version of Borne Shell.
Since yours is adding a period on the end, you will have to modify the
source to strip the period out. I have the source code posted on source
forge.
http://sourceforge.net/projects/ipdomaintools/
Hope this helps.
--
Daniel Rudy
Email address has been base64 encoded to reduce spam
Decode email address using b64decode or uudecode -m
Why geeks like computers: look chat date touch grep make unzip
strip view finger mount fcsk more fcsk yes spray umount sleep
.
- References:
- Getting the domain name
- From: Michael B Allen
- Getting the domain name
- Prev by Date: Re: Raw disk access?
- Next by Date: Re: time(NULL) returning wrong month???
- Previous by thread: Re: Getting the domain name
- Next by thread: poll() revents variable
- Index(es):
Relevant Pages
|
Loading