changeset 5737:eb722251d156

(x_term_init): Use get_system_name instead of gethostname.
author Karl Heuer <kwzh@gnu.org>
date Wed, 02 Feb 1994 06:32:28 +0000
parents 6f199038b06d
children 730f63010940
files src/xterm.c
diffstat 1 files changed, 1 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/src/xterm.c	Wed Feb 02 06:31:26 1994 +0000
+++ b/src/xterm.c	Wed Feb 02 06:32:28 1994 +0000
@@ -5194,30 +5194,10 @@
 
 #ifdef HAVE_X11
   {
-    int hostname_size = 256;
-
-    hostname = (char *) xmalloc (hostname_size);
-
 #if 0
     XSetAfterFunction (x_current_display, x_trace_wire);
 #endif /* ! 0 */
-
-    /* Try to get the host name; if the buffer is too short, try
-       again.  Apparently, the only indication gethostname gives of
-       whether the buffer was large enough is the presence or absence
-       of a '\0' in the string.  Eech.  */
-    for (;;)
-      {
-	gethostname (hostname, hostname_size - 1);
-	hostname[hostname_size - 1] = '\0';
-
-	/* Was the buffer large enough for gethostname to store the '\0'?  */
-	if (strlen (hostname) < hostname_size - 1)
-	  break;
-
-	hostname_size <<= 1;
-	hostname = (char *) xrealloc (hostname, hostname_size);
-      }
+    hostname = get_system_name ();
     x_id_name = (char *) xmalloc (XSTRING (Vinvocation_name)->size
 				+ strlen (hostname)
 				+ 2);