[PATCH setup 2/3] Change the interpretation of '#' in setup.rc
Ken Brown
kbrown@cornell.edu
Tue Nov 28 14:56:00 GMT 2017
'#' 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 f4917ec..b90d795 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.15.0
More information about the Cygwin-apps
mailing list