e52ead9
--- mc-4.6.1a/src/main.c.hostname	2005-03-23 13:59:31.198747928 +0100
e52ead9
+++ mc-4.6.1a/src/main.c	2005-03-23 16:00:49.135333392 +0100
e52ead9
@@ -32,6 +32,7 @@
e52ead9
 #include <sys/types.h>
e52ead9
 #include <sys/stat.h>
e52ead9
 #include <unistd.h>
e52ead9
+#include <pwd.h>
e52ead9
 
e52ead9
 #include "global.h"
e52ead9
 #include "tty.h"
e52ead9
@@ -1612,9 +1613,22 @@ void
e52ead9
 update_xterm_title_path (void)
e52ead9
 {
e52ead9
     unsigned char *p, *s;
e52ead9
+    char h[64];
e52ead9
+    struct passwd *pw;
e52ead9
 
e52ead9
     if (xterm_flag && xterm_title) {
e52ead9
 	p = s = g_strdup (strip_home_and_password (current_panel->cwd));
e52ead9
+	if ( !gethostname (h, 64) ) {
e52ead9
+		h[63] = '\0'; /* Be sure the hostname is NUL terminated */
e52ead9
+		s = g_strdup_printf ("%s:%s", h, s);
e52ead9
+		g_free (p);
e52ead9
+		p = s;
e52ead9
+	}
e52ead9
+	if ( (pw = getpwuid(getuid())) ) {
e52ead9
+		s = g_strdup_printf ("%s@%s", pw->pw_name, s);
e52ead9
+		g_free (p);
e52ead9
+		p = s;
e52ead9
+	}
e52ead9
 	do {
e52ead9
 	    if (*s < ' ')
e52ead9
 		*s = '?';