sh: kill off FOR
authorAlan Cox <alan@linux.intel.com>
Sun, 10 May 2015 21:13:05 +0000 (22:13 +0100)
committerAlan Cox <alan@linux.intel.com>
Sun, 10 May 2015 21:13:05 +0000 (22:13 +0100)
Applications/V7/cmd/sh/args.c
Applications/V7/cmd/sh/mac.h
Applications/V7/cmd/sh/print.c
Applications/V7/cmd/sh/service.c
Applications/V7/cmd/sh/xec.c

index 27fa6ad..84314b9 100644 (file)
@@ -95,7 +95,7 @@ freeargs(blk)
        if (argblk=blk
        ) {     argr = argblk->dolnxt;
                if ((--argblk->doluse)==0
-               ) {     FOR argp=(STRING *)argblk->dolarg; Rcheat(*argp)!=ENDARGS; argp++
+               ) {     for ( argp=(STRING *)argblk->dolarg; Rcheat(*argp)!=ENDARGS; argp++
                        DO free(*argp) OD
                        free(argblk);
                ;}
index 835fbd0..cffde0b 100644 (file)
@@ -14,7 +14,6 @@
 #define UNION  TYPE union
 #define REG    register
 
-#define FOR    for(
 #define WHILE  while(
 #define DO     ){
 #define OD     ;}
index 8115200..cb8795d 100644 (file)
@@ -74,7 +74,7 @@ itos(n)
 {
        REG char *abuf; REG POS a, i; INT pr, d;
        abuf=numbuf; pr=FALSE; a=n;
-       FOR i=10000; i!=1; i/=10
+       for (i=10000; i!=1; i/=10
        DO      if ((pr |= (d=a/i)) ) { *abuf++=d+'0' ;}
                a %= i;
        OD
index 495a3e0..af6bd6e 100644 (file)
@@ -306,12 +306,12 @@ static void       gsort(from,to)
 
        if((n=to-from)<=1 ) { return ;}
 
-       FOR j=1; j<=n; j*=2 DONE
+       for (j=1; j<=n; j*=2 DONE
 
-       FOR m=2*j-1; m/=2;
+       for (m=2*j-1; m/=2;
        DO  k=n-m;
-           FOR j=0; j<k; j++
-           DO  FOR i=j; i>=0; i-=m
+           for (j=0; j<k; j++
+           DO  for (i=j; i>=0; i-=m
                DO  REG STRING *fromi; fromi = &from[i];
                    if(cf(fromi[m],fromi[0])>0
                    ) { break;
index e5e848f..298b9b1 100644 (file)
@@ -124,7 +124,7 @@ execute(argt, execflg, pf1, pf2)
                                        } else {        /* print out current traps */
                                                INT             i;
        
-                                               FOR i=0; i<MAXTRAP; i++
+                                               for (i=0; i<MAXTRAP; i++
                                                DO if( trapcom[i]
                                                   ) {  prn(i); prs(colon); prs(trapcom[i]); newline();
                                                   ;}