Blob Blame History Raw
--- mc-4.6.1-pre5/src/main.c.userhost	2005-07-08 11:04:37.718907992 +0200
+++ mc-4.6.1-pre5/src/main.c	2005-07-08 11:07:53.888085744 +0200
@@ -33,6 +33,7 @@
 #   include <unistd.h>
 #endif
 
+#include <pwd.h>
 #include <errno.h>
 #include <ctype.h>
 #include <signal.h>
@@ -1607,9 +1608,22 @@ void
 update_xterm_title_path (void)
 {
     unsigned char *p, *s;
+    char h[64];
+    struct passwd *pw;
 
     if (xterm_flag && xterm_title) {
 	p = s = g_strdup (strip_home_and_password (current_panel->cwd));
+        if ( !gethostname (h, 64) ) {
+                h[63] = '\0'; /* Be sure the hostname is NUL terminated */
+                s = g_strdup_printf ("%s:%s", h, s);
+                g_free (p);
+                p = s;
+        }
+        if ( (pw = getpwuid(getuid())) ) {
+                s = g_strdup_printf ("%s@%s", pw->pw_name, s);
+                g_free (p);
+                p = s;
+        }
 	do {
 #ifndef UTF8
 	    if (!is_printable (*s))