summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Cohen <bencoh@notk.org>2012-10-21 12:51:01 +0200
committerBenjamin Cohen <bencoh@notk.org>2012-10-21 12:51:01 +0200
commitf49a112911e625f2ab4ceaa5b23d7ae10d38def3 (patch)
treec489fd81a2c20dd06b30134a02f1d46f46d5ef1c
parent919aa42cdc36470c0e447b72fb2d3f305e90c2e1 (diff)
Do not trim space (' ') from bodyHEADmaster
-rw-r--r--config_load.c2
-rw-r--r--util.c20
-rw-r--r--util.h1
3 files changed, 20 insertions, 3 deletions
diff --git a/config_load.c b/config_load.c
index bcebd92..6ae0e3a 100644
--- a/config_load.c
+++ b/config_load.c
@@ -1001,7 +1001,7 @@ static RcLoadStatus config_load (ParserState *ps)
if (*ps->statement == '\0')
continue;
- string_rtrim (ps->statement);
+ string_rtrim_space (ps->statement);
result = process_statement (ps);
}
diff --git a/util.c b/util.c
index 7a9db3c..24ce2d7 100644
--- a/util.c
+++ b/util.c
@@ -55,9 +55,9 @@ void string_rtrim (char *str)
char *end = 0;
while (str && *str) {
- if (end && !isspace (*str)) {
+ if (end && !(isspace (*str) && *str != ' ')) {
end = 0;
- } else if (!end && isspace (*str)) {
+ } else if (!end && (isspace (*str) && *str != ' ')) {
end = str;
}
@@ -68,4 +68,20 @@ void string_rtrim (char *str)
*end = '\0';
}
+void string_rtrim_space (char *str)
+{
+ char *end = 0;
+ while (str && *str) {
+ if (end && !isspace (*str)) {
+ end = 0;
+ } else if (!end && isspace (*str)) {
+ end = str;
+ }
+
+ ++str;
+ }
+
+ if (end)
+ *end = '\0';
+}
diff --git a/util.h b/util.h
index 0103af7..346e466 100644
--- a/util.h
+++ b/util.h
@@ -26,6 +26,7 @@
int num_digits (unsigned long value);
int extract_number (char **cp);
void string_rtrim (char *str);
+void string_rtrim_space (char *str);