From acb727a1a02a99ffed94f620fa2252afea5181a5 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Sun, 10 May 2015 21:40:40 +0100 Subject: [PATCH] sh: fix ANDF and ORF --- Applications/V7/cmd/sh/args.c | 6 +++--- Applications/V7/cmd/sh/blok.c | 6 +++--- Applications/V7/cmd/sh/cmd.c | 18 +++++++++--------- Applications/V7/cmd/sh/ctype.h | 32 ++++++++++++++++---------------- Applications/V7/cmd/sh/expand.c | 14 +++++++------- Applications/V7/cmd/sh/fault.c | 4 ++-- Applications/V7/cmd/sh/io.c | 4 ++-- Applications/V7/cmd/sh/mac.h | 5 ----- Applications/V7/cmd/sh/macro.c | 12 ++++++------ Applications/V7/cmd/sh/main.c | 18 +++++++++--------- Applications/V7/cmd/sh/name.c | 4 ++-- Applications/V7/cmd/sh/print.c | 6 +++--- Applications/V7/cmd/sh/service.c | 14 +++++++------- Applications/V7/cmd/sh/word.c | 18 +++++++++--------- Applications/V7/cmd/sh/xec.c | 28 ++++++++++++++-------------- 15 files changed, 92 insertions(+), 97 deletions(-) diff --git a/Applications/V7/cmd/sh/args.c b/Applications/V7/cmd/sh/args.c index 04eb1311..2f2d1db6 100644 --- a/Applications/V7/cmd/sh/args.c +++ b/Applications/V7/cmd/sh/args.c @@ -37,16 +37,16 @@ INT options(argc,argv) REG STRING flagc; STRING flagp; - IF argc>1 ANDF *argp[1]=='-' + IF argc>1 && *argp[1]=='-' THEN cp=argp[1]; flags &= ~(execpr|readpr); WHILE *++cp DO flagc=flagchar; - WHILE *flagc ANDF *flagc != *cp DO flagc++ OD + WHILE *flagc && *flagc != *cp DO flagc++ OD IF *cp == *flagc THEN flags |= flagval[flagc-flagchar]; - ELIF *cp=='c' ANDF argc>2 ANDF comdiv==0 + ELIF *cp=='c' && argc>2 && comdiv==0 THEN comdiv=argp[2]; argp[1]=argp[0]; argp++; argc--; ELSE failed(argv[1],badopt); diff --git a/Applications/V7/cmd/sh/blok.c b/Applications/V7/cmd/sh/blok.c index 0a6686d0..d76fefe3 100644 --- a/Applications/V7/cmd/sh/blok.c +++ b/Applications/V7/cmd/sh/blok.c @@ -47,7 +47,7 @@ ADDRESS alloc(nbytes) FI FI q = p; p = BLK(Rcheat(p->word)&~BUSY); - PER p>q ORF (c++)==0 DONE + PER p>q || (c++)==0 DONE addblok(rbytes); POOL } @@ -81,7 +81,7 @@ void free(void *ap) { BLKPTR p; - IF (p=ap) ANDF pword) &= ~BUSY; FI } @@ -98,7 +98,7 @@ chkbptr(ptr) LOOP q = Rcheat(p->word)&~BUSY; IF p==ptr THEN exf++ FI - IF qbloktop THEN abort(3) FI + IF qbloktop THEN abort(3) FI IF p==bloktop THEN break FI IF busy(p) THEN us += q-p; diff --git a/Applications/V7/cmd/sh/cmd.c b/Applications/V7/cmd/sh/cmd.c index 50d41626..e5ec07bf 100644 --- a/Applications/V7/cmd/sh/cmd.c +++ b/Applications/V7/cmd/sh/cmd.c @@ -50,7 +50,7 @@ static TREPTR makelist(type,i,r) { REG LSTPTR t; - IF i==0 ORF r==0 + IF i==0 || r==0 THEN synbad(); ELSE t = (LSTPTR)getstak(LSTTYPE); t->lsttyp = type; @@ -79,7 +79,7 @@ TREPTR cmd(sym,flg) THEN IF flg&NLFLG THEN wdval=';'; chkpr(NL); FI - ELIF i==0 ANDF (flg&MTFLG)==0 + ELIF i==0 && (flg&MTFLG)==0 THEN synbad(); FI @@ -124,8 +124,8 @@ static TREPTR list(flg) REG INT b; r = term(flg); - WHILE r ANDF ((b=(wdval==ANDFSYM)) ORF wdval==ORFSYM) - DO r = makelist((b ? TAND : TORF), r, term(NLFLG)); + WHILE r && ((b=(wdval==ANDFSYM)) || wdval==||SYM) + DO r = makelist((b ? TAND : T||), r, term(NLFLG)); OD return(r); } @@ -146,7 +146,7 @@ static TREPTR term(flg) ELSE word(); FI - IF (t=item(TRUE)) ANDF (wdval=='^' ORF wdval=='|') + IF (t=item(TRUE)) && (wdval=='^' || wdval=='|') THEN return(makelist(TFIL, makefork(FPOU,t), makefork(FPIN|FPCL,term(NLFLG)))); ELSE return(t); FI @@ -162,7 +162,7 @@ static REGPTR syncase(esym) r->regptr=0; LOOP wdarg->argnxt=r->regptr; r->regptr=wdarg; - IF wdval ORF ( word()!=')' ANDF wdval!='|' ) + IF wdval || ( word()!=')' && wdval!='|' ) THEN synbad(); FI IF wdval=='|' @@ -237,7 +237,7 @@ static TREPTR item(flag) IF skipnl()==INSYM THEN chkword(); ((FORPTR)t)->forlst=(COMPTR)item(0); - IF wdval!=NL ANDF wdval!=';' + IF wdval!=NL && wdval!=';' THEN synbad(); FI chkpr(wdval); skipnl(); @@ -287,7 +287,7 @@ static TREPTR item(flag) argtail = &(((COMPTR)t)->comarg); WHILE wdval==0 DO argp = wdarg; - IF wdset ANDF keywd + IF wdset && keywd THEN argp->argnxt=(ARGPTR)argset; argset=(ARGPTR *)argp; ELSE *argtail=argp; argtail = &(argp->argnxt); keywd=flags&keyflg; @@ -385,7 +385,7 @@ static void prsym(sym) IF sym&SYMFLG THEN REG SYSPTR sp=reserved; WHILE sp->sysval - ANDF sp->sysval!=sym + && sp->sysval!=sym DO sp++ OD prs(sp->sysnam); ELIF sym==EOFSYM diff --git a/Applications/V7/cmd/sh/ctype.h b/Applications/V7/cmd/sh/ctype.h index e50019a1..f295606a 100644 --- a/Applications/V7/cmd/sh/ctype.h +++ b/Applications/V7/cmd/sh/ctype.h @@ -71,22 +71,22 @@ extern char _ctype1[]; /* nb these args are not call by value !!!! */ -#define space(c) (((c)"E)==0 ANDF _ctype1[c]&(T_SPC)) -#define eofmeta(c) (((c)"E)==0 ANDF _ctype1[c]&(_META|T_EOF)) -#define qotchar(c) (((c)"E)==0 ANDF _ctype1[c]&(T_QOT)) -#define eolchar(c) (((c)"E)==0 ANDF _ctype1[c]&(T_EOR|T_EOF)) -#define dipchar(c) (((c)"E)==0 ANDF _ctype1[c]&(T_DIP)) -#define subchar(c) (((c)"E)==0 ANDF _ctype1[c]&(T_SUB|T_QOT)) -#define escchar(c) (((c)"E)==0 ANDF _ctype1[c]&(T_ESC)) +#define space(c) (((c)"E)==0 && _ctype1[c]&(T_SPC)) +#define eofmeta(c) (((c)"E)==0 && _ctype1[c]&(_META|T_EOF)) +#define qotchar(c) (((c)"E)==0 && _ctype1[c]&(T_QOT)) +#define eolchar(c) (((c)"E)==0 && _ctype1[c]&(T_EOR|T_EOF)) +#define dipchar(c) (((c)"E)==0 && _ctype1[c]&(T_DIP)) +#define subchar(c) (((c)"E)==0 && _ctype1[c]&(T_SUB|T_QOT)) +#define escchar(c) (((c)"E)==0 && _ctype1[c]&(T_ESC)) extern char _ctype2[]; -#define digit(c) (((c)"E)==0 ANDF _ctype2[c]&(T_DIG)) -#define fngchar(c) (((c)"E)==0 ANDF _ctype2[c]&(T_FNG)) -#define dolchar(c) (((c)"E)==0 ANDF _ctype2[c]&(T_AST|T_BRC|T_DIG|T_IDC|T_SHN)) -#define defchar(c) (((c)"E)==0 ANDF _ctype2[c]&(T_DEF)) -#define setchar(c) (((c)"E)==0 ANDF _ctype2[c]&(T_SET)) -#define digchar(c) (((c)"E)==0 ANDF _ctype2[c]&(T_AST|T_DIG)) -#define letter(c) (((c)"E)==0 ANDF _ctype2[c]&(T_IDC)) -#define alphanum(c) (((c)"E)==0 ANDF _ctype2[c]&(_IDCH)) -#define astchar(c) (((c)"E)==0 ANDF _ctype2[c]&(T_AST)) +#define digit(c) (((c)"E)==0 && _ctype2[c]&(T_DIG)) +#define fngchar(c) (((c)"E)==0 && _ctype2[c]&(T_FNG)) +#define dolchar(c) (((c)"E)==0 && _ctype2[c]&(T_AST|T_BRC|T_DIG|T_IDC|T_SHN)) +#define defchar(c) (((c)"E)==0 && _ctype2[c]&(T_DEF)) +#define setchar(c) (((c)"E)==0 && _ctype2[c]&(T_SET)) +#define digchar(c) (((c)"E)==0 && _ctype2[c]&(T_AST|T_DIG)) +#define letter(c) (((c)"E)==0 && _ctype2[c]&(T_IDC)) +#define alphanum(c) (((c)"E)==0 && _ctype2[c]&(_IDCH)) +#define astchar(c) (((c)"E)==0 && _ctype2[c]&(T_AST)) diff --git a/Applications/V7/cmd/sh/expand.c b/Applications/V7/cmd/sh/expand.c index 5dfc3b15..f86fe500 100644 --- a/Applications/V7/cmd/sh/expand.c +++ b/Applications/V7/cmd/sh/expand.c @@ -50,7 +50,7 @@ INT expand(as,rflg) REG BOOL slash; slash=0; WHILE !fngchar(*cs) DO IF *cs++==0 - THEN IF rflg ANDF slash THEN break; ELSE return(0) FI + THEN IF rflg && slash THEN break; ELSE return(0) FI ELIF *cs=='/' THEN slash++; FI @@ -67,8 +67,8 @@ INT expand(as,rflg) FI POOL IF stat(s,&statb)>=0 - ANDF (statb.st_mode&S_IFMT)==S_IFDIR - ANDF (dirf=open(s,0))>0 + && (statb.st_mode&S_IFMT)==S_IFDIR + && (dirf=open(s,0))>0 THEN dir++; FI count=0; @@ -81,9 +81,9 @@ INT expand(as,rflg) PER *rs++ DONE // FIXME: readdir - WHILE read(dirf, (void *)&entry, 32) == 32 ANDF (trapnote&SIGSET) == 0 - DO IF entry.d_ino==0 ORF - (*entry.d_name=='.' ANDF *cs!='.') + WHILE read(dirf, (void *)&entry, 32) == 32 && (trapnote&SIGSET) == 0 + DO IF entry.d_ino==0 || + (*entry.d_name=='.' && *cs!='.') THEN continue; FI IF gmatch(entry.d_name, cs) @@ -135,7 +135,7 @@ gmatch(s, p) DO IF c==']' THEN return(ok?gmatch(s,p):0); ELIF c==MINUS - THEN IF lc<=scc ANDF scc<=(*p++) THEN ok++ FI + THEN IF lc<=scc && scc<=(*p++) THEN ok++ FI ELSE IF scc==(lc=(c&STRIP)) THEN ok++ FI FI OD diff --git a/Applications/V7/cmd/sh/fault.c b/Applications/V7/cmd/sh/fault.c index c3a69cda..1defdb1f 100644 --- a/Applications/V7/cmd/sh/fault.c +++ b/Applications/V7/cmd/sh/fault.c @@ -63,7 +63,7 @@ getsig(n) { REG INT i; - IF trapflg[i=n]&SIGMOD ORF ignsig(i)==0 + IF trapflg[i=n]&SIGMOD || ignsig(i)==0 THEN signal(i,fault); FI } @@ -76,7 +76,7 @@ oldsigs() i=MAXTRAP; WHILE i-- DO t=trapcom[i]; - IF t==0 ORF *t + IF t==0 || *t THEN clrsig(i); FI trapflg[i]=0; diff --git a/Applications/V7/cmd/sh/io.c b/Applications/V7/cmd/sh/io.c index 4d04a9c2..09bc6edf 100644 --- a/Applications/V7/cmd/sh/io.c +++ b/Applications/V7/cmd/sh/io.c @@ -61,7 +61,7 @@ pop() chkpipe(pv) INT *pv; { - IF pipe(pv)<0 ORF pv[INPIPE]<0 ORF pv[OTPIPE]<0 + IF pipe(pv)<0 || pv[INPIPE]<0 || pv[OTPIPE]<0 THEN error(piperr); FI } @@ -126,7 +126,7 @@ copy(ioparg) LOOP clinep=cline; chkpr(NL); WHILE (c = (nosubst ? readc() : nextc(*ends)), !eolchar(c)) DO *clinep++ = c OD *clinep=0; - IF eof ORF eq(cline,ends) THEN break FI + IF eof || eq(cline,ends) THEN break FI *clinep++=NL; write(fd,cline,clinep-cline); POOL diff --git a/Applications/V7/cmd/sh/mac.h b/Applications/V7/cmd/sh/mac.h index e5b97c1f..54e11f7c 100644 --- a/Applications/V7/cmd/sh/mac.h +++ b/Applications/V7/cmd/sh/mac.h @@ -36,11 +36,6 @@ #define LOOP for(;;){ #define POOL } - -#define NEQ ^ -#define ANDF && -#define ORF || - #define TRUE (-1) #define FALSE 0 #define LOBYTE 0377 diff --git a/Applications/V7/cmd/sh/macro.c b/Applications/V7/cmd/sh/macro.c index 402edb60..92ef199d 100644 --- a/Applications/V7/cmd/sh/macro.c +++ b/Applications/V7/cmd/sh/macro.c @@ -26,7 +26,7 @@ static STRING copyto(endch) { REG CHAR c; - WHILE (c=getch(endch))!=endch ANDF c + WHILE (c=getch(endch))!=endch && c DO pushstak(c|quote) OD zerostak(); IF c!=endch THEN error(badsub) FI @@ -37,7 +37,7 @@ static skipto(endch) { /* skip chars up to } */ REG CHAR c; - WHILE (c=readc()) ANDF c!=endch + WHILE (c=readc()) && c!=endch DO SWITCH c IN case SQUOTE: skipto(SQUOTE); break; @@ -101,7 +101,7 @@ retry: ELSE goto retry; FI c = readc(); - IF !defchar(c) ANDF bra + IF !defchar(c) && bra THEN error(badsub); FI argp=0; @@ -120,7 +120,7 @@ retry: THEN IF c!='+' THEN LOOP WHILE c = *v++ DO pushstak(c|quote); OD - IF dolg==0 ORF (++dolg>dolc) + IF dolg==0 || (++dolg>dolc) THEN break; ELSE v=dolv[dolg]; pushstak(SP|(*id=='*' ? quote : 0)); FI @@ -166,7 +166,7 @@ STRING macro(as) quote=0; quoted=0; copyto(0); pop(); - IF quoted ANDF (stakbot==staktop) THEN pushstak(QUOTE) FI + IF quoted && (stakbot==staktop) THEN pushstak(QUOTE) FI quote=savq; quoted=savqu; return(fixstak()); } @@ -179,7 +179,7 @@ static comsubst() REG STKPTR savptr = fixstak(); usestak(); - WHILE (d=readc())!=SQUOTE ANDF d + WHILE (d=readc())!=SQUOTE && d DO pushstak(d) OD BEGIN diff --git a/Applications/V7/cmd/sh/main.c b/Applications/V7/cmd/sh/main.c index 075d955e..be31cc2c 100644 --- a/Applications/V7/cmd/sh/main.c +++ b/Applications/V7/cmd/sh/main.c @@ -46,7 +46,7 @@ main(c, v) sh_getenv(); /* look for restricted */ -/* IF c>0 ANDF any('r', *v) THEN rflag=0 FI */ +/* IF c>0 && any('r', *v) THEN rflag=0 FI */ /* look for options */ dolc=options(c,v); @@ -75,7 +75,7 @@ main(c, v) IF (beenhere++)==FALSE THEN /* ? profile */ IF *cmdadr=='-' - ANDF (input=pathopen(nullstr, profile))>=0 + && (input=pathopen(nullstr, profile))>=0 THEN exfile(rflag); flags &= ~ttyflg; FI IF rflag==0 THEN flags |= rshflg FI @@ -115,14 +115,14 @@ BOOL prof; userid=getuid(); /* decide whether interactive */ - IF (flags&intflg) ORF ((flags&oneflg)==0 ANDF isatty(output) ANDF isatty(input)) + IF (flags&intflg) || ((flags&oneflg)==0 && isatty(output) && isatty(input)) THEN dfault(&ps1nod, (userid?stdprompt:supprompt)); dfault(&ps2nod, readmsg); flags |= ttyflg|prompt; ignsig(KILL); ELSE flags |= prof; flags &= ~prompt; FI - IF setjmp(errshell) ANDF prof + IF setjmp(errshell) && prof THEN close(input); return; FI @@ -134,11 +134,11 @@ BOOL prof; LOOP tdystak(0); stakchk(); /* may reduce sbrk */ exitset(); - IF (flags&prompt) ANDF standin->fstak==0 ANDF !eof + IF (flags&prompt) && standin->fstak==0 && !eof THEN IF mailnod.namval - ANDF stat(mailnod.namval,&statb)>=0 ANDF statb.st_size - ANDF (statb.st_mtime != mailtime) - ANDF mailtime + && stat(mailnod.namval,&statb)>=0 && statb.st_size + && (statb.st_mtime != mailtime) + && mailtime THEN prs(mailmsg) FI mailtime=statb.st_mtime; @@ -158,7 +158,7 @@ BOOL prof; chkpr(eor) char eor; { - IF (flags&prompt) ANDF standin->fstak==0 ANDF eor==NL + IF (flags&prompt) && standin->fstak==0 && eor==NL THEN prs(ps2nod.namval); FI } diff --git a/Applications/V7/cmd/sh/name.c b/Applications/V7/cmd/sh/name.c index 9e6fc509..a0045b48 100644 --- a/Applications/V7/cmd/sh/name.c +++ b/Applications/V7/cmd/sh/name.c @@ -41,7 +41,7 @@ syslook(w,syswds) WHILE s=syscan->sysnam DO IF first == *s - ANDF eq(w,s) + && eq(w,s) THEN return(syscan->sysval); FI syscan++; @@ -130,7 +130,7 @@ INT readvar(names) FI LOOP c=nextc(0); - IF (*names ANDF any(c, ifsnod.namval)) ORF eolchar(c) + IF (*names && any(c, ifsnod.namval)) || eolchar(c) THEN zerostak(); assign(n,absstak(rel)); setstak(rel); IF *names diff --git a/Applications/V7/cmd/sh/print.c b/Applications/V7/cmd/sh/print.c index 0821c107..9126b1b3 100644 --- a/Applications/V7/cmd/sh/print.c +++ b/Applications/V7/cmd/sh/print.c @@ -26,7 +26,7 @@ blank() prp() { - IF (flags&prompt)==0 ANDF cmdadr + IF (flags&prompt)==0 && cmdadr THEN prs(cmdadr); prs(colon); FI } @@ -89,9 +89,9 @@ STRING icp; REG INT r = 0; REG CHAR c; - WHILE (c = *cp, digit(c)) ANDF c ANDF r>=0 + WHILE (c = *cp, digit(c)) && c && r>=0 DO r = r*10 + c - '0'; cp++ OD - IF r<0 ORF cp==icp + IF r<0 || cp==icp THEN failed(icp,badnum); ELSE return(r); FI diff --git a/Applications/V7/cmd/sh/service.c b/Applications/V7/cmd/sh/service.c index 8f77a711..9c969270 100644 --- a/Applications/V7/cmd/sh/service.c +++ b/Applications/V7/cmd/sh/service.c @@ -42,7 +42,7 @@ void initio(iop) IF iop THEN iof=iop->iofile; ion=mactrim(iop->ioname); - IF *ion ANDF (flags&noexec)==0 + IF *ion && (flags&noexec)==0 THEN IF iof&IODOC THEN subst(chkopen(ion),(fd=tmpfil())); close(fd); fd=chkopen(tmpout); unlink(tmpout); @@ -58,7 +58,7 @@ void initio(iop) THEN fd=chkopen(ion); ELIF flags&rshflg THEN failed(ion,restricted); - ELIF iof&IOAPP ANDF (fd=open(ion,1))>=0 + ELIF iof&IOAPP && (fd=open(ion,1))>=0 THEN lseek(fd, 0L, 2); ELSE fd=create(ion); FI @@ -91,7 +91,7 @@ INT pathopen(path, name) REG UFD f; REP path=catpath(path,name); - PER (f=open(curstak(),0))<0 ANDF path DONE + PER (f=open(curstak(),0))<0 && path DONE return(f); } @@ -103,7 +103,7 @@ STRING catpath(path,name) REG STRING scanp = path, argp = locstak(); - WHILE *scanp ANDF *scanp!=COLON DO *argp++ = *scanp++ OD + WHILE *scanp && *scanp!=COLON DO *argp++ = *scanp++ OD IF scanp!=path THEN *argp++='/' FI IF *scanp==COLON THEN scanp++ FI path=(*scanp ? scanp : 0); scanp=name; @@ -233,7 +233,7 @@ void await(i) sig = w_hi; FI IF sysmsg[sig] - THEN IF i!=p ORF (flags&prompt)==0 THEN prp(); prn(p); blank() FI + THEN IF i!=p || (flags&prompt)==0 THEN prp(); prn(p); blank() FI prs(sysmsg[sig]); IF w&0200 THEN prs(coredump) FI FI @@ -246,7 +246,7 @@ void await(i) wx |= w; OD - IF wx ANDF flags&errflg + IF wx && flags&errflg THEN exitsh(rc); FI exitval=rc; exitset(); @@ -289,7 +289,7 @@ STRING *scan(argn) IF argp = argp->argnxt THEN trim(*comargn); FI - IF argp==0 ORF Rcheat(argp)&ARGMK + IF argp==0 || Rcheat(argp)&ARGMK THEN gsort(comargn,comargm); comargm = comargn; FI diff --git a/Applications/V7/cmd/sh/word.c b/Applications/V7/cmd/sh/word.c index 2cc10f71..50494bf7 100644 --- a/Applications/V7/cmd/sh/word.c +++ b/Applications/V7/cmd/sh/word.c @@ -31,7 +31,7 @@ word() IF !eofmeta(c) THEN REP IF c==LITERAL THEN *argp++=(DQUOTE); - WHILE (c=readc()) ANDF c!=LITERAL + WHILE (c=readc()) && c!=LITERAL DO *argp++=(c|QUOTE); chkpr(c) OD *argp++=(DQUOTE); ELSE *argp++=(c); @@ -39,7 +39,7 @@ word() IF !alphanum(c) THEN alpha=0 FI IF qotchar(c) THEN d=c; - WHILE (*argp++=(c=nextc(d))) ANDF c!=d + WHILE (*argp++=(c=nextc(d))) && c!=d DO chkpr(c) OD FI FI @@ -48,10 +48,10 @@ word() IF !letter(((ARGPTR)argp)->argval[0]) THEN wdset=0 FI peekc=c|MARK; - IF ((ARGPTR)argp)->argval[1]==0 ANDF (d=((ARGPTR)argp)->argval[0], digit(d)) ANDF (c=='>' ORF c=='<') + IF ((ARGPTR)argp)->argval[1]==0 && (d=((ARGPTR)argp)->argval[0], digit(d)) && (c=='>' || c=='<') THEN word(); wdnum=d-'0'; ELSE /*check for reserved words*/ - IF reserv==FALSE ORF (wdval=syslook(((ARGPTR)argp)->argval,reserved))==0 + IF reserv==FALSE || (wdval=syslook(((ARGPTR)argp)->argval,reserved))==0 THEN wdarg=(ARGPTR)argp; wdval=0; FI FI @@ -64,7 +64,7 @@ word() ELSE IF (wdval=c)==EOF THEN wdval=EOFSYM; FI - IF iopend ANDF eolchar(c) + IF iopend && eolchar(c) THEN copy(iopend); iopend=0; FI FI @@ -79,7 +79,7 @@ nextc(quote) IF (d=readc())==ESCAPE THEN IF (c=readc())==NL THEN chkpr(NL); d=nextc(quote); - ELIF quote ANDF c!=quote ANDF !escchar(c) + ELIF quote && c!=quote && !escchar(c) THEN peekc=c|MARK; ELSE d = c|QUOTE; FI @@ -106,9 +106,9 @@ retry: ELSE goto retry; /* = c=readc(); */ FI FI - IF flags&readpr ANDF standin->fstak==0 THEN prc(c) FI + IF flags&readpr && standin->fstak==0 THEN prc(c) FI IF c==NL THEN f->flin++ FI - ELIF f->feof ORF f->fdes<0 + ELIF f->feof || f->fdes<0 THEN c=EOF; f->feof++; ELIF (len=readb())<=0 THEN close(f->fdes); f->fdes = -1; c=EOF; f->feof++; @@ -124,6 +124,6 @@ static readb() REG INT len; REP IF trapnote&SIGSET THEN newline(); sigchk() FI - PER (len=read(f->fdes,f->fbuf,f->fsiz))<0 ANDF trapnote DONE + 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 d6e68027..73119541 100644 --- a/Applications/V7/cmd/sh/xec.c +++ b/Applications/V7/cmd/sh/xec.c @@ -15,7 +15,7 @@ static INT parent; -SYSTAB commands; +extern SYSTAB commands; @@ -32,7 +32,7 @@ execute(argt, execflg, pf1, pf2) sigchk(); - IF (t=argt) ANDF execbrk==0 + IF (t=argt) && execbrk==0 THEN REG INT treeflgs; INT oldexit, type; REG STRING *com; @@ -53,11 +53,11 @@ execute(argt, execflg, pf1, pf2) com=scan(argn); a1=com[1]; gchain=schain; - IF (internal=syslook(com[0],commands)) ORF argn==0 + IF (internal=syslook(com[0],commands)) || argn==0 THEN setlist(((COMPTR)t)->comset, 0); FI - IF argn ANDF (flags&noexec)==0 + IF argn && (flags&noexec)==0 THEN /* print command if execpr */ IF flags&execpr THEN argn=0; prs(execpmsg); @@ -97,7 +97,7 @@ execute(argt, execflg, pf1, pf2) execbrk = -loopcnt; break; case SYSBREAK: - IF (execbrk=loopcnt) ANDF a1 + IF (execbrk=loopcnt) && a1 THEN breakcnt=stoi(a1); FI break; @@ -110,7 +110,7 @@ execute(argt, execflg, pf1, pf2) FI WHILE *++com DO INT i; - IF (i=stoi(*com))>=MAXTRAP ORF i=MAXTRAP || ilstlef,0)!=0 THEN execute(((LSTPTR)t)->lstrit,execflg); FI @@ -347,7 +347,7 @@ execute(argt, execflg, pf1, pf2) gchain=schain; FI loopcnt++; - WHILE *args!=ENDARGS ANDF execbrk==0 + WHILE *args!=ENDARGS && execbrk==0 DO assign(n,*args++); execute(((FORPTR)t)->fortre,0); IF execbrk<0 THEN execbrk=0 FI @@ -364,7 +364,7 @@ execute(argt, execflg, pf1, pf2) INT i=0; loopcnt++; - WHILE execbrk==0 ANDF (execute(((WHPTR)t)->whtre,0)==0)==(type==TWH) + WHILE execbrk==0 && (execute(((WHPTR)t)->whtre,0)==0)==(type==TWH) DO i=execute(((WHPTR)t)->dotre,0); IF execbrk<0 THEN execbrk=0 FI OD @@ -388,7 +388,7 @@ execute(argt, execflg, pf1, pf2) DO ARGPTR rex=((REGPTR)t)->regptr; WHILE rex DO REG STRING s; - IF gmatch(r,s=macro(rex->argval)) ORF (trim(s), eq(r,s)) + IF gmatch(r,s=macro(rex->argval)) || (trim(s), eq(r,s)) THEN execute(((REGPTR)t)->regcom,0); t=0; break; ELSE rex=((ARGPTR)rex)->argnxt; -- 2.34.1