During variable expansion, the internal representation of the expression

might be relocated.  Handle this case.
PR:		7059
This commit is contained in:
Tor Egge 1999-04-13 04:13:09 +00:00
parent 87c737bc83
commit c4e5a8a8b9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=45644

View File

@ -39,7 +39,7 @@
static char sccsid[] = "@(#)expand.c 8.5 (Berkeley) 5/15/95";
#endif
static const char rcsid[] =
"$Id: expand.c,v 1.24 1998/09/13 19:24:57 tegge Exp $";
"$Id: expand.c,v 1.25 1999/04/09 15:23:48 tegge Exp $";
#endif /* not lint */
#include <sys/types.h>
@ -646,7 +646,7 @@ evalvar(p, flag)
int varflags;
char *var;
char *val;
char *pat;
int patloc;
int c;
int set;
int special;
@ -744,10 +744,10 @@ evalvar(p, flag)
* right after it
*/
STPUTC('\0', expdest);
pat = expdest;
if (subevalvar(p, NULL, expdest - stackblock(), subtype,
patloc = expdest - stackblock();
if (subevalvar(p, NULL, patloc, subtype,
startloc, varflags) == 0) {
int amount = (expdest - pat) + 1;
int amount = (expdest - stackblock() - patloc) + 1;
STADJUST(-amount, expdest);
}
/* Remove any recorded regions beyond start of variable */