From 0df96793ef6aa103df228d7dfe56099b7d721a15 Mon Sep 17 00:00:00 2001 From: Rocky Bernstein Date: Tue, 11 Aug 2009 15:59:33 +1000 Subject: [SHELL] Add preliminary LINENO support Looks like in contrast to what the dash.1 manual page says, expansion of PS{1,2,4} does work. Here is a little patch to set LINENO. The ways in that it is less than ideal mirror the ways that the line number error reporting is also less than ideal. For example if you run this: ( x=$((1/0)) # Just to add another line # And another ) # error reports this line The error reported will be the closing parenthesis even though I think most people would prefer the error to be the one where x was set. Signed-off-by: Herbert Xu --- src/parser.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/parser.c') diff --git a/src/parser.c b/src/parser.c index 28a46c0..be20ff7 100644 --- a/src/parser.c +++ b/src/parser.c @@ -776,7 +776,7 @@ xxreadtoken(void) continue; case '\\': if (pgetc() == '\n') { - startlinno = ++plinno; + startlinno = lineno_inc(); if (doprompt) setprompt(2); continue; @@ -784,7 +784,7 @@ xxreadtoken(void) pungetc(); goto breakloop; case '\n': - plinno++; + lineno_inc(); needprompt = doprompt; RETURN(TNL); case PEOF: @@ -886,7 +886,7 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs) if (syntax == BASESYNTAX) goto endword; /* exit outer loop */ USTPUTC(c, out); - plinno++; + lineno_inc(); if (doprompt) setprompt(2); c = pgetc(); @@ -1065,7 +1065,7 @@ checkend: { if (c == '\n' || c == PEOF) { c = PEOF; - plinno++; + lineno_inc(); needprompt = doprompt; } else { int len; @@ -1315,7 +1315,7 @@ parsebackq: { case '\\': if ((pc = pgetc()) == '\n') { - plinno++; + lineno_inc(); if (doprompt) setprompt(2); /* @@ -1340,7 +1340,7 @@ parsebackq: { synerror("EOF in backquote substitution"); case '\n': - plinno++; + lineno_inc(); needprompt = doprompt; break; -- cgit 1.4.1 161bfe1bfbf1e34b1631b7cc1c1b95&follow=1'>root/.mailmap (unfollow)
Commit message (Expand)Author
2014-02-21Skip cache slot when time-to-live is zeroLukas Fleischer
2014-02-21git: Update to 1.9.0Lukas Fleischer
2014-02-20Makefile: suppress pkg-config errorJason A. Donenfeld
2014-02-20Add a cache-snapshot-ttl configuration variableLukas Fleischer
2014-02-20diffstat: do not rely on uninitialized dataJason A. Donenfeld
2014-02-05gen-version.sh: check if git is available before trying to call itFabien C
2014-01-23simple-authentication: styleJason A. Donenfeld
2014-01-22makefile: use LUA_PKGCONFIG to set Lua implementationNatanael Copa
2014-01-20tests: only do lua tests if lua is compiled-inJason A. Donenfeld
2014-01-20cgit: add --version argument for printing infoJason A. Donenfeld
2014-01-19cache: use sendfile() instead of a pair of read() + write()Sebastian Andrzej Siewior
2014-01-19README: document pkg-config for luajitJason A. Donenfeld
2014-01-17makefile: bump versionJason A. Donenfeld
2014-01-17mailmap: source before lighttpdJason A. Donenfeld
2014-01-17ui-shared: do not allow negative minutesJason A. Donenfeld
2014-01-17auth: document tweakables in lua scriptJason A. Donenfeld
2014-01-17repolist: make owner clickable to searchJason A. Donenfeld
2014-01-17ui-shared: move about tab all the way to the leftJason A. Donenfeld
2014-01-17filter: don't forget to reap the auth filterJason A. Donenfeld
2014-01-17cgit.c: free tmp variableJason A. Donenfeld
2014-01-17Switch to exclusively using global ctxLukas Fleischer
2014-01-16auth: have cgit calculate login addressJason A. Donenfeld
2014-01-16auth: lua string comparisons are time invariantJason A. Donenfeld
2014-01-16authentication: use hidden form instead of refererJason A. Donenfeld
2014-01-16auth: add basic authentication filter frameworkJason A. Donenfeld
2014-01-16t0111: Additions and fixesLukas Fleischer
2014-01-16parsing.c: Remove leading space from committerLukas Fleischer