aboutsummaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-12-05 18:33:54 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-12-05 18:33:54 +0000
commit6da88ddf011815ca2d3a490306fceeb9821c9520 (patch)
treea2a77a8ff5d17a2f138d2d2ae1d8ddb230fe7c22 /config.c
parentPKGBUILD: require fcft 0.4.x (diff)
config: trim leading spaces from fonts
When splitting the font configuration into multiple font specifications, we now trim leading spaces. This makes no actual difference; fontconfig matched the fonts just fine anyway, but this looks better in the logs.
Diffstat (limited to 'config.c')
-rw-r--r--config.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/config.c b/config.c
index a0ca7f82..6f2d0bf8 100644
--- a/config.c
+++ b/config.c
@@ -174,8 +174,13 @@ parse_section_main(const char *key, const char *value, struct config *conf,
else if (strcmp(key, "font") == 0) {
char *copy = strdup(value);
- for (const char *font = strtok(copy, ","); font != NULL; font = strtok(NULL, ","))
- tll_push_back(conf->fonts, strdup(font));
+ for (const char *font = strtok(copy, ","); font != NULL; font = strtok(NULL, ",")) {
+ /* Trim spaces, strictly speaking not necessary, but looks nice :) */
+ while (*font != '\0' && isspace(*font))
+ font++;
+ if (*font != '\0')
+ tll_push_back(conf->fonts, strdup(font));
+ }
free(copy);
}