From 55ea101de40f84cf52160d2d07ee9a170ee7b0e5 Mon Sep 17 00:00:00 2001 From: Ken Brown Date: Tue, 28 Nov 2017 08:45:44 -0500 Subject: [PATCH] Change the interpretation of '#' in setup.rc '#' was treated as a comment character in all circumstances. Since saved gpg keys contain '#', this caused the "extrakeys" user setting to get truncated. Change this so that '#' only indicates a comment if it's the first non-whitespace character in a line. --- UserSettings.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/UserSettings.cc b/UserSettings.cc index f4917ec7..b90d7958 100644 --- a/UserSettings.cc +++ b/UserSettings.cc @@ -42,14 +42,14 @@ public: UserSettings *UserSettings::global; +// '#' indicates a comment if it's the first non-whitespace character. static char * trim (char *p) { p += strspn (p, " \t"); - char *q = strchr (p, '#'); - if (q) - *q = '\0'; - for (q = strchr (p, '\0') - 1; q >= p && (*q == ' ' || *q == '\t' || *q == '\r' || *q == '\n'); q--) + if (*p == '#') + *p = '\0'; + for (char *q = strchr (p, '\0') - 1; q >= p && (*q == ' ' || *q == '\t' || *q == '\r' || *q == '\n'); q--) *q = '\0'; return p; } -- 2.43.5