First bug picked up by the unit tests - delim wasn't always initialized.

Avoid putting '\' in test case script lines since shell's like that on
SunOS insist on interpreting them.
This commit is contained in:
sjg 2003-07-29 08:44:41 +00:00
parent 387af101cb
commit b806b12f2d
3 changed files with 16 additions and 14 deletions

View File

@ -1,4 +1,4 @@
# $Id: Makefile,v 1.3 2003/07/29 08:16:01 sjg Exp $
# $Id: Makefile,v 1.4 2003/07/29 08:44:42 sjg Exp $
#
# Unit tests for make(1)
# The main targets are:
@ -31,11 +31,12 @@ mod-ts:
@echo 'LIST:ts:S/two/2/="${LIST:ts:S/two/2/}"'
@echo 'LIST:S/two/2/:ts="${LIST:S/two/2/:ts}"'
@echo 'LIST:ts/:S/two/2/="${LIST:ts/:S/two/2/}"'
@echo 'LIST:ts\n="${LIST:ts\n}"'
@echo 'LIST:ts\t="${LIST:ts\t}"'
@echo 'LIST:ts\012:tu="${LIST:ts\012:tu}"'
@echo "Pretend the '/' in '/n' etc. below are back-slashes."
@echo 'LIST:ts/n="${LIST:ts\n}"'
@echo 'LIST:ts/t="${LIST:ts\t}"'
@echo 'LIST:ts/012:tu="${LIST:ts\012:tu}"'
@echo 'LIST:tx="${LIST:tx}"'
@echo 'LIST:ts\a:tu="${LIST:ts\a:tu}"'
@echo 'LIST:ts/a:tu="${LIST:ts\a:tu}"'
@echo 'FU_$@="${FU_${@:ts}:ts}"'
@echo 'FU_$@:ts:T="${FU_${@:ts}:ts:T}" == cool?'

View File

@ -7,24 +7,23 @@ LIST:ts="onetwothreefourfivesix"
LIST:ts:S/two/2/="one2threefourfivesix"
LIST:S/two/2/:ts="one2threefourfivesix"
LIST:ts/:S/two/2/="one/2/three/four/five/six"
LIST:ts\n="one
Pretend the '/' in '/n' etc. below are back-slashes.
LIST:ts/n="one
two
three
four
five
six"
LIST:ts\t="one two three four five six"
LIST:ts\012:tu="ONE
LIST:ts/t="one two three four five six"
LIST:ts/012:tu="ONE
TWO
THREE
FOUR
FIVE
SIX"
make: Bad modifier `:tx' for LIST
make: Unclosed substitution for LIST (/ missing)
LIST:tx="}"
make: Bad modifier `:ts\a' for LIST
make: Unclosed substitution for LIST (/ missing)
LIST:ts\a:tu="\a:tu}"
LIST:ts/a:tu="\a:tu}"
FU_mod-ts="a/b/cool"
FU_mod-ts:ts:T="cool" == cool?

View File

@ -1,4 +1,4 @@
/* $NetBSD: var.c,v 1.76 2003/07/28 22:52:10 sjg Exp $ */
/* $NetBSD: var.c,v 1.77 2003/07/29 08:44:41 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -39,14 +39,14 @@
*/
#ifdef MAKE_BOOTSTRAP
static char rcsid[] = "$NetBSD: var.c,v 1.76 2003/07/28 22:52:10 sjg Exp $";
static char rcsid[] = "$NetBSD: var.c,v 1.77 2003/07/29 08:44:41 sjg Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94";
#else
__RCSID("$NetBSD: var.c,v 1.76 2003/07/28 22:52:10 sjg Exp $");
__RCSID("$NetBSD: var.c,v 1.77 2003/07/29 08:44:41 sjg Exp $");
#endif
#endif /* not lint */
#endif
@ -2024,6 +2024,8 @@ Var_Parse(const char *str, GNode *ctxt, Boolean err, int *lengthPtr,
*/
*WR(tstr) = ':';
tstr++;
delim = '\0';
while (*tstr && *tstr != endc) {
char *newStr; /* New value to return */
char termc; /* Character which terminated scan */