=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/make/var.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- src/usr.bin/make/var.c 1998/07/23 18:49:05 1.9 +++ src/usr.bin/make/var.c 1998/12/05 00:06:29 1.10 @@ -1,4 +1,4 @@ -/* $OpenBSD: var.c,v 1.9 1998/07/23 18:49:05 deraadt Exp $ */ +/* $OpenBSD: var.c,v 1.10 1998/12/05 00:06:29 espie Exp $ */ /* $NetBSD: var.c,v 1.18 1997/03/18 19:24:46 christos Exp $ */ /* @@ -43,7 +43,7 @@ #if 0 static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94"; #else -static char rcsid[] = "$OpenBSD: var.c,v 1.9 1998/07/23 18:49:05 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: var.c,v 1.10 1998/12/05 00:06:29 espie Exp $"; #endif #endif /* not lint */ @@ -1236,17 +1236,20 @@ Boolean addSpace; /* TRUE if need to add a space to the * buffer before adding the trimmed * word */ - char **av; /* word list [first word does not count] */ + char **av; /* word list */ + char *as; /* word list memory */ int ac, i; buf = Buf_Init (0); addSpace = FALSE; - av = brk_string(str, &ac, FALSE); + av = brk_string(str, &ac, FALSE, &as); - for (i = 1; i < ac; i++) + for (i = 0; i < ac; i++) addSpace = (*modProc)(av[i], addSpace, buf, datum); + free(as); + free(av); Buf_AddByte (buf, '\0'); str = (char *)Buf_GetAll (buf, (int *)NULL); Buf_Destroy (buf, FALSE); @@ -1261,7 +1264,7 @@ * uninterpreted) and 2) unescaped $'s that aren't before * the delimiter (expand the variable substitution). * Return the expanded string or NULL if the delimiter was missing - * If pattern is specified, handle escaped ampersants, and replace + * If pattern is specified, handle escaped ampersands, and replace * unescaped ampersands with the lhs of the pattern. * * Results: