From: Francesco Tribioli (tribioli@arcetri.astro.it)
Date: 07/05/93


From: tribioli@arcetri.astro.it (Francesco Tribioli)
Subject: Re: 0.99pl10 & NET-010 Problems
Date: Mon, 5 Jul 1993 11:23:18 GMT

In article <C9JMoz.A2p@hunan.rastek.com>, jmorris@hunan.rastek.com (Jim Morris) writes:
|>
|> I personally do NOT like having to use a full hostname, i.e. "hostname.domain".
|> Makes my prompt rather long! ;-) Unfortunately, it looks as if this new
|> NET-010 distribution uses hostname to set the domainname as well, and that
|> the domainname command no longer works. Am I right, or is there something
|> I am not getting?
|>

I don't know why one should use hostname to set the domain! In this way it
seems to me the call to getdomainname will not work and you will always get
back "(none)" as domainname. This could potentially create a lot of problems
because it is a non standard behaviour.
Obviously the old domainname command is not usable anymore because the routines
regarding domain and host name was changed in libc.4.4 but is really very
simple to write a little c program to set the domain name. I have done so and
all is working OK. This is the code I use:

#include <unistd.h>
#include <stdio.h>
#include <strings.h>
#include <errno.h>
#include <arpa/nameser.h>
main (argc, argv)
        int argc;
        char *argv[];
{
        char dom[MAXDNAME];

        if (argc == 1)
        {
/* no args: print out the current domain name */
                if (!getdomainname(dom, MAXDNAME))
                {
                  puts(dom);
                  exit(0);
                }
                else
                {
                  perror("Error");
                  exit(errno);
                }
        }
        else
        {
/* set the domain name to the first argument */
                strncpy(dom, argv[1], MAXDNAME);
                if (!setdomainname(dom,strlen(dom)))
                  exit(0);
                else
                {
                  perror("Error");
                  exit(errno);
                }
        }
}

|> Thanks!
|>
|> *-------------------------------------------------*
|> |Jim Morris | Internet Address: jmorris@rastek.com|
|> *-------------------------------------------------*

Ciao

-- 
================================================================================
Francesco Tribioli                              News and system manager
Osservatorio Astrofisico di Arcetri             Firenze - ITALY
Internet tribioli@arcetri.astro.it
DECNET 38954::tribioli
================================================================================