summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3a6dbcb)
raw | patch | inline | side by side (parent: 3a6dbcb)
author | Max Kellermann <max.kellermann@gmail.com> | |
Mon, 20 Mar 2017 16:06:02 +0000 (17:06 +0100) | ||
committer | Max Kellermann <max.kellermann@gmail.com> | |
Mon, 20 Mar 2017 16:06:02 +0000 (17:06 +0100) |
src/main.c | patch | blob | history |
diff --git a/src/main.c b/src/main.c
index 72a9362e53e2cee8f3766484e32a9739765b1dfc..a8fb3b36f654a93e4157c46baa594108dbf03153 100644 (file)
--- a/src/main.c
+++ b/src/main.c
const struct mpd_song *song = mpd->song;
char tmp[BUFSIZE];
+ const char *new_title = NULL;
if (options.xterm_title_format && mpd->playing && song)
- strfsong(tmp, BUFSIZE, options.xterm_title_format, song);
- else
- *tmp = 0;
+ new_title = strfsong(tmp, BUFSIZE, options.xterm_title_format, song) > 0
+ ? tmp
+ : NULL;
- if (*tmp == 0)
- g_strlcpy(tmp, PACKAGE " version " VERSION, BUFSIZE);
+ if (new_title == NULL)
+ new_title = PACKAGE " version " VERSION;
static char title[BUFSIZE];
- if (strncmp(title, tmp, BUFSIZE)) {
- g_strlcpy(title, tmp, BUFSIZE);
+ if (strncmp(title, new_title, BUFSIZE)) {
+ g_strlcpy(title, new_title, BUFSIZE);
set_xterm_title(title);
}
}