summaryrefslogtreecommitdiff
path: root/sys/src/cmd/rc/plan9.c
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2021-06-22 23:40:11 +0000
committerOri Bernstein <ori@eigenstate.org>2021-06-22 23:40:11 +0000
commit577033228209f28350dc3f75ef9d4ce88dfdf190 (patch)
tree7540037c6ffd83810da4209abbdd6879a484e075 /sys/src/cmd/rc/plan9.c
parentce73821f3575921e24f839b21c7be60520a9dc42 (diff)
rc: correct line numbers
When loading a file using ".", we could end up with our line numbers thrown off due to the mutation of lexline. Putting lexline into the runq beside the file that we're reading from causes it to get pushed and popped correctly, so that we no longer lose track of our location.
Diffstat (limited to 'sys/src/cmd/rc/plan9.c')
-rw-r--r--sys/src/cmd/rc/plan9.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/src/cmd/rc/plan9.c b/sys/src/cmd/rc/plan9.c
index 634570c26..fb375b270 100644
--- a/sys/src/cmd/rc/plan9.c
+++ b/sys/src/cmd/rc/plan9.c
@@ -166,8 +166,8 @@ Xrdfn(void)
else {
free(runq->cmdfile);
int f = open(runq->argv->words->word, 0);
- lexline = 0;
runq->cmdfile = strdup(runq->argv->words->word);
+ runq->lexline = 1;
runq->pc--;
popword();
if(f>=0) execcmds(openfd(f));