Code

db_completion: use g_strconcat()
[ncmpc.git] / src / xterm_title.c
index fe03cfde11f80f8751978ea2332c0b24beffee96..cc4754a3383505f72d0b5b73cbf85be29acc8ab8 100644 (file)
 #include "xterm_title.h"
 #include "options.h"
 
-#include <glib.h>
-
 #include <stdio.h>
+#include <stdlib.h>
 
 void
-set_xterm_title(const char *format, ...)
+set_xterm_title(const char *title)
 {
        /* the current xterm title exists under the WM_NAME property */
        /* and can be retrieved with xprop -id $WINDOWID */
 
-       if (options.enable_xterm_title) {
-               if (g_getenv("WINDOWID")) {
-                       va_list ap;
-                       va_start(ap,format);
-                       char *msg = g_strdup_vprintf(format,ap);
-                       va_end(ap);
-                       printf("\033]0;%s\033\\", msg);
-                       fflush(stdout);
-                       g_free(msg);
-               } else
-                       options.enable_xterm_title = FALSE;
+       if (!options.enable_xterm_title)
+               return;
+
+       if (getenv("WINDOWID") == NULL) {
+               options.enable_xterm_title = FALSE;
+               return;
        }
+
+       printf("\033]0;%s\033\\", title);
+       fflush(stdout);
 }