mirror of
https://git.savannah.gnu.org/git/make.git
synced 2024-12-28 15:57:48 +00:00
(chop_commands): Use find_char_unquote to find newlines.
This commit is contained in:
parent
f6716d5e74
commit
7eeab2fbe1
1 changed files with 4 additions and 17 deletions
21
commands.c
21
commands.c
|
@ -203,27 +203,14 @@ chop_commands (cmds)
|
||||||
|
|
||||||
nlines = 5;
|
nlines = 5;
|
||||||
lines = (char **) xmalloc (5 * sizeof (char *));
|
lines = (char **) xmalloc (5 * sizeof (char *));
|
||||||
idx = 0;
|
idx = strlen (cmds->commands) + 1;
|
||||||
p = cmds->commands;
|
p = (char *) alloca (idx);
|
||||||
|
bcopy (cmds->commands, p, idx);
|
||||||
while (*p != '\0')
|
while (*p != '\0')
|
||||||
{
|
{
|
||||||
char *end = p;
|
char *end = find_char_unquote (p, '\n', 0);
|
||||||
find_end:;
|
|
||||||
end = index (end, '\n');
|
|
||||||
if (end == 0)
|
if (end == 0)
|
||||||
end = p + strlen (p);
|
end = p + strlen (p);
|
||||||
else if (end > p && end[-1] == '\\')
|
|
||||||
{
|
|
||||||
int backslash = 1;
|
|
||||||
register char *b;
|
|
||||||
for (b = end - 2; b >= p && *b == '\\'; --b)
|
|
||||||
backslash = !backslash;
|
|
||||||
if (backslash)
|
|
||||||
{
|
|
||||||
++end;
|
|
||||||
goto find_end;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (idx == nlines)
|
if (idx == nlines)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue