Code

xterm_title: pass string, no format
authorMax Kellermann <max.kellermann@gmail.com>
Mon, 20 Mar 2017 16:02:00 +0000 (17:02 +0100)
committerMax Kellermann <max.kellermann@gmail.com>
Mon, 20 Mar 2017 16:02:00 +0000 (17:02 +0100)
src/main.c
src/xterm_title.c
src/xterm_title.h

index d4c5168a251694d539964e9ff70adf82bc6fd545..b67165f144f9eec225a338285ed9c96dcafe6cfd 100644 (file)
@@ -83,7 +83,7 @@ update_xterm_title(void)
        static char title[BUFSIZE];
        if (strncmp(title, tmp, BUFSIZE)) {
                g_strlcpy(title, tmp, BUFSIZE);
-               set_xterm_title("%s", title);
+               set_xterm_title(title);
        }
 }
 #endif
index fe03cfde11f80f8751978ea2332c0b24beffee96..0e993cf3b2d022f163103b787c2c4843f9d15e3f 100644 (file)
 #include "xterm_title.h"
 #include "options.h"
 
-#include <glib.h>
-
 #include <stdio.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);
+                       printf("\033]0;%s\033\\", title);
                        fflush(stdout);
-                       g_free(msg);
                } else
                        options.enable_xterm_title = FALSE;
        }
index 28addd5c1fdfdece802accdbe1d20ffb6b91ae68..d850f5c0fcd2f0410d586bb1624e45f28e1f585d 100644 (file)
@@ -21,6 +21,6 @@
 #define XTERM_TITLE_H
 
 void
-set_xterm_title(const char *format, ...);
+set_xterm_title(const char *title);
 
 #endif