# HG changeset patch # User Karl Heuer # Date 878338908 0 # Node ID de9483a63b12fc9d4aa3b98e73508fe644473efa # Parent 09b52c2bc2f16051686eff0d4066e3561df6df85 (init_system_name): If gethostname gives a proper domain name, don't look farther for one. diff -r 09b52c2bc2f1 -r de9483a63b12 src/sysdep.c --- a/src/sysdep.c Wed Oct 29 07:47:37 1997 +0000 +++ b/src/sysdep.c Fri Oct 31 23:01:48 1997 +0000 @@ -2241,53 +2241,54 @@ #ifndef CANNOT_DUMP if (initialized) #endif /* not CANNOT_DUMP */ - { - struct hostent *hp; - int count; - for (count = 0;; count++) - { + if (! index (hostname, '.')) + { + struct hostent *hp; + int count; + for (count = 0;; count++) + { #ifdef TRY_AGAIN - h_errno = 0; + h_errno = 0; #endif - hp = gethostbyname (hostname); + hp = gethostbyname (hostname); #ifdef TRY_AGAIN - if (! (hp == 0 && h_errno == TRY_AGAIN)) + if (! (hp == 0 && h_errno == TRY_AGAIN)) #endif - break; - if (count >= 5) - break; - Fsleep_for (make_number (1), Qnil); - } - if (hp) - { - char *fqdn = (char *) hp->h_name; - char *p; - - if (!index (fqdn, '.')) - { - /* We still don't have a fully qualified domain name. - Try to find one in the list of alternate names */ - char **alias = hp->h_aliases; - while (*alias && !index (*alias, '.')) - alias++; - if (*alias) - fqdn = *alias; - } - hostname = fqdn; + break; + if (count >= 5) + break; + Fsleep_for (make_number (1), Qnil); + } + if (hp) + { + char *fqdn = (char *) hp->h_name; + char *p; + + if (!index (fqdn, '.')) + { + /* We still don't have a fully qualified domain name. + Try to find one in the list of alternate names */ + char **alias = hp->h_aliases; + while (*alias && !index (*alias, '.')) + alias++; + if (*alias) + fqdn = *alias; + } + hostname = fqdn; #if 0 - /* Convert the host name to lower case. */ - /* Using ctype.h here would introduce a possible locale - dependence that is probably wrong for hostnames. */ - p = hostname; - while (*p) - { - if (*p >= 'A' && *p <= 'Z') - *p += 'a' - 'A'; - p++; - } + /* Convert the host name to lower case. */ + /* Using ctype.h here would introduce a possible locale + dependence that is probably wrong for hostnames. */ + p = hostname; + while (*p) + { + if (*p >= 'A' && *p <= 'Z') + *p += 'a' - 'A'; + p++; + } #endif - } - } + } + } #endif /* HAVE_SOCKETS */ /* We used to try using getdomainname as an alternative to sysinfo, here, but NIIBE Yutaka says that