Bugfix: Strip trailing whitespace when parsing assignments (Thanks bapt)

This commit is contained in:
Michael Stapelberg 2009-07-21 16:05:43 +02:00
parent b893ec9987
commit 008a2665c1

View File

@ -260,6 +260,10 @@ void load_configuration(xcb_connection_t *conn, const char *override_configpath)
*end = '\0'; *end = '\0';
} }
/* Strip trailing whitespace */
while (strlen(value) > 0 && value[strlen(value)-1] == ' ')
value[strlen(value)-1] = '\0';
/* The target is the last argument separated by a space */ /* The target is the last argument separated by a space */
if ((target = strrchr(value, ' ')) == NULL) if ((target = strrchr(value, ' ')) == NULL)
die("Malformed assignment, couldn't find target\n"); die("Malformed assignment, couldn't find target\n");