This is the mail archive of the cygwin-apps mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH setup 2/3] 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 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]