]> git.eshelyaron.com Git - emacs.git/commitdiff
(get_system_name): If the official name of the host is
authorRichard M. Stallman <rms@gnu.org>
Mon, 3 Jan 1994 07:21:12 +0000 (07:21 +0000)
committerRichard M. Stallman <rms@gnu.org>
Mon, 3 Jan 1994 07:21:12 +0000 (07:21 +0000)
not a fully qualified domain name, then try to find one in the
list of alternate names.

src/sysdep.c

index 55f4d57da1b844e2b3326456ef35f88f97f070b9..bdac188ed645a05604213adbd8edecbc28b46bde 100644 (file)
@@ -1895,6 +1895,16 @@ get_system_name ()
       hp = gethostbyname (system_name_saved);
       if (hp && strlen (hp->h_name) < sizeof(system_name_saved))
        strcpy (system_name_saved, hp->h_name);
+      if (hp && !index (system_name_saved, '.'))
+       {
+         /* 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 && strlen (*alias) < sizeof (system_name_saved))
+           strcpy (system_name_saved, *alias);
+       }
     }
 #endif /* HAVE_SOCKETS */
 #endif /* not VMS */