Skip to content

Commit

Permalink
make: fix incorrect handling of escaped newline
Browse files Browse the repository at this point in the history
Fix a bug in process_command() where an escaped newline followed
by a character other than tab resulted in premature termination
of the command.
  • Loading branch information
rmyorston committed Aug 28, 2022
1 parent 67a630e commit 182e489
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions miscutils/make.c
Original file line number Diff line number Diff line change
Expand Up @@ -1402,11 +1402,10 @@ process_command(char *s)
// Remove tab following escaped newline. Stop processing at a
// non-escaped newline.
for (t = u = s; *u && *u != '\n'; u++) {
if (u[0] == '\\' && u[1] == '\n' && u[2] == '\t') {
*t++ = *u++;
*t++ = *u++;
} else {
*t++ = *u;
*t++ = *u;
if (u[0] == '\\' && u[1] == '\n') {
*t++ = '\n';
u += (u[2] == '\t') ? 2 : 1;
}
}
*t = '\0';
Expand Down

0 comments on commit 182e489

Please sign in to comment.