inpcom.c: patch provided by Krzysztof Blaszkowski

Allow spaces like { token } during parameter substitution
This commit is contained in:
h_vogt 2013-10-20 11:41:56 +02:00 committed by rlar
parent d5b1c4faa5
commit a2522def52
1 changed files with 17 additions and 2 deletions

View File

@ -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);