mirror of
https://git.savannah.gnu.org/git/make.git
synced 2025-01-27 01:27:58 +00:00
[SV 45049] Check for '$' being the last character in a string.
* expand.c (variable_expand_string): Add a single '$' if '$' ends the string. * read.c (find_char_unquote, get_next_mword): Stop if '$' ends the string. * variable.c (parse_variable_definition): Ditto.
This commit is contained in:
parent
9ef06be018
commit
0205d3d08c
3 changed files with 12 additions and 5 deletions
9
expand.c
9
expand.c
|
@ -235,8 +235,10 @@ variable_expand_string (char *line, const char *string, long length)
|
|||
switch (*p)
|
||||
{
|
||||
case '$':
|
||||
/* $$ seen means output one $ to the variable output buffer. */
|
||||
o = variable_buffer_output (o, p, 1);
|
||||
case '\0':
|
||||
/* $$ or $ at the end of the string means output one $ to the
|
||||
variable output buffer. */
|
||||
o = variable_buffer_output (o, p1, 1);
|
||||
break;
|
||||
|
||||
case '(':
|
||||
|
@ -381,9 +383,6 @@ variable_expand_string (char *line, const char *string, long length)
|
|||
}
|
||||
break;
|
||||
|
||||
case '\0':
|
||||
break;
|
||||
|
||||
default:
|
||||
if (isblank ((unsigned char)p[-1]))
|
||||
break;
|
||||
|
|
6
read.c
6
read.c
|
@ -2262,6 +2262,10 @@ find_char_unquote (char *string, int map)
|
|||
{
|
||||
char openparen = p[1];
|
||||
|
||||
/* Check if '$' is the last character in the string. */
|
||||
if (openparen == '\0')
|
||||
break;
|
||||
|
||||
p += 2;
|
||||
|
||||
/* Skip the contents of a non-quoted, multi-char variable ref. */
|
||||
|
@ -2735,6 +2739,8 @@ get_next_mword (char *buffer, char *delim, char **startp, unsigned int *length)
|
|||
c = *(p++);
|
||||
if (c == '$')
|
||||
break;
|
||||
if (c == '\0')
|
||||
goto done_word;
|
||||
|
||||
/* This is a variable reference, so note that it's expandable.
|
||||
Then read it to the matching close paren. */
|
||||
|
|
|
@ -1445,6 +1445,8 @@ parse_variable_definition (const char *p, struct variable *var)
|
|||
closeparen = ')';
|
||||
else if (c == '{')
|
||||
closeparen = '}';
|
||||
else if (c == '\0')
|
||||
return NULL;
|
||||
else
|
||||
/* '$$' or '$X'. Either way, nothing special to do here. */
|
||||
continue;
|
||||
|
|
Loading…
Reference in a new issue