changeset 5420:a5e2d8c44144

(get_system_name): If the official name of the host is not a fully qualified domain name, then try to find one in the list of alternate names.
author Richard M. Stallman <rms@gnu.org>
date Mon, 03 Jan 1994 07:21:12 +0000
parents a35739cc2026
children a248a39fa4b8
files src/sysdep.c
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/sysdep.c	Mon Jan 03 05:14:06 1994 +0000
+++ b/src/sysdep.c	Mon Jan 03 07:21:12 1994 +0000
@@ -1895,6 +1895,16 @@
       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 */