Mercurial > emacs
comparison src/xterm.c @ 398:a60eafebd43f
*** empty log message ***
author | Jim Blandy <jimb@redhat.com> |
---|---|
date | Fri, 16 Aug 1991 16:09:27 +0000 |
parents | b5cc63711808 |
children | 10b1795f3ae9 |
comparison
equal
deleted
inserted
replaced
397:a17df2fec87b | 398:a60eafebd43f |
---|---|
159 static FONT_TYPE *icon_font_info; | 159 static FONT_TYPE *icon_font_info; |
160 | 160 |
161 /* Stuff for dealing with the main icon title. */ | 161 /* Stuff for dealing with the main icon title. */ |
162 | 162 |
163 extern Lisp_Object Vcommand_line_args; | 163 extern Lisp_Object Vcommand_line_args; |
164 char *hostname, *x_id_name; | |
164 Lisp_Object invocation_name; | 165 Lisp_Object invocation_name; |
165 | 166 |
166 /* This is the X connection that we are using. */ | 167 /* This is the X connection that we are using. */ |
167 | 168 |
168 Display *x_current_display; | 169 Display *x_current_display; |
3581 fatal ("X server %s not responding; check the DISPLAY environment variable or use \"-d\"\n", | 3582 fatal ("X server %s not responding; check the DISPLAY environment variable or use \"-d\"\n", |
3582 display_name); | 3583 display_name); |
3583 | 3584 |
3584 #ifdef HAVE_X11 | 3585 #ifdef HAVE_X11 |
3585 { | 3586 { |
3587 int hostname_size = MAXHOSTNAMELEN + 1; | |
3588 | |
3589 hostname = (char *) xmalloc (hostname_size); | |
3590 | |
3586 #if 0 | 3591 #if 0 |
3587 XSetAfterFunction (x_current_display, x_trace_wire); | 3592 XSetAfterFunction (x_current_display, x_trace_wire); |
3588 #endif | 3593 #endif |
3589 | 3594 |
3590 invocation_name = Ffile_name_nondirectory (Fcar (Vcommand_line_args)); | 3595 invocation_name = Ffile_name_nondirectory (Fcar (Vcommand_line_args)); |
3596 | |
3597 /* Try to get the host name; if the buffer is too short, try | |
3598 again. Apparently, the only indication gethostname gives of | |
3599 whether the buffer was large enough is the presence or absence | |
3600 of a '\0' in the string. Eech. */ | |
3601 for (;;) | |
3602 { | |
3603 gethostname (hostname, hostname_size - 1); | |
3604 hostname[hostname_size - 1] = '\0'; | |
3605 | |
3606 /* Was the buffer large enough for gethostname to store the '\0'? */ | |
3607 if (strlen (hostname) < hostname_size - 1) | |
3608 break; | |
3609 | |
3610 hostname_size <<= 1; | |
3611 hostname = (char *) xrealloc (hostname, hostname_size); | |
3612 } | |
3613 x_id_name = (char *) xmalloc (XSTRING (invocation_name)->size | |
3614 + strlen (hostname) | |
3615 + 2); | |
3616 sprintf (x_id_name, "%s@%s", XSTRING (invocation_name)->data, hostname); | |
3591 } | 3617 } |
3592 | 3618 |
3593 dup2 (ConnectionNumber (x_current_display), 0); | 3619 dup2 (ConnectionNumber (x_current_display), 0); |
3594 | 3620 |
3595 #ifndef SYSV_STREAMS | 3621 #ifndef SYSV_STREAMS |