diff options
author | Ori Bernstein <ori@eigenstate.org> | 2020-11-01 11:56:26 -0800 |
---|---|---|
committer | Ori Bernstein <ori@eigenstate.org> | 2020-11-01 11:56:26 -0800 |
commit | d75d842cf576cb4785f89c5f5b73a4f73170001b (patch) | |
tree | 008a1cd386c97ee735ab2e1129eeda890093bcef /sys/src/cmd/rc/simple.c | |
parent | dbd54342fd66fd372f5c2edd1597019814f41c9c (diff) |
rc: show line numbers on error
This change provides a location for errors
like 'null list in concatenation'.
Diffstat (limited to 'sys/src/cmd/rc/simple.c')
-rw-r--r-- | sys/src/cmd/rc/simple.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sys/src/cmd/rc/simple.c b/sys/src/cmd/rc/simple.c index 8971f201f..3987dbe5a 100644 --- a/sys/src/cmd/rc/simple.c +++ b/sys/src/cmd/rc/simple.c @@ -11,8 +11,15 @@ */ int exitnext(void){ - union code *c=&runq->code[runq->pc]; - while(c->f==Xpopredir || c->f==Xunlocal) c++; + code *c=&runq->code[runq->pc]; + while(1){ + if(c->f==Xpopredir || c->f==Xunlocal) + c++; + else if(c->f==Xsrcline || c->f==Xsrcfile) + c += 2; + else + break; + } return c->f==Xexit; } @@ -260,6 +267,7 @@ void execcmds(io *f) { static int first = 1; + if(first){ rdcmds[0].i = 1; rdcmds[1].f = Xrdcmds; @@ -319,6 +327,7 @@ execdot(void) } else eflagok = 1; + popword(); if(p->argv->words && strcmp(p->argv->words->word, "-i")==0){ iflag = 1; @@ -354,6 +363,9 @@ execdot(void) Xerror(".: can't open"); return; } + + lexline = 1; + /* set up for a new command loop */ start(dotcmds, 1, (struct var *)0); pushredir(RCLOSE, fd, 0); |