From 8b62667111e324caba431e759b17f31e413f8c6a Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Thu, 15 May 2008 23:23:50 +0200 Subject: [PATCH] Fix crash on FreeBSD 7 with term title reset --- src/gui/curses/gui-curses-window.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/gui/curses/gui-curses-window.c b/src/gui/curses/gui-curses-window.c index 9e97f3eb2..d92d1052a 100644 --- a/src/gui/curses/gui-curses-window.c +++ b/src/gui/curses/gui-curses-window.c @@ -25,6 +25,7 @@ #include #include +#include #include "../../core/weechat.h" #include "../../core/wee-config.h" @@ -1794,6 +1795,7 @@ gui_window_title_set () void gui_window_title_reset () { + char *shell, *shellname; char *envterm = getenv ("TERM"); char *envshell = getenv ("SHELL"); @@ -1813,14 +1815,13 @@ gui_window_title_reset () printf ("\33]0;%s\7", "Terminal"); else if (strcmp (envterm, "screen") == 0) { - char *shell, *shellname; if (envshell) { - shell = strdup (envterm); - shellname = basename(shell); + shell = strdup (envshell); if (shell) { - printf ("\033k%s\033\\", shellname); + shellname = basename (shell); + printf ("\033k%s\033\\", (shellname) ? shellname : shell); free (shell); } else