Fix parsing of SUNSHCMD style :sh = assigments.

Submitted by: Will Andrews at freebsd.org
This commit is contained in:
sjg 2013-08-28 21:56:49 +00:00
parent 3db7caeeb3
commit ec98624792
4 changed files with 24 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: parse.c,v 1.190 2013/08/10 21:20:03 sjg Exp $ */
/* $NetBSD: parse.c,v 1.191 2013/08/28 21:56:49 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: parse.c,v 1.190 2013/08/10 21:20:03 sjg Exp $";
static char rcsid[] = "$NetBSD: parse.c,v 1.191 2013/08/28 21:56:49 sjg Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94";
#else
__RCSID("$NetBSD: parse.c,v 1.190 2013/08/10 21:20:03 sjg Exp $");
__RCSID("$NetBSD: parse.c,v 1.191 2013/08/28 21:56:49 sjg Exp $");
#endif
#endif /* not lint */
#endif
@ -1741,6 +1741,12 @@ Parse_IsVar(char *line)
ch = *line++;
wasSpace = TRUE;
}
#ifdef SUNSHCMD
if (ch == ':' && strncmp(line, "sh", 2) == 0) {
line += 2;
continue;
}
#endif
if (ch == '=')
return TRUE;
if (*line == '=' && ISEQOPERATOR(ch))

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.37 2013/07/16 19:59:28 sjg Exp $
# $NetBSD: Makefile,v 1.38 2013/08/28 21:56:50 sjg Exp $
#
# Unit tests for make(1)
# The main targets are:
@ -41,6 +41,7 @@ SUBFILES= \
phony-end \
posix \
qequals \
sunshcmd \
sysv \
ternary \
unexport \

View File

@ -0,0 +1,10 @@
BYECMD = echo bye
LATERCMD = echo later
TEST1 :sh = echo hello
TEST2 :sh = ${BYECMD}
TEST3 = ${LATERCMD:sh}
all:
@echo "TEST1=${TEST1}"
@echo "TEST2=${TEST2}"
@echo "TEST3=${TEST3}"

View File

@ -349,6 +349,9 @@ Now we expect an error...
*** Error code 1 (continuing)
`all' not remade because of errors.
V.i386 ?= OK
TEST1=hello
TEST2=bye
TEST3=later
FOOBAR =
FOOBAR = foobar fubar
fun