Commit 60fb3ee1 authored by Jim Blandy's avatar Jim Blandy

*** empty log message ***

parent 4d6cebd8
This diff is collapsed.
......@@ -161,6 +161,7 @@ static FONT_TYPE *icon_font_info;
/* Stuff for dealing with the main icon title. */
extern Lisp_Object Vcommand_line_args;
char *hostname, *x_id_name;
Lisp_Object invocation_name;
/* This is the X connection that we are using. */
......@@ -3583,11 +3584,36 @@ x_term_init (display_name)
#ifdef HAVE_X11
{
int hostname_size = MAXHOSTNAMELEN + 1;
hostname = (char *) xmalloc (hostname_size);
#if 0
XSetAfterFunction (x_current_display, x_trace_wire);
#endif
invocation_name = Ffile_name_nondirectory (Fcar (Vcommand_line_args));
/* 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);
}
x_id_name = (char *) xmalloc (XSTRING (invocation_name)->size
+ strlen (hostname)
+ 2);
sprintf (x_id_name, "%s@%s", XSTRING (invocation_name)->data, hostname);
}
dup2 (ConnectionNumber (x_current_display), 0);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment