mc/mc-userhost.patch
Jindrich Novy 65f3b0ed3f - update from CVS
- sync with .utf8 patch and some minor gcc4 fixups
- add .fixes patch
- drop upstreamed .spaceprompt patch
- update .userhost, .64bit patch
2005-06-06 13:25:29 +00:00

34 lines
977 B
Diff

--- mc-4.6.1a/src/main.c.userhost 2005-06-06 13:35:08.926427736 +0200
+++ mc-4.6.1a/src/main.c 2005-06-06 13:39:11.551543112 +0200
@@ -32,6 +32,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
+#include <pwd.h>
#include "global.h"
#include "tty.h"
@@ -1611,9 +1612,22 @@ void
update_xterm_title_path (void)
{
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 ((unsigned char) *s))