]> git.lizzy.rs Git - plan9front.git/blobdiff - sys/src/cmd/rc/simple.c
git/branch: somewhere in the syncing, the fix for junk files was lost
[plan9front.git] / sys / src / cmd / rc / simple.c
index 982b73cda3633def3269a5295ea0a234126ff7ac..3987dbe5ad6f952f218f2a244c408397410b0b50 100644 (file)
  */
 int
 exitnext(void){
-       union code *c=&runq->code[runq->pc];
-       while(c->f==Xpopredir) 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);