diff options
author | ru <ru@FreeBSD.org> | 2004-03-10 21:51:06 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2004-03-10 21:51:06 +0000 |
commit | 476dad3fbe27fd4811058bbb00cf3dc6ed2cdf21 (patch) | |
tree | 00224d5f27384592cf997f3a61bd432144bbc77c /usr.bin/make/for.c | |
parent | 263999b14d714a98d600885cba9f4a7c43a567ec (diff) | |
download | FreeBSD-src-476dad3fbe27fd4811058bbb00cf3dc6ed2cdf21.zip FreeBSD-src-476dad3fbe27fd4811058bbb00cf3dc6ed2cdf21.tar.gz |
Reworked the fix to print the useful line number on error in
the .for loop:
- Replaced four global variables in parse.c with one.
- Made Parse_FromString() accept the "lineno" as an argument.
- Fixed line numbering when there are escaped newlines in the
body of the .for loop.
Adopted from: NetBSD
Diffstat (limited to 'usr.bin/make/for.c')
-rw-r--r-- | usr.bin/make/for.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/make/for.c b/usr.bin/make/for.c index a194ef9..6502401 100644 --- a/usr.bin/make/for.c +++ b/usr.bin/make/for.c @@ -81,6 +81,7 @@ typedef struct _For { Buffer buf; /* Unexpanded buffer */ char* var; /* Index name */ Lst lst; /* List of variables */ + int lineno; /* Line # */ } For; static int ForExec(void *, void *); @@ -254,7 +255,7 @@ ForExec(void *namep, void *argp) Var_Set(arg->var, name, VAR_GLOBAL); DEBUGF(FOR, ("--- %s = %s\n", arg->var, name)); Parse_FromString(Var_Subst(arg->var, (char *) Buf_GetAll(arg->buf, &len), - VAR_GLOBAL, FALSE)); + VAR_GLOBAL, FALSE), arg->lineno); Var_Delete(arg->var, VAR_GLOBAL); return 0; @@ -275,7 +276,7 @@ ForExec(void *namep, void *argp) *----------------------------------------------------------------------- */ void -For_Run(void) +For_Run(int lineno) { For arg; @@ -284,6 +285,7 @@ For_Run(void) arg.var = forVar; arg.buf = forBuf; arg.lst = forLst; + arg.lineno = lineno; forVar = NULL; forBuf = NULL; forLst = NULL; |