Remove trailing whitespace from wordexp-ed strings
Previous implementation was always leaving a trailing whitespace at the end of the expanded string (used in window title, description text, etc.). Now it doesn't happen.
This commit is contained in:
parent
a1ee2e69a5
commit
0c3ec9212f
|
@ -2002,7 +2002,7 @@ static size_t generate_env_text(struct imv *imv, char *buf, size_t buf_len, cons
|
|||
setenv("IFS", "", 1);
|
||||
if (wordexp(format, &word, 0) == 0) {
|
||||
for (size_t i = 0; i < word.we_wordc; ++i) {
|
||||
len += snprintf(buf + len, buf_len - len, "%s ", word.we_wordv[i]);
|
||||
len += snprintf(buf + len, buf_len - len, (i ? " %s" : "%s"), word.we_wordv[i]);
|
||||
}
|
||||
wordfree(&word);
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue