sh: kill off BEGIN and END
authorAlan Cox <alan@linux.intel.com>
Sun, 10 May 2015 20:47:16 +0000 (21:47 +0100)
committerAlan Cox <alan@linux.intel.com>
Sun, 10 May 2015 20:47:16 +0000 (21:47 +0100)
Applications/V7/cmd/sh/blok.c
Applications/V7/cmd/sh/cmd.c
Applications/V7/cmd/sh/expand.c
Applications/V7/cmd/sh/mac.h
Applications/V7/cmd/sh/macro.c
Applications/V7/cmd/sh/service.c
Applications/V7/cmd/sh/xec.c

index fd2fbed..cb6b633 100644 (file)
@@ -70,11 +70,11 @@ void        addblok(reqd)
        blokp=bloktop;
        bloktop=bloktop->word=BLK(Rcheat(bloktop)+reqd);
        bloktop->word=BLK(ADR(end)+1);
-       BEGIN
+       {
           REG STKPTR stakadr=STK(bloktop+2);
           staktop=movstr(stakbot,stakadr);
           stakbas=stakbot=stakadr;
-       END
+       }
 }
 
 void free(void *ap)
index 3f575d1..0789d2c 100644 (file)
@@ -206,7 +206,7 @@ static TREPTR       item(flag)
        SWITCH wdval IN
 
            case CASYM:
-               BEGIN
+               {
                   t=(TREPTR)getstak(SWTYPE);
                   chkword();
                   ((SWPTR)t)->swarg=wdarg->argval;
@@ -214,10 +214,10 @@ static TREPTR     item(flag)
                   ((SWPTR)t)->swlst=syncase(wdval==INSYM?ESSYM:KTSYM);
                   ((SWPTR)t)->swtyp=TSW;
                   break;
-               END
+               }
 
            case IFSYM:
-               BEGIN
+               {
                   REG INT      w;
                   t=(TREPTR)getstak(IFTYPE);
                   ((IFPTR)t)->iftyp=TIF;
@@ -226,10 +226,10 @@ static TREPTR     item(flag)
                   ((IFPTR)t)->eltre=((w=wdval)==ELSYM ? cmd(FISYM,NLFLG) : (w==EFSYM ? (wdval=IFSYM, item(0)) : 0));
                   IF w==EFSYM THEN return(t) FI
                   break;
-               END
+               }
 
            case FORSYM:
-               BEGIN
+               {
                   t=(TREPTR)getstak(FORTYPE);
                   ((FORPTR)t)->fortyp=TFOR;
                   ((FORPTR)t)->forlst=0;
@@ -246,31 +246,31 @@ static TREPTR     item(flag)
                   chksym(DOSYM|BRSYM);
                   ((FORPTR)t)->fortre=cmd(wdval==DOSYM?ODSYM:KTSYM,NLFLG);
                   break;
-               END
+               }
 
            case WHSYM:
            case UNSYM:
-               BEGIN
+               {
                   t=(TREPTR)getstak(WHTYPE);
                   ((WHPTR)t)->whtyp=(wdval==WHSYM ? TWH : TUN);
                   ((WHPTR)t)->whtre = cmd(DOSYM,NLFLG);
                   ((WHPTR)t)->dotre = cmd(ODSYM,NLFLG);
                   break;
-               END
+               }
 
            case BRSYM:
                t=cmd(KTSYM,NLFLG);
                break;
 
            case '(':
-               BEGIN
+               {
                   REG PARPTR    p;
                   p=(PARPTR)getstak(PARTYPE);
                   p->partre=cmd(')',NLFLG);
                   p->partyp=TPAR;
                   t=makefork(0,p);
                   break;
-               END
+               }
 
            default:
                IF io==0
@@ -278,7 +278,7 @@ static TREPTR       item(flag)
                FI
 
            case 0:
-               BEGIN
+               {
                   REG ARGPTR   argp;
                   REG ARGPTR   *argtail;
                   REG ARGPTR   *argset=0;
@@ -303,7 +303,7 @@ static TREPTR       item(flag)
                   ((COMPTR)t)->comset=(ARGPTR)argset;
                   *argtail=0;
                   return(t);
-               END
+               }
 
        ENDSW
        reserv++; word();
index 528dd12..9aac0c0 100644 (file)
@@ -46,7 +46,7 @@ INT   expand(as,rflg)
        s=cs=as; entry.d_name[DIRSIZ-1]=0; /* to end the string */
 
        /* check for meta chars */
-       BEGIN
+       {
           REG BOOL slash; slash=0;
           WHILE !fngchar(*cs)
           DO   IF *cs++==0
@@ -55,7 +55,7 @@ INT   expand(as,rflg)
                THEN    slash++;
                FI
           OD
-       END
+       }
 
        for(;;) {       IF cs==s
                THEN    s=nullstr;
@@ -106,12 +106,12 @@ INT       expand(as,rflg)
                FI
        FI
 
-       BEGIN
+       {
           REG CHAR     c;
           s=as;
           WHILE c = *s
           DO   *s++=(c&STRIP?c:'/') OD
-       END
+       }
        return(count);
 }
 
index cb50b7c..e60f8ac 100644 (file)
@@ -20,8 +20,6 @@
 #define ELIF   } else if (
 #define FI     ;}
 
-#define BEGIN  {
-#define END    }
 #define SWITCH switch(
 #define IN     ){
 #define ENDSW  }
index d831bf1..71a3148 100644 (file)
@@ -183,12 +183,12 @@ static comsubst()
        WHILE (d=readc())!=SQUOTE && d
        DO pushstak(d) OD
 
-       BEGIN
+       {
           REG STRING   argc;
           trim(argc=fixstak());
           push(&cb); estabf(argc);
-       END
-       BEGIN
+       }
+       {
           REG TREPTR   t = makefork(FPOU,cmd(EOFSYM,MTFLG|NLFLG));
           INT          pv[2];
 
@@ -199,7 +199,7 @@ static comsubst()
           initf(pv[INPIPE]);
           execute(t, 0, 0, pv);
           close(pv[OTPIPE]);
-       END
+       }
        tdystak(savptr); staktop=movstr(savptr,stakbot);
        WHILE d=readc() DO pushstak(d|quote) OD
        await(0);
index 9d815d4..8e9df6f 100644 (file)
@@ -212,7 +212,7 @@ void        await(i)
                REG INT         sig;
                INT             w_hi;
 
-               BEGIN
+               {
                   REG INT      *pw=pwlist;
                   p=wait(&w);
                   WHILE pw <= &pwlist[ipwc]
@@ -221,7 +221,7 @@ void        await(i)
                      ELSE pw++;
                      FI
                   OD
-               END
+               }
 
                IF p == -1 THEN continue FI
 
index 0e2e6b1..deab3a4 100644 (file)
@@ -43,7 +43,7 @@ execute(argt, execflg, pf1, pf2)
                SWITCH type IN
 
                case TCOM:
-                       BEGIN
+                       {
                        STRING          a1;
                        INT             argn, internal;
                        ARGPTR          schain=gchain;
@@ -234,7 +234,7 @@ execute(argt, execflg, pf1, pf2)
                        ELIF t->treio==0
                        THEN    break;
                        FI
-                       END
+                       }
        
                case TFORK:
                        IF execflg && (treeflgs&(FAMP|FPOU))==0
@@ -306,13 +306,13 @@ execute(argt, execflg, pf1, pf2)
                        done();
 
                case TFIL:
-                       BEGIN
+                       {
                           INT pv[2]; chkpipe(pv);
                           IF execute(((LSTPTR)t)->lstlef, 0, pf1, pv)==0
                           THEN execute(((LSTPTR)t)->lstrit, execflg, pv, pf2);
                           ELSE closepipe(pv);
                           FI
-                       END
+                       }
                        break;
 
                case TLST:
@@ -333,7 +333,7 @@ execute(argt, execflg, pf1, pf2)
                        break;
 
                case TFOR:
-                       BEGIN
+                       {
                           NAMPTR       n = lookup(((FORPTR)t)->fornam);
                           STRING       *args;
                           DOLPTR       argsav=0;
@@ -355,12 +355,12 @@ execute(argt, execflg, pf1, pf2)
                           IF breakcnt THEN breakcnt-- FI
                           execbrk=breakcnt; loopcnt--;
                           argfor=freeargs(argsav);
-                       END
+                       }
                        break;
 
                case TWH:
                case TUN:
-                       BEGIN
+                       {
                           INT          i=0;
 
                           loopcnt++;
@@ -370,7 +370,7 @@ execute(argt, execflg, pf1, pf2)
                           OD
                           IF breakcnt THEN breakcnt-- FI
                           execbrk=breakcnt; loopcnt--; exitval=i;
-                       END
+                       }
                        break;
 
                case TIF:
@@ -381,7 +381,7 @@ execute(argt, execflg, pf1, pf2)
                        break;
 
                case TSW:
-                       BEGIN
+                       {
                           REG STRING   r = mactrim(((SWPTR)t)->swarg);
                           t=(TREPTR)((SWPTR)t)->swlst;
                           WHILE t
@@ -396,7 +396,7 @@ execute(argt, execflg, pf1, pf2)
                                OD
                                IF t THEN t=(TREPTR)((REGPTR)t)->regnxt FI
                           OD
-                       END
+                       }
                        break;
                ENDSW
                exitset();