summaryrefslogtreecommitdiff
path: root/src/gui/curses/gui-curses-window.c
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2008-05-15 23:23:50 +0200
committerSebastien Helleu <flashcode@flashtux.org>2008-05-15 23:23:50 +0200
commit8b62667111e324caba431e759b17f31e413f8c6a (patch)
tree2e34f6db947b88c47e6e7c87c2d69e3980f4aea2 /src/gui/curses/gui-curses-window.c
parent91084108ae84755b073661c5fcb757db32b53eac (diff)
downloadweechat-8b62667111e324caba431e759b17f31e413f8c6a.zip
Fix crash on FreeBSD 7 with term title reset
Diffstat (limited to 'src/gui/curses/gui-curses-window.c')
-rw-r--r--src/gui/curses/gui-curses-window.c9
1 files 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 <stdlib.h>
#include <string.h>
+#include <libgen.h>
#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