From a2522def5240d63af0756abec97c34c4040e4c3e Mon Sep 17 00:00:00 2001 From: h_vogt Date: Sun, 20 Oct 2013 11:41:56 +0200 Subject: [PATCH] inpcom.c: patch provided by Krzysztof Blaszkowski Allow spaces like { token } during parameter substitution --- src/frontend/inpcom.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index 5d06cab2e..e13bcfa12 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -3894,8 +3894,23 @@ inp_sort_params(struct line *start_card, struct line *end_card, struct line *car beg = str_ptr - 1; end = str_ptr + strlen(param_names[i]); if ((isspace(*beg) || *beg == '=') && - (isspace(*end) || *end == '\0' || *end == ')')) - { /* ')' added, any risks? h_vogt */ + (isspace(*end) || *end == '\0' || *end == ')')) { + if (isspace(*beg)) { + while (isspace(*beg)) + beg--; + if (*beg != '{') + beg++; + str_ptr = beg; + } + if (isspace(*end)) { + /* possible case: "{ length }" -> {length} */ + while (*end && isspace(*end)) + end++; + if (*end == '}') + end++; + else + end--; + } *str_ptr = '\0'; if (*end != '\0') { new_str = TMALLOC(char, strlen(curr_line) + strlen(param_names[i]) + strlen(end) + 3);