From: noname Date: Fri, 25 Apr 2014 14:48:38 +0000 (+0400) Subject: Flush stdout to change xterm title. X-Git-Tag: v0.22~10 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=369b13a2af81efe79f1dde1ccebedd7a7b049b80;p=ncmpc.git Flush stdout to change xterm title. If stdout is not flushed, printf may not terminate control string properly. This way xterm title changes only sometimes. Also use standard (ECMA-048) control string terminator ^[\ instead of \a. --- diff --git a/src/screen_utils.c b/src/screen_utils.c index 1c1f14b..4bb1875 100644 --- a/src/screen_utils.c +++ b/src/screen_utils.c @@ -170,7 +170,8 @@ set_xterm_title(const char *format, ...) va_start(ap,format); char *msg = g_strdup_vprintf(format,ap); va_end(ap); - printf("%c]0;%s%c", '\033', msg, '\007'); + printf("\033]0;%s\033\\", msg); + fflush(stdout); g_free(msg); } else options.enable_xterm_title = FALSE;