From 8e13b0a1d1ccc5687cc042db26a759401cc0a7f7 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Sun, 10 May 2015 22:06:53 +0100 Subject: [PATCH] sh: kill off FI --- Applications/V7/cmd/sh/args.c | 12 ++--- Applications/V7/cmd/sh/blok.c | 22 ++++---- Applications/V7/cmd/sh/cmd.c | 64 +++++++++++------------ Applications/V7/cmd/sh/error.c | 8 +-- Applications/V7/cmd/sh/expand.c | 46 ++++++++--------- Applications/V7/cmd/sh/fault.c | 18 +++---- Applications/V7/cmd/sh/io.c | 20 ++++---- Applications/V7/cmd/sh/mac.h | 1 - Applications/V7/cmd/sh/macro.c | 44 ++++++++-------- Applications/V7/cmd/sh/main.c | 32 ++++++------ Applications/V7/cmd/sh/name.c | 52 +++++++++---------- Applications/V7/cmd/sh/print.c | 12 ++--- Applications/V7/cmd/sh/service.c | 62 +++++++++++----------- Applications/V7/cmd/sh/stak.c | 6 +-- Applications/V7/cmd/sh/string.c | 6 +-- Applications/V7/cmd/sh/word.c | 40 +++++++-------- Applications/V7/cmd/sh/xec.c | 88 ++++++++++++++++---------------- 17 files changed, 266 insertions(+), 267 deletions(-) diff --git a/Applications/V7/cmd/sh/args.c b/Applications/V7/cmd/sh/args.c index 3c2d9819..3081e82a 100644 --- a/Applications/V7/cmd/sh/args.c +++ b/Applications/V7/cmd/sh/args.c @@ -50,10 +50,10 @@ INT options(argc,argv) ) { comdiv=argp[2]; argp[1]=argp[0]; argp++; argc--; } else { failed(argv[1],badopt); - FI + ;} OD argp[1]=argp[0]; argc--; - FI + ;} /* set up $- */ flagc=flagchar; @@ -61,7 +61,7 @@ INT options(argc,argv) WHILE *flagc DO IF flags&flagval[flagc-flagchar] ) { *flagp++ = *flagc; - FI + ;} flagc++; OD *flagp++=0; @@ -98,8 +98,8 @@ freeargs(blk) ) { FOR argp=(STRING *)argblk->dolarg; Rcheat(*argp)!=ENDARGS; argp++ DO free(*argp) OD free(argblk); - FI - FI + ;} + ;} return(argr); } @@ -136,5 +136,5 @@ DOLPTR useargs() dolh->dolnxt=argfor; return(argfor=dolh); } else { return(0); - FI + ;} } diff --git a/Applications/V7/cmd/sh/blok.c b/Applications/V7/cmd/sh/blok.c index 3144ecda..6c1b9162 100644 --- a/Applications/V7/cmd/sh/blok.c +++ b/Applications/V7/cmd/sh/blok.c @@ -41,11 +41,11 @@ ADDRESS alloc(nbytes) ) { blokp = BLK(ADR(p)+rbytes); IF q > blokp ) { blokp->word = p->word; - FI + ;} p->word=BLK(Rcheat(blokp)|BUSY); return(ADR(p+1)); - FI - FI + ;} + ;} q = p; p = BLK(Rcheat(p->word)&~BUSY); PER p>q || (c++)==0 DONE addblok(rbytes); @@ -65,7 +65,7 @@ void addblok(reqd) blokstak->word=stakbsy; stakbsy=blokstak; bloktop->word=BLK(Rcheat(rndstak)|BUSY); bloktop=BLK(rndstak); - FI + ;} reqd += brkincr; reqd &= ~(brkincr-1); blokp=bloktop; bloktop=bloktop->word=BLK(Rcheat(bloktop)+reqd); @@ -83,7 +83,7 @@ void free(void *ap) IF (p=ap) && pword) &= ~BUSY; - FI + ;} } #ifdef DEBUG @@ -97,17 +97,17 @@ chkbptr(ptr) for (;;) { q = Rcheat(p->word)&~BUSY; - IF p==ptr ) { exf++ FI - IF qbloktop ) { abort(3) FI - IF p==bloktop ) { break FI + IF p==ptr ) { exf++ ;} + IF qbloktop ) { abort(3) ;} + IF p==bloktop ) { break ;} IF busy(p) ) { us += q-p; } else { un += q-p; - FI - IF p>=q ) { abort(4) FI + ;} + IF p>=q ) { abort(4) ;} p=q; } - IF exf==0 ) { abort(1) FI + IF exf==0 ) { abort(1) ;} prn(un); prc(SP); prn(us); prc(NL); } #endif diff --git a/Applications/V7/cmd/sh/cmd.c b/Applications/V7/cmd/sh/cmd.c index 2d4de592..0466fec1 100644 --- a/Applications/V7/cmd/sh/cmd.c +++ b/Applications/V7/cmd/sh/cmd.c @@ -55,7 +55,7 @@ static TREPTR makelist(type,i,r) } else { t = (LSTPTR)getstak(LSTTYPE); t->lsttyp = type; t->lstlef = i; t->lstrit = r; - FI + ;} return(TREPTR)(t); } @@ -78,10 +78,10 @@ TREPTR cmd(sym,flg) IF wdval==NL ) { IF flg&NLFLG ) { wdval=';'; chkpr(NL); - FI + ;} } else if ( i==0 && (flg&MTFLG)==0 ) { synbad(); - FI + ;} switch(wdval) { @@ -89,23 +89,23 @@ TREPTR cmd(sym,flg) IF i ) { i = makefork(FINT|FPRS|FAMP, i); } else { synbad(); - FI + ;} case ';': IF e=cmd(sym,flg|MTFLG) ) { i=makelist(TLST, i, e); - FI + ;} break; case EOFSYM: IF sym==NL ) { break; - FI + ;} default: IF sym ) { chksym(sym); - FI + ;} } return(i); @@ -144,12 +144,12 @@ static TREPTR term(flg) IF flg&NLFLG ) { skipnl(); } else { word(); - FI + ;} IF (t=item(TRUE)) && (wdval=='^' || wdval=='|') ) { return(makelist(TFIL, makefork(FPOU,t), makefork(FPIN|FPCL,term(NLFLG)))); } else { return(t); - FI + ;} } static REGPTR syncase(esym) @@ -165,20 +165,20 @@ static REGPTR syncase(esym) r->regptr=wdarg; IF wdval || ( word()!=')' && wdval!='|' ) ) { synbad(); - FI + ;} IF wdval=='|' ) { word(); } else { break; - FI + ;} } r->regcom=cmd(0,NLFLG|MTFLG); IF wdval==ECSYM ) { r->regnxt=syncase(esym); } else { chksym(esym); r->regnxt=0; - FI + ;} return(r); - FI + ;} } /* @@ -201,7 +201,7 @@ static TREPTR item(flag) IF flag ) { io=inout((IOPTR)0); } else { io=0; - FI + ;} switch(wdval) { @@ -224,7 +224,7 @@ static TREPTR item(flag) ((IFPTR)t)->iftre=cmd(THSYM,NLFLG); ((IFPTR)t)->thtre=cmd(ELSYM|FISYM|EFSYM,NLFLG); ((IFPTR)t)->eltre=((w=wdval)==ELSYM ? cmd(FISYM,NLFLG) : (w==EFSYM ? (wdval=IFSYM, item(0)) : 0)); - IF w==EFSYM ) { return(t) FI + IF w==EFSYM ) { return(t) ;} break; } @@ -240,9 +240,9 @@ static TREPTR item(flag) ((FORPTR)t)->forlst=(COMPTR)item(0); IF wdval!=NL && wdval!=';' ) { synbad(); - FI + ;} chkpr(wdval); skipnl(); - FI + ;} chksym(DOSYM|BRSYM); ((FORPTR)t)->fortre=cmd(wdval==DOSYM?ODSYM:KTSYM,NLFLG); break; @@ -275,7 +275,7 @@ static TREPTR item(flag) default: IF io==0 ) { return(0); - FI + ;} case 0: { @@ -292,11 +292,11 @@ static TREPTR item(flag) ) { argp->argnxt=(ARGPTR)argset; argset=(ARGPTR *)argp; } else { *argtail=argp; argtail = &(argp->argnxt); keywd=flags&keyflg; - FI + ;} word(); IF flag ) { ((COMPTR)t)->comio=inout(((COMPTR)t)->comio); - FI + ;} OD ((COMPTR)t)->comtyp=TCOM; @@ -309,7 +309,7 @@ static TREPTR item(flag) reserv++; word(); IF io=inout(io) ) { t=makefork(0,t); t->treio=io; - FI + ;} return(t); } @@ -336,11 +336,11 @@ static IOPTR inout(lastio) case APPSYM: case '>': - IF wdnum==0 ) { iof |= 1 FI + IF wdnum==0 ) { iof |= 1 ;} iof |= IOPUT; IF wdval==APPSYM ) { iof |= IOAPP; break; - FI + ;} case '<': IF (c=nextc(0))=='&' @@ -348,7 +348,7 @@ static IOPTR inout(lastio) } else if ( c=='>' ) { iof |= IORDW; } else { peekc=c|MARK; - FI + ;} break; default: @@ -361,7 +361,7 @@ static IOPTR inout(lastio) iop->iofile=iof; IF iof&IODOC ) { iop->iolst=iopend; iopend=iop; - FI + ;} word(); iop->ionxt=inout(lastio); return(iop); } @@ -370,7 +370,7 @@ static void chkword() { IF word() ) { synbad(); - FI + ;} } static void chksym(sym) @@ -378,7 +378,7 @@ static void chksym(sym) REG INT x = sym&wdval; IF ((x&SYMFLG) ? x : sym) != wdval ) { synbad(); - FI + ;} } static void prsym(sym) @@ -391,12 +391,12 @@ static void prsym(sym) prs(sp->sysnam); } else if ( sym==EOFSYM ) { prs(endoffile); - } else { IF sym&SYMREP ) { prc(sym) FI + } else { IF sym&SYMREP ) { prc(sym) ;} IF sym==NL ) { prs("newline"); } else { prc(sym); - FI - FI + ;} + ;} } static void synbad() @@ -404,13 +404,13 @@ static void synbad() prp(); prs(synmsg); IF (flags&ttyflg)==0 ) { prs(atline); prn(standin->flin); - FI + ;} prs(colon); prc(LQ); IF wdval ) { prsym(wdval); } else { prs(wdarg->argval); - FI + ;} prc(RQ); prs(unexpected); newline(); exitsh(SYNBAD); diff --git a/Applications/V7/cmd/sh/error.c b/Applications/V7/cmd/sh/error.c index 03b2ba6c..84a64e86 100644 --- a/Applications/V7/cmd/sh/error.c +++ b/Applications/V7/cmd/sh/error.c @@ -27,7 +27,7 @@ sigchk() */ IF trapnote&SIGSET ) { exitsh(SIGFAIL); - FI + ;} } failed(s1,s2) @@ -36,7 +36,7 @@ failed(s1,s2) prp(); prs(s1); IF s2 ) { prs(colon); prs(s2); - FI + ;} newline(); exitsh(ERROR); } @@ -62,7 +62,7 @@ exitsh(xno) } else { clearup(); longjmp(errshell,1); - FI + ;} } done() @@ -71,7 +71,7 @@ done() IF t=trapcom[0] ) { trapcom[0]=0; /*should free but not long */ execexp(t,0); - FI + ;} rmtemp(0); exit(exitval); } diff --git a/Applications/V7/cmd/sh/expand.c b/Applications/V7/cmd/sh/expand.c index c9057954..bb639ce7 100644 --- a/Applications/V7/cmd/sh/expand.c +++ b/Applications/V7/cmd/sh/expand.c @@ -41,7 +41,7 @@ INT expand(as,rflg) struct dirent entry; STATBUF statb; - IF trapnote&SIGSET ) { return(0); FI + IF trapnote&SIGSET ) { return(0); ;} s=cs=as; entry.d_name[DIRSIZ-1]=0; /* to end the string */ @@ -50,10 +50,10 @@ INT expand(as,rflg) REG BOOL slash; slash=0; WHILE !fngchar(*cs) DO IF *cs++==0 - ) { IF rflg && slash ) { break; } else { return(0) FI + ) { IF rflg && slash ) { break; } else { return(0) ;} } else if ( *cs=='/' ) { slash++; - FI + ;} OD } @@ -62,22 +62,22 @@ INT expand(as,rflg) break; } else if ( *--cs == '/' ) { *cs=0; - IF s==cs ) { s="/" FI + IF s==cs ) { s="/" ;} break; - FI + ;} } IF stat(s,&statb)>=0 && (statb.st_mode&S_IFMT)==S_IFDIR && (dirf=open(s,0))>0 ) { dir++; - FI + ;} count=0; - IF *cs==0 ) { *cs++=0200 FI + IF *cs==0 ) { *cs++=0200 ;} IF dir ) { /* check for rescan */ REG STRING rs; rs=cs; - REP IF *rs=='/' ) { rescan=rs; *rs=0; gchain=0 FI + REP IF *rs=='/' ) { rescan=rs; *rs=0; gchain=0 ;} PER *rs++ DONE // FIXME: readdir @@ -85,10 +85,10 @@ INT expand(as,rflg) DO IF entry.d_ino==0 || (*entry.d_name=='.' && *cs!='.') ) { continue; - FI + ;} IF gmatch(entry.d_name, cs) ) { addg(s,entry.d_name,rescan); count++; - FI + ;} OD close(dirf); @@ -101,10 +101,10 @@ INT expand(as,rflg) DO count += expand(rchain->argval,1); rchain=rchain->argnxt; OD - FI + ;} *rescan='/'; - FI - FI + ;} + ;} { REG CHAR c; @@ -124,8 +124,8 @@ gmatch(s, p) IF scc = *s++ ) { IF (scc &= STRIP)==0 ) { scc=0200; - FI - FI + ;} + ;} switch(c = *p++) { case '[': {BOOL ok; INT lc; @@ -134,24 +134,24 @@ gmatch(s, p) DO IF c==']' ) { return(ok?gmatch(s,p):0); } else if ( c==MINUS - ) { IF lc<=scc && scc<=(*p++) ) { ok++ FI - } else { IF scc==(lc=(c&STRIP)) ) { ok++ FI - FI + ) { IF lc<=scc && scc<=(*p++) ) { ok++ ;} + } else { IF scc==(lc=(c&STRIP)) ) { ok++ ;} + ;} OD return(0); } default: - IF (c&STRIP)!=scc ) { return(0) FI + IF (c&STRIP)!=scc ) { return(0) ;} case '?': return(scc?gmatch(s,p):0); case '*': - IF *p==0 ) { return(1) FI + IF *p==0 ) { return(1) ;} --s; WHILE *s - DO IF gmatch(s++,p) ) { return(1) FI OD + DO IF gmatch(s++,p) ) { return(1) ;} OD return(0); case 0: @@ -172,7 +172,7 @@ static void addg(as1,as2,as3) DO IF (c &= STRIP)==0 ) { *s2++='/'; break; - FI + ;} *s2++=c; OD s1=as2; @@ -180,7 +180,7 @@ static void addg(as1,as2,as3) IF s1=as3 ) { *s2++='/'; WHILE *s2++ = *++s1 DONE - FI + ;} makearg(endstak(s2)); } diff --git a/Applications/V7/cmd/sh/fault.c b/Applications/V7/cmd/sh/fault.c index 614e9fe7..947990be 100644 --- a/Applications/V7/cmd/sh/fault.c +++ b/Applications/V7/cmd/sh/fault.c @@ -28,15 +28,15 @@ void fault(sig) IF sig==MEMF ) { IF setbrk(brkincr) == -1 ) { error(nospace); - FI + ;} } else if (sig==ALARM ) { IF flags&waiting ) { done(); - FI + ;} } else { flag = (trapcom[sig] ? TRAPSET : SIGSET); trapnote |= flag; trapflg[sig] |= flag; - FI + ;} } stdsigs() @@ -54,7 +54,7 @@ ignsig(n) // FIXME: need to do proper SIG_IGN checks/handling IF (s=signal(i=n,1)&01)==0 ) { trapflg[i] |= SIGMOD; - FI + ;} #endif return(s); } @@ -65,7 +65,7 @@ getsig(n) IF trapflg[i=n]&SIGMOD || ignsig(i)==0 ) { signal(i,fault); - FI + ;} } oldsigs() @@ -78,7 +78,7 @@ oldsigs() DO t=trapcom[i]; IF t==0 || *t ) { clrsig(i); - FI + ;} trapflg[i]=0; OD trapnote=0; @@ -91,7 +91,7 @@ clrsig(i) IF trapflg[i]&SIGMOD ) { signal(i,fault); trapflg[i] &= ~SIGMOD; - FI + ;} } chktrap() @@ -108,7 +108,7 @@ chktrap() ) { INT savxit=exitval; execexp(t,0); exitval=savxit; exitset(); - FI - FI + ;} + ;} OD } diff --git a/Applications/V7/cmd/sh/io.c b/Applications/V7/cmd/sh/io.c index 1e016bad..76018925 100644 --- a/Applications/V7/cmd/sh/io.c +++ b/Applications/V7/cmd/sh/io.c @@ -51,11 +51,11 @@ pop() REG FILE f; IF (f=standin)->fstak - ) { IF f->fdes>=0 ) { close(f->fdes) FI + ) { IF f->fdes>=0 ) { close(f->fdes) ;} standin=f->fstak; return(TRUE); } else { return(FALSE); - FI + ;} } chkpipe(pv) @@ -63,7 +63,7 @@ chkpipe(pv) { IF pipe(pv)<0 || pv[INPIPE]<0 || pv[OTPIPE]<0 ) { error(piperr); - FI + ;} } chkopen(idf) @@ -74,7 +74,7 @@ chkopen(idf) IF (rc=open(idf,0))<0 ) { failed(idf,badopen); } else { return(rc); - FI + ;} } sh_rename(f1,f2) @@ -83,8 +83,8 @@ sh_rename(f1,f2) IF f1!=f2 ) { dup2(f1, f2); close(f1); - IF f2==0 ) { ioset|=1 FI - FI + IF f2==0 ) { ioset|=1 ;} + ;} } create(s) @@ -95,7 +95,7 @@ create(s) IF (rc=creat(s,0666))<0 ) { failed(s,badcreate); } else { return(rc); - FI + ;} } tmpfil() @@ -117,7 +117,7 @@ copy(ioparg) IF iop=ioparg ) { copy(iop->iolst); - ends=mactrim(iop->ioname); IF nosubst ) { iop->iofile &= ~IODOC FI + ends=mactrim(iop->ioname); IF nosubst ) { iop->iofile &= ~IODOC ;} fd=tmpfil(); iop->ioname=cpystak(tmpout); iop->iolst=iotemp; iotemp=iop; @@ -127,10 +127,10 @@ copy(ioparg) clinep=cline; chkpr(NL); WHILE (c = (nosubst ? readc() : nextc(*ends)), !eolchar(c)) DO *clinep++ = c OD *clinep=0; - IF eof || eq(cline,ends) ) { break FI + IF eof || eq(cline,ends) ) { break ;} *clinep++=NL; write(fd,cline,clinep-cline); } close(fd); - FI + ;} } diff --git a/Applications/V7/cmd/sh/mac.h b/Applications/V7/cmd/sh/mac.h index 0561606a..e4b20ed1 100644 --- a/Applications/V7/cmd/sh/mac.h +++ b/Applications/V7/cmd/sh/mac.h @@ -15,7 +15,6 @@ #define REG register #define IF if( -#define FI ;} #define FOR for( #define WHILE while( diff --git a/Applications/V7/cmd/sh/macro.c b/Applications/V7/cmd/sh/macro.c index 76849dc6..ded1cb4d 100644 --- a/Applications/V7/cmd/sh/macro.c +++ b/Applications/V7/cmd/sh/macro.c @@ -29,7 +29,7 @@ static STRING copyto(endch) WHILE (c=getch(endch))!=endch && c DO pushstak(c|quote) OD zerostak(); - IF c!=endch ) { error(badsub) FI + IF c!=endch ) { error(badsub) ;} } static skipto(endch) @@ -46,10 +46,10 @@ static skipto(endch) case DOLLAR: IF readc()==BRACE ) { skipto('}'); - FI + ;} } OD - IF c!=endch ) { error(badsub) FI + IF c!=endch ) { error(badsub) ;} } static getch(endch) @@ -61,7 +61,7 @@ retry: d=readc(); IF !subchar(d) ) { return(d); - FI + ;} IF d==DOLLAR ) { REG INT c; IF (c=readc(), dolchar(c)) @@ -72,7 +72,7 @@ retry: CHAR idb[2]; STRING id=idb; - IF bra=(c==BRACE) ) { c=readc() FI + IF bra=(c==BRACE) ) { c=readc() ;} IF letter(c) ) { argp=(STRING)relstak(); WHILE alphanum(c) DO pushstak(c); c=readc() OD @@ -84,7 +84,7 @@ retry: ) { *id=c; idb[1]=0; IF astchar(c) ) { dolg=1; c='1'; - FI + ;} c -= '0'; v=((c==0) ? cmdadr : (c<=dolc) ? dolv[c] : (STRING)(dolg=0)); } else if ( c=='$' @@ -99,11 +99,11 @@ retry: ) { v=flagadr; } else if ( bra ) { error(badsub); } else { goto retry; - FI + ;} c = readc(); IF !defchar(c) && bra ) { error(badsub); - FI + ;} argp=0; IF bra ) { IF c!='}' @@ -111,11 +111,11 @@ retry: IF (v==0)^(setchar(c)) ) { copyto('}'); } else { skipto('}'); - FI + ;} argp=absstak(argp); - FI + ;} } else { peekc = c|MARK; c = 0; - FI + ;} IF v ) { IF c!='+' ) { for (;;) { @@ -124,9 +124,9 @@ retry: IF dolg==0 || (++dolg>dolc) ) { break; } else { v=dolv[dolg]; pushstak(SP|(*id=='*' ? quote : 0)); - FI + ;} } - FI + ;} } else if ( argp ) { IF c=='?' ) { failed(id,*argp?argp:badparam); @@ -134,21 +134,21 @@ retry: ) { IF n ) { assign(n,argp); } else { error(badsub); - FI - FI + ;} + ;} } else if ( flags&setflg ) { failed(id,badparam); - FI + ;} goto retry; } else { peekc=c|MARK; - FI + ;} } else if ( d==endch ) { return(d); } else if ( d==SQUOTE ) { comsubst(); goto retry; } else if ( d==DQUOTE ) { quoted++; quote^=QUOTE; goto retry; - FI + ;} return(d); } @@ -167,7 +167,7 @@ STRING macro(as) quote=0; quoted=0; copyto(0); pop(); - IF quoted && (stakbot==staktop) ) { pushstak(QUOTE) FI + IF quoted && (stakbot==staktop) ) { pushstak(QUOTE) ;} quote=savq; quoted=savqu; return(fixstak()); } @@ -206,7 +206,7 @@ static comsubst() WHILE stakbot!=staktop DO IF (*--staktop&STRIP)!=NL ) { ++staktop; break; - FI + ;} OD pop(); } @@ -226,7 +226,7 @@ subst(in,ot) DO pushstak(c); IF --count == 0 ) { flush(ot); count=CPYSIZ; - FI + ;} OD flush(ot); pop(); @@ -235,6 +235,6 @@ subst(in,ot) static flush(ot) { write(ot,stakbot,staktop-stakbot); - IF flags&execpr ) { write(output,stakbot,staktop-stakbot) FI + IF flags&execpr ) { write(output,stakbot,staktop-stakbot) ;} staktop=stakbot; } diff --git a/Applications/V7/cmd/sh/main.c b/Applications/V7/cmd/sh/main.c index cb193d3f..f97f00c6 100644 --- a/Applications/V7/cmd/sh/main.c +++ b/Applications/V7/cmd/sh/main.c @@ -46,14 +46,14 @@ main(c, v) sh_getenv(); /* look for restricted */ -/* IF c>0 && any('r', *v) ) { rflag=0 FI */ +/* IF c>0 && any('r', *v) ) { rflag=0 ;} */ /* look for options */ dolc=options(c,v); - IF dolc<2 ) { flags |= stdflg FI + IF dolc<2 ) { flags |= stdflg ;} IF (flags&stdflg)==0 ) { dolc--; - FI + ;} dolv=v+c-dolc; dolc--; /* return here for shell file execution */ @@ -77,17 +77,17 @@ main(c, v) IF *cmdadr=='-' && (input=pathopen(nullstr, profile))>=0 ) { exfile(rflag); flags &= ~ttyflg; - FI - IF rflag==0 ) { flags |= rshflg FI + ;} + IF rflag==0 ) { flags |= rshflg ;} /* open input file if specified */ IF comdiv ) { estabf(comdiv); input = -1; } else { input=((flags&stdflg) ? 0 : chkopen(cmdadr)); comdiv--; - FI + ;} // } else { *execargs=(char *)dolv; /* for `ps' cmd */ - FI + ;} exfile(0); done(); @@ -104,13 +104,13 @@ BOOL prof; IF input>0 ) { Ldup(input,INIO); input=INIO; - FI + ;} /* move output to safe place */ IF output==2 ) { Ldup(dup(2),OTIO); output=OTIO; - FI + ;} userid=getuid(); @@ -121,15 +121,15 @@ BOOL prof; flags |= ttyflg|prompt; ignsig(KILL); } else { flags |= prof; flags &= ~prompt; - FI + ;} IF setjmp(errshell) && prof ) { close(input); return; - FI + ;} /* error return here */ loopcnt=breakcnt=peekc=0; iopend=0; - IF input>=0 ) { initf(input) FI + IF input>=0 ) { initf(input) ;} /* command loop */ for(;;) { @@ -142,15 +142,15 @@ BOOL prof; && (statb.st_mtime != mailtime) && mailtime ) { prs(mailmsg) - FI + ;} mailtime=statb.st_mtime; prs(ps1nod.namval); alarm(TIMEOUT); flags |= waiting; - FI + ;} trapnote=0; peekc=readc(); IF eof ) { return; - FI + ;} alarm(0); flags &= ~waiting; execute(cmd(NL,MTFLG),0); eof |= (flags&oneflg); @@ -162,7 +162,7 @@ char eor; { IF (flags&prompt) && standin->fstak==0 && eor==NL ) { prs(ps2nod.namval); - FI + ;} } settmp() diff --git a/Applications/V7/cmd/sh/name.c b/Applications/V7/cmd/sh/name.c index 3bc99412..e0d2d8d2 100644 --- a/Applications/V7/cmd/sh/name.c +++ b/Applications/V7/cmd/sh/name.c @@ -43,7 +43,7 @@ syslook(w,syswds) DO IF first == *s && eq(w,s) ) { return(syscan->sysval); - FI + ;} syscan++; OD return(0); @@ -59,8 +59,8 @@ setlist(arg,xp) arg=arg->argnxt; IF flags&execpr ) { prs(s); - IF arg ) { blank(); } else { newline(); FI - FI + IF arg ) { blank(); } else { newline(); ;} + ;} OD } @@ -81,10 +81,10 @@ void setname(argi, xp) IF xp&N_ENVNAM ) { n->namenv = n->namval = argscan; } else { assign(n, argscan); - FI + ;} return; - FI - FI + ;} + ;} failed(argi,notid); } @@ -101,7 +101,7 @@ dfault(n,v) { IF n->namval==0 ) { assign(n,v) - FI + ;} } assign(n,v) @@ -111,7 +111,7 @@ assign(n,v) IF n->namflg&N_RDONLY ) { failed(n->namid,wtfailed); } else { replace(&n->namval,v); - FI + ;} } INT readvar(names) @@ -127,7 +127,7 @@ INT readvar(names) push(f); initf(dup(0)); IF lseek(0,0L,1)==-1 ) { f->fsiz=1; - FI + ;} for(;;) { c=nextc(0); @@ -137,19 +137,19 @@ INT readvar(names) IF *names ) { n=lookup(*names++); } else { n=0; - FI + ;} IF eolchar(c) ) { break; - FI + ;} } else { pushstak(c); - FI + ;} } WHILE n DO assign(n, nullstr); - IF *names ) { n=lookup(*names++); } else { n=0; FI + IF *names ) { n=lookup(*names++); } else { n=0; ;} OD - IF eof ) { rc=1 FI + IF eof ) { rc=1 ;} lseek(0, (long)(f->fnxt-f->fend), 1); pop(); return(rc); @@ -171,7 +171,7 @@ STRING make(v) ) { movstr(v,p=alloc(length(v))); return(p); } else { return(0); - FI + ;} } @@ -184,14 +184,14 @@ NAMPTR lookup(nam) IF !chkid(nam) ) { failed(nam,notid); - FI + ;} WHILE nscan DO IF (LR=cf(nam,nscan->namid))==0 ) { return(nscan); } else if ( LR<0 ) { prev = &(nscan->namlft); } else { prev = &(nscan->namrgt); - FI + ;} nscan = *prev; OD @@ -213,9 +213,9 @@ static BOOL chkid(nam) } else { WHILE *++cp DO IF !alphanum(*cp) ) { return(FALSE); - FI + ;} OD - FI + ;} return(TRUE); } @@ -234,7 +234,7 @@ static void namwalk(np) ) { namwalk(np->namlft); (*namfn)(np); namwalk(np->namrgt); - FI + ;} } void printnam(n) @@ -247,7 +247,7 @@ void printnam(n) ) { prs(n->namid); prc('='); prs(s); newline(); - FI + ;} } static STRING staknam(n) @@ -269,7 +269,7 @@ void exname(n) n->namenv = make(n->namval); } else { free(n->namval); n->namval = make(n->namenv); - FI + ;} } void printflg(n) @@ -277,13 +277,13 @@ void printflg(n) { IF n->namflg&N_EXPORT ) { prs(export); blank(); - FI + ;} IF n->namflg&N_RDONLY ) { prs(readonly); blank(); - FI + ;} IF n->namflg&(N_EXPORT|N_RDONLY) ) { prs(n->namid); newline(); - FI + ;} } void sh_getenv(void) @@ -309,7 +309,7 @@ void pushnam(n) { IF n->namval ) { *argnam++ = staknam(n); - FI + ;} } STRING *sh_setenv(void) diff --git a/Applications/V7/cmd/sh/print.c b/Applications/V7/cmd/sh/print.c index 8726adcc..d2d57b89 100644 --- a/Applications/V7/cmd/sh/print.c +++ b/Applications/V7/cmd/sh/print.c @@ -28,7 +28,7 @@ prp() { IF (flags&prompt)==0 && cmdadr ) { prs(cmdadr); prs(colon); - FI + ;} } void prs(as) @@ -38,7 +38,7 @@ void prs(as) IF s=as ) { write(output,s,length(s)-1); - FI + ;} } void prc(c) @@ -46,7 +46,7 @@ void prc(c) { IF c ) { write(output,&c,1); - FI + ;} } prt(t) @@ -59,7 +59,7 @@ prt(t) min=t%60; IF hr=t/60 ) { prn(hr); prc('h'); - FI + ;} prn(min); prc('m'); prn(sec); prc('s'); } @@ -75,7 +75,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 - DO IF (pr |= (d=a/i)) ) { *abuf++=d+'0' FI + DO IF (pr |= (d=a/i)) ) { *abuf++=d+'0' ;} a %= i; OD *abuf++=a+'0'; @@ -94,6 +94,6 @@ STRING icp; IF r<0 || cp==icp ) { failed(icp,badnum); } else { return(r); - FI + ;} } diff --git a/Applications/V7/cmd/sh/service.c b/Applications/V7/cmd/sh/service.c index 26fbf4b6..2bc97e90 100644 --- a/Applications/V7/cmd/sh/service.c +++ b/Applications/V7/cmd/sh/service.c @@ -53,7 +53,7 @@ void initio(iop) } else if ( (fd=stoi(ion))>=USERIO ) { failed(ion,badfile); } else { fd=dup(fd); - FI + ;} } else if ( (iof&IOPUT)==0 ) { fd=chkopen(ion); } else if ( flags&rshflg @@ -61,13 +61,13 @@ void initio(iop) } else if ( iof&IOAPP && (fd=open(ion,1))>=0 ) { lseek(fd, 0L, 2); } else { fd=create(ion); - FI + ;} IF fd>=0 ) { sh_rename(fd,iof&IOUFD); - FI - FI + ;} + ;} initio(iop->ionxt); - FI + ;} } STRING getpath(s) @@ -78,11 +78,11 @@ STRING getpath(s) ) { IF flags&rshflg ) { failed(s, restricted); } else { return(nullstr); - FI + ;} } else if ( (path = pathnod.namval)==0 ) { return(defpath); } else { return(cpystak(path)); - FI + ;} } INT pathopen(path, name) @@ -104,8 +104,8 @@ STRING catpath(path,name) argp = locstak(); WHILE *scanp && *scanp!=COLON DO *argp++ = *scanp++ OD - IF scanp!=path ) { *argp++='/' FI - IF *scanp==COLON ) { scanp++ FI + IF scanp!=path ) { *argp++='/' ;} + IF *scanp==COLON ) { scanp++ ;} path=(*scanp ? scanp : 0); scanp=name; WHILE (*argp++ = *scanp++) DONE return(path); @@ -126,7 +126,7 @@ void execa(at) xecenv=sh_setenv(); WHILE path=execs(path,t) DONE failed(*t,xecmsg); - FI + ;} } static STRING execs(ap,t) @@ -145,7 +145,7 @@ static STRING execs(ap,t) flags=0; comdiv=0; ioset=0; clearup(); /* remove open files and for loop junk */ - IF input ) { close(input) FI + IF input ) { close(input) ;} close(output); output=2; input=chkopen(p); @@ -193,9 +193,9 @@ void post(pcsid) IF pwc >= MAXP-1 ) { pw--; } else { pwc++; - FI + ;} *pw = pcsid; - FI + ;} } void await(i) @@ -218,11 +218,11 @@ void await(i) DO IF *pw==p ) { *pw=0; pwc--; } else { pw++; - FI + ;} OD } - IF p == -1 ) { continue FI + IF p == -1 ) { continue ;} w_hi = (w>>8)&LOBYTE; @@ -230,24 +230,24 @@ void await(i) ) { IF sig == 0177 /* ptrace! return */ ) { prs("ptrace: "); sig = w_hi; - FI + ;} IF sysmsg[sig] - ) { IF i!=p || (flags&prompt)==0 ) { prp(); prn(p); blank() FI + ) { IF i!=p || (flags&prompt)==0 ) { prp(); prn(p); blank() ;} prs(sysmsg[sig]); - IF w&0200 ) { prs(coredump) FI - FI + IF w&0200 ) { prs(coredump) ;} + ;} newline(); - FI + ;} IF rc==0 ) { rc = (sig ? sig|SIGFLG : w_hi); - FI + ;} wx |= w; OD IF wx && flags&errflg ) { exitsh(rc); - FI + ;} exitval=rc; exitset(); } @@ -263,7 +263,7 @@ trim(at) IF p=at ) { WHILE c = *p DO *p++=c&STRIP; q |= c OD - FI + ;} nosubst=q"E; } @@ -287,11 +287,11 @@ STRING *scan(argn) DO *--comargn = argp->argval; IF argp = argp->argnxt ) { trim(*comargn); - FI + ;} IF argp==0 || Rcheat(argp)&ARGMK ) { gsort(comargn,comargm); comargm = comargn; - FI + ;} /* Lcheat(argp) &= ~ARGMK; */ argp = (ARGPTR)(Rcheat(argp)&~ARGMK); OD @@ -304,7 +304,7 @@ static void gsort(from,to) INT k, m, n; REG INT i, j; - IF (n=to-from)<=1 ) { return FI + IF (n=to-from)<=1 ) { return ;} FOR j=1; j<=n; j*=2 DONE @@ -316,7 +316,7 @@ static void gsort(from,to) IF cf(fromi[m],fromi[0])>0 ) { break; } else { STRING s; s=fromi[m]; fromi[m]=fromi[0]; fromi[0]=s; - FI + ;} OD OD OD @@ -337,7 +337,7 @@ INT getarg(ac) DO count += split(macro(argp->argval)); argp=argp->argnxt; OD - FI + ;} return(count); } @@ -356,15 +356,15 @@ static INT split(s) ) { IF c ) { continue; } else { return(count); - FI + ;} } else if (c==0 ) { s--; - FI + ;} IF c=expand(((ARGPTR)(argp=endstak(argp)))->argval,0) ) { count += c; } else { /* assign(&fngnod, argp->argval); */ makearg(argp); count++; - FI + ;} Lcheat(gchain) |= ARGMK; } } diff --git a/Applications/V7/cmd/sh/stak.c b/Applications/V7/cmd/sh/stak.c index 73f1f681..592eaef9 100644 --- a/Applications/V7/cmd/sh/stak.c +++ b/Applications/V7/cmd/sh/stak.c @@ -38,8 +38,8 @@ STKPTR locstak() ) { setbrk(brkincr); IF brkincr < BRKMAX ) { brkincr += 256; - FI - FI + ;} + ;} return(stakbot); } @@ -74,7 +74,7 @@ stakchk() { IF (brkend-stakbas)>BRKINCR+BRKINCR ) { setbrk(-BRKINCR); - FI + ;} } STKPTR cpystak(x) diff --git a/Applications/V7/cmd/sh/string.c b/Applications/V7/cmd/sh/string.c index d8904c9a..020d2a06 100644 --- a/Applications/V7/cmd/sh/string.c +++ b/Applications/V7/cmd/sh/string.c @@ -31,7 +31,7 @@ INT any(c,s) WHILE d = *s++ DO IF d==c ) { return(TRUE); - FI + ;} OD return(FALSE); } @@ -42,7 +42,7 @@ INT cf(s1, s2) WHILE *s1++ == *s2 DO IF *s2++==0 ) { return(0); - FI + ;} OD return(*--s1 - *s2); } @@ -52,6 +52,6 @@ INT length(as) { REG STRING s; - IF s=as ) { WHILE *s++ DONE FI + IF s=as ) { WHILE *s++ DONE ;} return(s-as); } diff --git a/Applications/V7/cmd/sh/word.c b/Applications/V7/cmd/sh/word.c index 04efdefb..2bc5484d 100644 --- a/Applications/V7/cmd/sh/word.c +++ b/Applications/V7/cmd/sh/word.c @@ -35,17 +35,17 @@ word() DO *argp++=(c|QUOTE); chkpr(c) OD *argp++=(DQUOTE); } else { *argp++=(c); - IF c=='=' ) { wdset |= alpha FI - IF !alphanum(c) ) { alpha=0 FI + IF c=='=' ) { wdset |= alpha ;} + IF !alphanum(c) ) { alpha=0 ;} IF qotchar(c) ) { d=c; WHILE (*argp++=(c=nextc(d))) && c!=d DO chkpr(c) OD - FI - FI + ;} + ;} PER (c=nextc(0), !eofmeta(c)) DONE argp=endstak(argp); - IF !letter(((ARGPTR)argp)->argval[0]) ) { wdset=0 FI + IF !letter(((ARGPTR)argp)->argval[0]) ) { wdset=0 ;} peekc=c|MARK; IF ((ARGPTR)argp)->argval[1]==0 && (d=((ARGPTR)argp)->argval[0], digit(d)) && (c=='>' || c=='<') @@ -53,21 +53,21 @@ word() } else { /*check for reserved words*/ IF reserv==FALSE || (wdval=syslook(((ARGPTR)argp)->argval,reserved))==0 ) { wdarg=(ARGPTR)argp; wdval=0; - FI - FI + ;} + ;} } else if ( dipchar(c) ) { IF (d=nextc(0))==c ) { wdval = c|SYMREP; } else { peekc = d|MARK; wdval = c; - FI + ;} } else { IF (wdval=c)==EOF ) { wdval=EOFSYM; - FI + ;} IF iopend && eolchar(c) ) { copy(iopend); iopend=0; - FI - FI + ;} + ;} reserv=FALSE; return(wdval); } @@ -82,8 +82,8 @@ nextc(quote) } else if ( quote && c!=quote && !escchar(c) ) { peekc=c|MARK; } else { d = c|QUOTE; - FI - FI + ;} + ;} return(d); } @@ -102,19 +102,19 @@ retry: ) { IF estabf(*f->feval++) ) { c=EOF; } else { c=SP; - FI + ;} } else { goto retry; /* = c=readc(); */ - FI - FI - IF flags&readpr && standin->fstak==0 ) { prc(c) FI - IF c==NL ) { f->flin++ FI + ;} + ;} + IF flags&readpr && standin->fstak==0 ) { prc(c) ;} + IF c==NL ) { f->flin++ ;} } else if ( f->feof || f->fdes<0 ) { c=EOF; f->feof++; } else if ( (len=readb())<=0 ) { close(f->fdes); f->fdes = -1; c=EOF; f->feof++; } else { f->fend = (f->fnxt = f->fbuf)+len; goto retry; - FI + ;} return(c); } @@ -123,7 +123,7 @@ static readb() REG FILE f=standin; REG INT len; - REP IF trapnote&SIGSET ) { newline(); sigchk() FI + REP IF trapnote&SIGSET ) { newline(); sigchk() ;} PER (len=read(f->fdes,f->fbuf,f->fsiz))<0 && trapnote DONE return(len); } diff --git a/Applications/V7/cmd/sh/xec.c b/Applications/V7/cmd/sh/xec.c index 386d83a8..55797fbf 100644 --- a/Applications/V7/cmd/sh/xec.c +++ b/Applications/V7/cmd/sh/xec.c @@ -55,7 +55,7 @@ execute(argt, execflg, pf1, pf2) IF (internal=syslook(com[0],commands)) || argn==0 ) { setlist(((COMPTR)t)->comset, 0); - FI + ;} IF argn && (flags&noexec)==0 ) { /* print command if execpr */ @@ -64,7 +64,7 @@ execute(argt, execflg, pf1, pf2) WHILE com[argn]!=ENDARGS DO prs(com[argn++]); blank() OD newline(); - FI + ;} switch(internal) { @@ -75,8 +75,8 @@ execute(argt, execflg, pf1, pf2) IF (f=pathopen(getpath(a1), a1)) < 0 ) { failed(a1,notfound); } else { execexp(0,f); - FI - FI + ;} + ;} break; case SYSTIMES: @@ -99,7 +99,7 @@ execute(argt, execflg, pf1, pf2) case SYSBREAK: IF (execbrk=loopcnt) && a1 ) { breakcnt=stoi(a1); - FI + ;} break; case SYSTRAP: @@ -107,7 +107,7 @@ execute(argt, execflg, pf1, pf2) ) { BOOL clear; IF (clear=digit(*a1))==0 ) { ++com; - FI + ;} WHILE *++com DO INT i; IF (i=stoi(*com))>=MAXTRAP || i1 ) { setargs(com+argn-argc); - FI + ;} } else if ( ((COMPTR)t)->comset==0 ) { /*scan name chain and print*/ namscan(printnam); - FI + ;} break; case SYSRDONLY: exitval=N_RDONLY; case SYSXPORT: - IF exitval==0 ) { exitval=N_EXPORT; FI + IF exitval==0 ) { exitval=N_EXPORT; ;} IF a1 ) { WHILE *++com DO attrib(lookup(*com), exitval) OD } else { namscan(printflg); - FI + ;} exitval=0; break; case SYSEVAL: IF a1 ) { execexp(a1,&com[2]); - FI + ;} break; case SYSUMASK: @@ -227,13 +227,13 @@ execute(argt, execflg, pf1, pf2) } IF internal - ) { IF io ) { error(illegal) FI + ) { IF io ) { error(illegal) ;} chktrap(); break; - FI + ;} } else if ( t->treio==0 ) { break; - FI + ;} } case TFORK: @@ -241,21 +241,21 @@ execute(argt, execflg, pf1, pf2) ) { parent=0; } else { WHILE (parent=fork()) == -1 DO sigchk(); alarm(10); pause() OD - FI + ;} IF parent ) { /* This is the parent branch of fork; */ /* it may or may not wait for the child. */ IF treeflgs&FPRS && flags&ttyflg ) { prn(parent); newline(); - FI - IF treeflgs&FPCL ) { closepipe(pf1) FI + ;} + IF treeflgs&FPCL ) { closepipe(pf1) ;} IF (treeflgs&(FAMP|FPOU))==0 ) { await(parent); } else if ( (treeflgs&FAMP)==0 ) { post(parent); } else { assnum(&pcsadr, parent); - FI + ;} chktrap(); break; @@ -272,22 +272,22 @@ execute(argt, execflg, pf1, pf2) oldsigs(); IF treeflgs&FINT ) { signal(INTR,1); signal(QUIT,1); - FI + ;} /* pipe in or out */ IF treeflgs&FPIN ) { sh_rename(pf1[INPIPE],0); close(pf1[OTPIPE]); - FI + ;} IF treeflgs&FPOU ) { sh_rename(pf2[OTPIPE],1); close(pf2[INPIPE]); - FI + ;} /* default std input for & */ IF treeflgs&FINT && ioset==0 ) { sh_rename(chkopen(devnull),0); - FI + ;} /* io redirection */ initio(t->treio); @@ -296,9 +296,9 @@ execute(argt, execflg, pf1, pf2) } else if ( com[0]!=ENDARGS ) { setlist(((COMPTR)t)->comset,N_EXPORT); execa(com); - FI + ;} done(); - FI + ;} case TPAR: sh_rename(dup(2),output); @@ -311,7 +311,7 @@ execute(argt, execflg, pf1, pf2) IF execute(((LSTPTR)t)->lstlef, 0, pf1, pv)==0 ) { execute(((LSTPTR)t)->lstrit, execflg, pv, pf2); } else { closepipe(pv); - FI + ;} } break; @@ -323,13 +323,13 @@ execute(argt, execflg, pf1, pf2) case TAND: IF execute(((LSTPTR)t)->lstlef,0)==0 ) { execute(((LSTPTR)t)->lstrit,execflg); - FI + ;} break; case TORF: IF execute(((LSTPTR)t)->lstlef,0)!=0 ) { execute(((LSTPTR)t)->lstrit,execflg); - FI + ;} break; case TFOR: @@ -345,14 +345,14 @@ execute(argt, execflg, pf1, pf2) gchain=0; trim((args=scan(getarg(((FORPTR)t)->forlst)))[0]); gchain=schain; - FI + ;} loopcnt++; WHILE *args!=ENDARGS && execbrk==0 DO assign(n,*args++); execute(((FORPTR)t)->fortre,0); - IF execbrk<0 ) { execbrk=0 FI + IF execbrk<0 ) { execbrk=0 ;} OD - IF breakcnt ) { breakcnt-- FI + IF breakcnt ) { breakcnt-- ;} execbrk=breakcnt; loopcnt--; argfor=freeargs(argsav); } @@ -366,9 +366,9 @@ execute(argt, execflg, pf1, pf2) loopcnt++; WHILE execbrk==0 && (execute(((WHPTR)t)->whtre,0)==0)==(type==TWH) DO i=execute(((WHPTR)t)->dotre,0); - IF execbrk<0 ) { execbrk=0 FI + IF execbrk<0 ) { execbrk=0 ;} OD - IF breakcnt ) { breakcnt-- FI + IF breakcnt ) { breakcnt-- ;} execbrk=breakcnt; loopcnt--; exitval=i; } break; @@ -377,7 +377,7 @@ execute(argt, execflg, pf1, pf2) IF execute(((IFPTR)t)->iftre,0)==0 ) { execute(((IFPTR)t)->thtre,execflg); } else { execute(((IFPTR)t)->eltre,execflg); - FI + ;} break; case TSW: @@ -392,15 +392,15 @@ execute(argt, execflg, pf1, pf2) ) { execute(((REGPTR)t)->regcom,0); t=0; break; } else { rex=((ARGPTR)rex)->argnxt; - FI + ;} OD - IF t ) { t=(TREPTR)((REGPTR)t)->regnxt FI + IF t ) { t=(TREPTR)((REGPTR)t)->regnxt ;} OD } break; } exitset(); - FI + ;} sigchk(); tdystak(sav); @@ -418,7 +418,7 @@ execexp(s,f) ) { estabf(s); fb.feval=(STRING *)f; } else if ( f>=0 ) { initf(f); - FI + ;} execute(cmd(NL, NLFLG|MTFLG),0); pop(); } -- 2.34.1