sh: kill off PER REP
authorAlan Cox <alan@linux.intel.com>
Sun, 10 May 2015 21:19:57 +0000 (22:19 +0100)
committerAlan Cox <alan@linux.intel.com>
Sun, 10 May 2015 21:19:57 +0000 (22:19 +0100)
Applications/V7/cmd/sh/blok.c
Applications/V7/cmd/sh/expand.c
Applications/V7/cmd/sh/mac.h
Applications/V7/cmd/sh/service.c
Applications/V7/cmd/sh/word.c

index 6607504..e53667d 100644 (file)
@@ -35,7 +35,7 @@ ADDRESS       alloc(nbytes)
        for (;;) {      INT             c=0;
                REG BLKPTR      p = blokp;
                REG BLKPTR      q;
-               REP     if(!busy(p)
+               do {    if(!busy(p)
                        ) {     while(!busy(q = p->word) DO p->word = q->word OD
                                if(ADR(q)-ADR(p) >= rbytes
                                ) {     blokp = BLK(ADR(p)+rbytes);
@@ -47,7 +47,7 @@ ADDRESS       alloc(nbytes)
                                ;}
                        ;}
                        q = p; p = BLK(Rcheat(p->word)&~BUSY);
-               PER     p>q || (c++)==0 );
+               } while (       p>q || (c++)==0 );
                addblok(rbytes);
        }
 }
index d9c1841..c0e7a1e 100644 (file)
@@ -77,8 +77,8 @@ INT   expand(as,rflg)
        ) {     /* check for rescan */
                REG STRING rs; rs=cs;
 
-               REP     if (*rs=='/' ) { rescan=rs; *rs=0; gchain=0 ;}
-               PER     *rs++ );
+               do {    if (*rs=='/' ) { rescan=rs; *rs=0; gchain=0 ;}
+               } while(*rs++ );
 
                // FIXME: readdir
                while(read(dirf, (void *)&entry, 32) == 32 && (trapnote&SIGSET) == 0
index bc7f010..121f3b3 100644 (file)
@@ -16,8 +16,6 @@
 
 #define DO     ){
 #define OD     ;}
-#define REP    do{
-#define PER    }while(
 
 #define TRUE   (-1)
 #define FALSE  0
index 2f13069..7e91841 100644 (file)
@@ -90,8 +90,8 @@ INT   pathopen(path, name)
 {
        REG UFD         f;
 
-       REP path=catpath(path,name);
-       PER (f=open(curstak(),0))<0 && path );
+       do { path=catpath(path,name);
+       } while ( (f=open(curstak(),0))<0 && path );
        return(f);
 }
 
index df76d5a..3fa8c92 100644 (file)
@@ -29,7 +29,7 @@ word()
 
        while((c=nextc(0), space(c)) );
        if(!eofmeta(c)
-       ) {     REP     if(c==LITERAL
+       ) {     do {    if(c==LITERAL
                        ) {     *argp++=(DQUOTE);
                                while((c=readc()) && c!=LITERAL
                                DO *argp++=(c|QUOTE); chkpr(c) OD
@@ -43,7 +43,7 @@ word()
                                        DO chkpr(c) OD
                                ;}
                        ;}
-               PER (c=nextc(0), !eofmeta(c)) );
+               } while ( (c=nextc(0), !eofmeta(c)) );
                argp=endstak(argp);
                if(!letter(((ARGPTR)argp)->argval[0]) ) { wdset=0 ;}
 
@@ -123,7 +123,7 @@ static readb()
        REG FILE        f=standin;
        REG INT         len;
 
-       REP     if(trapnote&SIGSET ) { newline(); sigchk() ;}
-       PER (len=read(f->fdes,f->fbuf,f->fsiz))<0 && trapnote );
+       do {    if(trapnote&SIGSET ) { newline(); sigchk() ;}
+       } while ( (len=read(f->fdes,f->fbuf,f->fsiz))<0 && trapnote );
        return(len);
 }