diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2008-09-29 08:46:21 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2008-09-29 08:46:21 +0000 |
commit | 59dd1491c64886492f2fd20e6929a890c844034a (patch) | |
tree | 8d883ea2c4b1a8796b55f92c92c4f79a448c917f | |
parent | dd3a749ce985891e9fb0b57f0e2c139aea12d3e6 (diff) | |
download | zsh-59dd1491c64886492f2fd20e6929a890c844034a.tar.gz zsh-59dd1491c64886492f2fd20e6929a890c844034a.tar.xz zsh-59dd1491c64886492f2fd20e6929a890c844034a.zip |
users/13295, tweaked: dont reset line numbers when parsing strings, sometimes
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | Src/Modules/parameter.c | 2 | ||||
-rw-r--r-- | Src/Modules/zpty.c | 2 | ||||
-rw-r--r-- | Src/Modules/zutil.c | 2 | ||||
-rw-r--r-- | Src/builtin.c | 4 | ||||
-rw-r--r-- | Src/exec.c | 16 | ||||
-rw-r--r-- | Src/glob.c | 2 | ||||
-rw-r--r-- | Src/parse.c | 2 |
8 files changed, 25 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog index fc6debf1a..cd8949e39 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-09-29 Peter Stephenson <pws@csr.com> + + * users/13295 (with tweak always to keep old line numbers at + exit from parse_string()): Src/builtin.c, Src/exec.c, Src/glob.c, + Src/parse.c, Src/Modules/parameter.c, Src/Modules/zpty.c, + Src/Modules/zutil.c: don't reset $LINENO when parsing strings + unless the surrounding environment provides support (funcstack + etc.) for it. + 2008-09-28 Clint Adams <clint@zsh.org> * 25764: Completion/Unix/Command/.distfiles, diff --git a/Src/Modules/parameter.c b/Src/Modules/parameter.c index 4e1205ec8..e3fb909ea 100644 --- a/Src/Modules/parameter.c +++ b/Src/Modules/parameter.c @@ -279,7 +279,7 @@ setfunction(char *name, char *val, int dis) val = metafy(val, strlen(val), META_REALLOC); - prog = parse_string(val); + prog = parse_string(val, 1); if (!prog || prog == &dummy_eprog) { zwarn("invalid function definition", value); diff --git a/Src/Modules/zpty.c b/Src/Modules/zpty.c index 4076a5b7e..6c332b270 100644 --- a/Src/Modules/zpty.c +++ b/Src/Modules/zpty.c @@ -299,7 +299,7 @@ newptycmd(char *nam, char *pname, char **args, int echo, int nblock) if (!ineval) scriptname = "(zpty)"; - prog = parse_string(zjoin(args, ' ', 1)); + prog = parse_string(zjoin(args, ' ', 1), 0); if (!prog) { errflag = 0; scriptname = oscriptname; diff --git a/Src/Modules/zutil.c b/Src/Modules/zutil.c index 76056308f..698b7e3bd 100644 --- a/Src/Modules/zutil.c +++ b/Src/Modules/zutil.c @@ -251,7 +251,7 @@ setstypat(Style s, char *pat, Patprog prog, char **vals, int eval) if (eval) { int ef = errflag; - eprog = parse_string(zjoin(vals, ' ', 1)); + eprog = parse_string(zjoin(vals, ' ', 1), 0); errflag = ef; if (!eprog) diff --git a/Src/builtin.c b/Src/builtin.c index 02f843bf8..51fc332fa 100644 --- a/Src/builtin.c +++ b/Src/builtin.c @@ -4781,7 +4781,7 @@ bin_eval(UNUSED(char *nam), char **argv, UNUSED(Options ops), UNUSED(int func)) } else fpushed = 0; - prog = parse_string(zjoin(argv, ' ', 1)); + prog = parse_string(zjoin(argv, ' ', 1), 1); if (prog) { if (wc_code(*prog->prog) != WC_LIST) { /* No code to execute */ @@ -5781,7 +5781,7 @@ bin_trap(char *name, char **argv, UNUSED(Options ops), UNUSED(int func)) arg = *argv++; if (!*arg) prog = &dummy_eprog; - else if (!(prog = parse_string(arg))) { + else if (!(prog = parse_string(arg, 1))) { zwarnnam(name, "couldn't parse trap command"); return 1; } diff --git a/Src/exec.c b/Src/exec.c index 36e381eaa..bf23a34da 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -188,15 +188,17 @@ static struct builtin commandbn = /**/ mod_export Eprog -parse_string(char *s) +parse_string(char *s, int reset_lineno) { Eprog p; - zlong oldlineno = lineno; + zlong oldlineno; lexsave(); inpush(s, INP_LINENO, NULL); strinbeg(0); - lineno = 1; + oldlineno = lineno; + if (reset_lineno) + lineno = 1; p = parse_list(); lineno = oldlineno; if (tok == LEXERR && !lastval) @@ -954,7 +956,7 @@ execstring(char *s, int dont_change_job, int exiting) Eprog prog; pushheap(); - if ((prog = parse_string(s))) + if ((prog = parse_string(s, 0))) execode(prog, dont_change_job, exiting); popheap(); } @@ -3445,7 +3447,7 @@ getoutput(char *cmd, int qt) pid_t pid; char *s; - if (!(prog = parse_string(cmd))) + if (!(prog = parse_string(cmd, 0))) return NULL; if ((s = simple_redir_name(prog, REDIR_READ))) { @@ -3566,7 +3568,7 @@ parsecmd(char *cmd) return NULL; } *str = '\0'; - if (str[1] || !(prog = parse_string(cmd + 2))) { + if (str[1] || !(prog = parse_string(cmd + 2, 0))) { zerr("parse error in process substitution"); return NULL; } @@ -4453,7 +4455,7 @@ getfpfunc(char *s, int *ksh, char **fname) d = metafy(d, rlen, META_REALLOC); scriptname = dupstring(s); - r = parse_string(d); + r = parse_string(d, 1); scriptname = oldscriptname; if (fname) diff --git a/Src/glob.c b/Src/glob.c index 96bce0ed2..f8d7b5ad0 100644 --- a/Src/glob.c +++ b/Src/glob.c @@ -3329,7 +3329,7 @@ qualsheval(char *name, UNUSED(struct stat *buf), UNUSED(off_t days), char *str) { Eprog prog; - if ((prog = parse_string(str))) { + if ((prog = parse_string(str, 0))) { int ef = errflag, lv = lastval, ret; unsetparam("reply"); diff --git a/Src/parse.c b/Src/parse.c index eea68cd8c..6ff73a831 100644 --- a/Src/parse.c +++ b/Src/parse.c @@ -2831,7 +2831,7 @@ build_dump(char *nam, char *dump, char **files, int ali, int map, int flags) close(fd); file = metafy(file, flen, META_REALLOC); - if (!(prog = parse_string(file)) || errflag) { + if (!(prog = parse_string(file, 1)) || errflag) { errflag = 0; close(dfd); zfree(file, flen); |