* Unterminated string auto termination.

* %(el)if(n)idn insensitivity to string quotes difference (#809300).
This commit is contained in:
Nickolay Yurchenko 2003-09-21 20:38:43 +00:00
parent a31985e641
commit f3b3ce27bd
2 changed files with 28 additions and 9 deletions

View file

@ -1,6 +1,8 @@
0.98.39 0.98.39
------- -------
* "make spotless" no longer deletes config.h.in. * "make spotless" no longer deletes config.h.in.
* Unterminated string auto termination.
* %(el)if(n)idn insensitivity to string quotes difference (#809300).
0.98.38 0.98.38
------- -------

View file

@ -833,6 +833,7 @@ tokenise(char *line)
type = TOK_STRING; type = TOK_STRING;
while (*p && *p != c) while (*p && *p != c)
p++; p++;
if (*p) if (*p)
{ {
p++; p++;
@ -840,6 +841,7 @@ tokenise(char *line)
else else
{ {
error(ERR_WARNING, "unterminated string"); error(ERR_WARNING, "unterminated string");
type = -1;
} }
} }
else if (isnumstart(*p)) else if (isnumstart(*p))
@ -901,7 +903,15 @@ tokenise(char *line)
} }
p++; p++;
} }
if (type != TOK_COMMENT)
/* Handle unterminated string */
if (type == -1)
{
*tail = t = new_Token(NULL, TOK_STRING, line, p-line+1);
t->text[p-line] = *line;
tail = &t->next;
}
else if (type != TOK_COMMENT)
{ {
*tail = t = new_Token(NULL, type, line, p - line); *tail = t = new_Token(NULL, type, line, p - line);
tail = &t->next; tail = &t->next;
@ -1520,23 +1530,30 @@ if_condition(Token * tline, int i)
t = t->next; t = t->next;
continue; continue;
} }
else if (tt->type == TOK_WHITESPACE) if (tt->type == TOK_WHITESPACE)
{ {
tt = tt->next; tt = tt->next;
continue; continue;
} }
else if (tt->type != t->type || if (tt->type != t->type)
mstrcmp(tt->text, t->text, casesense))
{ {
j = FALSE; /* found mismatching tokens */ j = FALSE; /* found mismatching tokens */
break; break;
} }
else /* Unify surrounding quotes for strings */
if (t->type == TOK_STRING)
{ {
tt->text[0] = t->text[0];
tt->text[strlen(tt->text) - 1] = t->text[0];
}
if (mstrcmp(tt->text, t->text, casesense) != 0)
{
j = FALSE; /* found mismatching tokens */
break;
}
t = t->next; t = t->next;
tt = tt->next; tt = tt->next;
continue;
}
} }
if ((t->type != TOK_OTHER || strcmp(t->text, ",")) || tt) if ((t->type != TOK_OTHER || strcmp(t->text, ",")) || tt)
j = FALSE; /* trailing gunk on one end or other */ j = FALSE; /* trailing gunk on one end or other */