scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit 6c16ba816db23662111f988f271039da34613d5f
parent 61d2c4a237f7382611c30f613ec9862150c28abf
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Fri, 19 Jan 2024 12:53:21 +0100

make: Remove first tab in continuation cmd lines

As it is specified in POSIX:

	When an escaped <newline> is found in a command line in a
	makefile, the command line shall contain the <backslash>,
	the <newline>, and the next line, except that the first
	character of the next line shall not be included if it
	is a <tab>.

So, the first character of the continuation line must be removed
only if it is a tabulator.

Diffstat:
Msrc/cmd/make/parser.c | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/cmd/make/parser.c b/src/cmd/make/parser.c @@ -713,8 +713,11 @@ readcmd(void) if (c == '\n') break; if (c == '\\') { - if ((c = nextc()) == '\n') + if ((c = nextc()) == '\n') { + if ((c = nextc()) != '\t') + back(c); continue; + } back(c); c = '\\'; }