From f2a44e0131eca1b2691e705b9b9caf1e114890a0 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Sun, 10 May 2015 21:50:34 +0100 Subject: [PATCH] sh: kill of SWITCH IN ENDSW --- Applications/V7/cmd/sh/cmd.c | 12 ++++++------ Applications/V7/cmd/sh/expand.c | 5 ++--- Applications/V7/cmd/sh/mac.h | 3 --- Applications/V7/cmd/sh/macro.c | 4 ++-- Applications/V7/cmd/sh/service.c | 5 ++--- Applications/V7/cmd/sh/xec.c | 10 +++++----- 6 files changed, 17 insertions(+), 22 deletions(-) diff --git a/Applications/V7/cmd/sh/cmd.c b/Applications/V7/cmd/sh/cmd.c index 0789d2c9..8083e518 100644 --- a/Applications/V7/cmd/sh/cmd.c +++ b/Applications/V7/cmd/sh/cmd.c @@ -83,7 +83,7 @@ TREPTR cmd(sym,flg) THEN synbad(); FI - SWITCH wdval IN + switch(wdval) { case '&': IF i @@ -107,7 +107,7 @@ TREPTR cmd(sym,flg) THEN chksym(sym); FI - ENDSW + } return(i); } @@ -203,7 +203,7 @@ static TREPTR item(flag) ELSE io=0; FI - SWITCH wdval IN + switch(wdval) { case CASYM: { @@ -305,7 +305,7 @@ static TREPTR item(flag) return(t); } - ENDSW + } reserv++; word(); IF io=inout(io) THEN t=makefork(0,t); t->treio=io; @@ -329,7 +329,7 @@ static IOPTR inout(lastio) iof=wdnum; - SWITCH wdval IN + switch(wdval) { case DOCSYM: iof |= IODOC; break; @@ -353,7 +353,7 @@ static IOPTR inout(lastio) default: return(lastio); - ENDSW + } chkword(); iop=(IOPTR)getstak(IOTYPE); diff --git a/Applications/V7/cmd/sh/expand.c b/Applications/V7/cmd/sh/expand.c index 9aac0c09..4e7b67ef 100644 --- a/Applications/V7/cmd/sh/expand.c +++ b/Applications/V7/cmd/sh/expand.c @@ -126,8 +126,7 @@ gmatch(s, p) THEN scc=0200; FI FI - SWITCH c = *p++ IN - + switch(c = *p++) { case '[': {BOOL ok; INT lc; ok=0; lc=077777; @@ -157,7 +156,7 @@ gmatch(s, p) case 0: return(scc==0); - ENDSW + } } static void addg(as1,as2,as3) diff --git a/Applications/V7/cmd/sh/mac.h b/Applications/V7/cmd/sh/mac.h index e60f8ac5..bb7525c7 100644 --- a/Applications/V7/cmd/sh/mac.h +++ b/Applications/V7/cmd/sh/mac.h @@ -20,9 +20,6 @@ #define ELIF } else if ( #define FI ;} -#define SWITCH switch( -#define IN ){ -#define ENDSW } #define FOR for( #define WHILE while( #define DO ){ diff --git a/Applications/V7/cmd/sh/macro.c b/Applications/V7/cmd/sh/macro.c index 71a31488..2d6a9988 100644 --- a/Applications/V7/cmd/sh/macro.c +++ b/Applications/V7/cmd/sh/macro.c @@ -38,7 +38,7 @@ static skipto(endch) /* skip chars up to } */ REG CHAR c; WHILE (c=readc()) && c!=endch - DO SWITCH c IN + DO switch(c) { case SQUOTE: skipto(SQUOTE); break; @@ -47,7 +47,7 @@ static skipto(endch) case DOLLAR: IF readc()==BRACE THEN skipto('}'); FI - ENDSW + } OD IF c!=endch THEN error(badsub) FI } diff --git a/Applications/V7/cmd/sh/service.c b/Applications/V7/cmd/sh/service.c index 8e9df6f8..6427ad1f 100644 --- a/Applications/V7/cmd/sh/service.c +++ b/Applications/V7/cmd/sh/service.c @@ -140,8 +140,7 @@ static STRING execs(ap,t) sigchk(); execve(p, &t[0] ,xecenv); - SWITCH errno IN - + switch(errno) { case ENOEXEC: flags=0; comdiv=0; ioset=0; @@ -167,7 +166,7 @@ static STRING execs(ap,t) xecmsg=badexec; case ENOENT: return(prefix); - ENDSW + } } /* for processes to be waited for */ diff --git a/Applications/V7/cmd/sh/xec.c b/Applications/V7/cmd/sh/xec.c index deab3a4f..f1cf13f2 100644 --- a/Applications/V7/cmd/sh/xec.c +++ b/Applications/V7/cmd/sh/xec.c @@ -40,7 +40,7 @@ execute(argt, execflg, pf1, pf2) treeflgs = t->tretyp; type = treeflgs&COMMSK; oldexit=exitval; exitval=0; - SWITCH type IN + switch(type) { case TCOM: { @@ -66,7 +66,7 @@ execute(argt, execflg, pf1, pf2) newline(); FI - SWITCH internal IN + switch(internal) { case SYSDOT: IF a1 @@ -223,8 +223,8 @@ execute(argt, execflg, pf1, pf2) default: internal=builtin(argn,com); - - ENDSW + + } IF internal THEN IF io THEN error(illegal) FI @@ -398,7 +398,7 @@ execute(argt, execflg, pf1, pf2) OD } break; - ENDSW + } exitset(); FI -- 2.34.1