summaryrefslogtreecommitdiff
path: root/src/sysdep.c
diff options
context:
space:
mode:
authorKarl Heuer <kwzh@gnu.org>1997-10-31 23:01:48 +0000
committerKarl Heuer <kwzh@gnu.org>1997-10-31 23:01:48 +0000
commit960d894c38f6c0982e4227231b5db7f85fa93919 (patch)
tree1f0b717ee37ec361e52d2a3a493f7361f032d25d /src/sysdep.c
parent13d603a9949f402c098cb9922dfe787bdcd82545 (diff)
downloademacs-960d894c38f6c0982e4227231b5db7f85fa93919.tar.gz
(init_system_name): If gethostname gives a proper
domain name, don't look farther for one.
Diffstat (limited to 'src/sysdep.c')
-rw-r--r--src/sysdep.c83
1 files changed, 42 insertions, 41 deletions
diff --git a/src/sysdep.c b/src/sysdep.c
index e8e1db80ec0..e8176753b3a 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -2241,53 +2241,54 @@ init_system_name ()
#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 <gniibe@etl.go.jp> says that