if (argc>1 && *argp[1]=='-'
) { cp=argp[1];
flags &= ~(execpr|readpr);
- WHILE *++cp
+ while(*++cp
DO flagc=flagchar;
- WHILE *flagc && *flagc != *cp DO flagc++ OD
+ while(*flagc && *flagc != *cp DO flagc++ OD
if (*cp == *flagc
) { flags |= flagval[flagc-flagchar];
} else if (*cp=='c' && argc>2 && comdiv==0
/* set up $- */
flagc=flagchar;
flagp=flagadr;
- WHILE *flagc
+ while(*flagc
DO if (flags&flagval[flagc-flagchar]
) { *flagp++ = *flagc;
;}
REG STRING *argp=argi;
REG INT argn=0;
- WHILE Rcheat(*argp++)!=ENDARGS DO argn++ OD
+ while(Rcheat(*argp++)!=ENDARGS DO argn++ OD
/* free old ones unless on for loop chain */
freeargs(dolh);
np=(STRING *)((DOLPTR)np)->dolarg;
dolv=np;
- WHILE n--
+ while(n--
DO *np++ = make(*fp++) OD
*np++ = ENDARGS;
return(pp);
clearup()
{
/* force `for' $* lists to go away */
- WHILE argfor=freeargs(argfor) DONE
+ while(argfor=freeargs(argfor) DONE
/* clean up io files */
- WHILE pop() DONE
+ while(pop() DONE
}
DOLPTR useargs()
REG BLKPTR p = blokp;
REG BLKPTR q;
REP if(!busy(p)
- ) { WHILE !busy(q = p->word) DO p->word = q->word OD
+ ) { while(!busy(q = p->word) DO p->word = q->word OD
if(ADR(q)-ADR(p) >= rbytes
) { blokp = BLK(ADR(p)+rbytes);
if(q > blokp
REG INT b;
r = term(flg);
- WHILE r && ((b=(wdval==ANDFSYM)) || wdval==ORFSYM)
+ while(r && ((b=(wdval==ANDFSYM)) || wdval==ORFSYM)
DO r = makelist((b ? TAND : TORF), r, term(NLFLG));
OD
return(r);
t=(TREPTR)getstak(COMTYPE);
((COMPTR)t)->comio=io; /*initial io chain*/
argtail = &(((COMPTR)t)->comarg);
- WHILE wdval==0
+ while(wdval==0
DO argp = wdarg;
if (wdset && keywd
) { argp->argnxt=(ARGPTR)argset;
static int skipnl()
{
- WHILE (reserv++, word()==NL) DO chkpr(NL) OD
+ while((reserv++, word()==NL) DO chkpr(NL) OD
return(wdval);
}
{
if (sym&SYMFLG
) { REG SYSPTR sp=reserved;
- WHILE sp->sysval
+ while(sp->sysval
&& sp->sysval!=sym
DO sp++ OD
prs(sp->sysnam);
rmtemp(base)
IOPTR base;
{
- WHILE iotemp>base
+ while(iotemp>base
DO unlink(iotemp->ioname);
iotemp=iotemp->iolst;
OD
/* check for meta chars */
{
REG BOOL slash; slash=0;
- WHILE !fngchar(*cs)
+ while(!fngchar(*cs)
DO if (*cs++==0
) { if (rflg && slash ) { break; } else { return(0) ;}
} else if ( *cs=='/'
PER *rs++ DONE
// FIXME: readdir
- WHILE read(dirf, (void *)&entry, 32) == 32 && (trapnote&SIGSET) == 0
+ while(read(dirf, (void *)&entry, 32) == 32 && (trapnote&SIGSET) == 0
DO if (entry.d_ino==0 ||
(*entry.d_name=='.' && *cs!='.')
) { continue;
rchain=gchain; gchain=schain;
if (count
) { count=0;
- WHILE rchain
+ while(rchain
DO count += expand(rchain->argval,1);
rchain=rchain->argnxt;
OD
{
REG CHAR c;
s=as;
- WHILE c = *s
+ while(c = *s
DO *s++=(c&STRIP?c:'/') OD
}
return(count);
case '[':
{BOOL ok; INT lc;
ok=0; lc=077777;
- WHILE c = *p++
+ while(c = *p++
DO if (c==']'
) { return(ok?gmatch(s,p):0);
} else if ( c==MINUS
case '*':
if (*p==0 ) { return(1) ;}
--s;
- WHILE *s
+ while(*s
DO if (gmatch(s++,p) ) { return(1) ;} OD
return(0);
s2 = locstak()+BYTESPERWORD;
s1=as1;
- WHILE c = *s1++
+ while(c = *s1++
DO if ((c &= STRIP)==0
) { *s2++='/';
break;
*s2++=c;
OD
s1=as2;
- WHILE *s2 = *s1++ DO s2++ OD
+ while(*s2 = *s1++ DO s2++ OD
if (s1=as3
) { *s2++='/';
- WHILE *s2++ = *++s1 DONE
+ while(*s2++ = *++s1 DONE
;}
makearg(endstak(s2));
}
REG STRING t;
i=MAXTRAP;
- WHILE i--
+ while(i--
DO t=trapcom[i];
if(t==0 || *t
) { clrsig(i);
REG STRING t;
trapnote &= ~TRAPSET;
- WHILE --i
+ while(--i
DO if(trapflg[i]&TRAPSET
) { trapflg[i] &= ~TRAPSET;
if(t=trapcom[i]
for (;;) {
clinep=cline; chkpr(NL);
- WHILE (c = (nosubst ? readc() : nextc(*ends)), !eolchar(c)) DO *clinep++ = c OD
+ while((c = (nosubst ? readc() : nextc(*ends)), !eolchar(c)) DO *clinep++ = c OD
*clinep=0;
if(eof || eq(cline,ends) ) { break ;}
*clinep++=NL;
#define UNION TYPE union
#define REG register
-#define WHILE while(
#define DO ){
#define OD ;}
#define REP do{
{
REG CHAR c;
- WHILE (c=getch(endch))!=endch && c
+ while((c=getch(endch))!=endch && c
DO pushstak(c|quote) OD
zerostak();
if(c!=endch ) { error(badsub) ;}
{
/* skip chars up to } */
REG CHAR c;
- WHILE (c=readc()) && c!=endch
+ while((c=readc()) && c!=endch
DO switch(c) {
case SQUOTE: skipto(SQUOTE); break;
if(bra=(c==BRACE) ) { c=readc() ;}
if(letter(c)
) { argp=(STRING)relstak();
- WHILE alphanum(c) DO pushstak(c); c=readc() OD
+ while(alphanum(c) DO pushstak(c); c=readc() OD
zerostak();
n=lookup(absstak(argp)); setstak(argp);
v = n->namval; id = n->namid;
if(v
) { if(c!='+'
) { for (;;) {
- WHILE c = *v++
+ while(c = *v++
DO pushstak(c|quote); OD
if(dolg==0 || (++dolg>dolc)
) { break;
REG STKPTR savptr = fixstak();
usestak();
- WHILE (d=readc())!=SQUOTE && d
+ while((d=readc())!=SQUOTE && d
DO pushstak(d) OD
{
close(pv[OTPIPE]);
}
tdystak(savptr); staktop=movstr(savptr,stakbot);
- WHILE d=readc() DO pushstak(d|quote) OD
+ while(d=readc() DO pushstak(d|quote) OD
await(0);
- WHILE stakbot!=staktop
+ while(stakbot!=staktop
DO if((*--staktop&STRIP)!=NL
) { ++staktop; break;
;}
push(&fb); initf(in);
/* DQUOTE used to stop it from quoting */
- WHILE c=(getch(DQUOTE)&STRIP)
+ while(c=(getch(DQUOTE)&STRIP)
DO pushstak(c);
if(--count == 0
) { flush(ot); count=CPYSIZ;
syscan=syswds; first = *w;
- WHILE s=syscan->sysnam
+ while(s=syscan->sysnam
DO if (first == *s
&& eq(w,s)
) { return(syscan->sysval);
REG ARGPTR arg;
INT xp;
{
- WHILE arg
+ while(arg
DO REG STRING s=mactrim(arg->argval);
setname(s, xp);
arg=arg->argnxt;
REG NAMPTR n;
if (letter(*argscan)
- ) { WHILE alphanum(*argscan) DO argscan++ OD
+ ) { while(alphanum(*argscan) DO argscan++ OD
if (*argscan=='='
) { *argscan = 0;
n=lookup(argi);
} else { pushstak(c);
;}
}
- WHILE n
+ while(n
DO assign(n, nullstr);
if (*names ) { n=lookup(*names++); } else { n=0; ;}
OD
if (!chkid(nam)
) { failed(nam,notid);
;}
- WHILE nscan
+ while(nscan
DO if ((LR=cf(nam,nscan->namid))==0
) { return(nscan);
} else if ( LR<0
if (!letter(*cp)
) { return(FALSE);
- } else { WHILE *++cp
+ } else { while(*++cp
DO if (!alphanum(*cp)
) { return(FALSE);
;}
{
REG STRING *e=environ;
- WHILE *e
+ while(*e
DO setname(*e++, N_ENVNAM) OD
}
REG INT r = 0;
REG CHAR c;
- WHILE (c = *cp, digit(c)) && c && r>=0
+ while((c = *cp, digit(c)) && c && r>=0
DO r = r*10 + c - '0'; cp++ OD
if (r<0 || cp==icp
) { failed(icp,badnum);
REG STRING scanp = path,
argp = locstak();
- WHILE *scanp && *scanp!=COLON DO *argp++ = *scanp++ OD
+ while(*scanp && *scanp!=COLON DO *argp++ = *scanp++ OD
if(scanp!=path ) { *argp++='/' ;}
if(*scanp==COLON ) { scanp++ ;}
path=(*scanp ? scanp : 0); scanp=name;
- WHILE (*argp++ = *scanp++) DONE
+ while((*argp++ = *scanp++) DONE
return(path);
}
) { xecmsg=notfound; path=getpath(*t);
namscan(exname);
xecenv=sh_setenv();
- WHILE path=execs(path,t) DONE
+ while(path=execs(path,t) DONE
failed(*t,xecmsg);
;}
}
{
REG INT *pw = pwlist;
- WHILE pw <= &pwlist[pwc]
+ while(pw <= &pwlist[pwc]
DO *pw++ = 0 OD
pwc=0;
}
REG INT *pw = pwlist;
if(pcsid
- ) { WHILE *pw DO pw++ OD
+ ) { while(*pw DO pw++ OD
if(pwc >= MAXP-1
) { pw--;
} else { pwc++;
INT ipwc = pwc;
post(i);
- WHILE pwc
+ while(pwc
DO REG INT p;
REG INT sig;
INT w_hi;
{
REG INT *pw=pwlist;
p=wait(&w);
- WHILE pw <= &pwlist[ipwc]
+ while(pw <= &pwlist[ipwc]
DO if(*pw==p
) { *pw=0; pwc--;
} else { pw++;
REG CHAR q=0;
if(p=at
- ) { WHILE c = *p
+ ) { while(c = *p
DO *p++=c&STRIP; q |= c OD
;}
nosubst=q"E;
comargn=(STRING *)getstak(BYTESPERWORD*argn+BYTESPERWORD); comargm = comargn += argn; *comargn = ENDARGS;
- WHILE argp
+ while(argp
DO *--comargn = argp->argval;
if(argp = argp->argnxt
) { trim(*comargn);
if(c=ac
) { argp=c->comarg;
- WHILE argp
+ while(argp
DO count += split(macro(argp->argval));
argp=argp->argnxt;
OD
for(;;) {
sigchk(); argp=locstak()+BYTESPERWORD;
- WHILE (c = *s++, !any(c,ifsnod.namval) && c)
+ while((c = *s++, !any(c,ifsnod.namval) && c)
DO *argp++ = c OD
if(argp==staktop+BYTESPERWORD
) { if(c
REG STKPTR x;
{
/* try to bring stack back to x */
- WHILE ADR(stakbsy)>ADR(x)
+ while(ADR(stakbsy)>ADR(x)
DO free(stakbsy);
stakbsy = stakbsy->word;
OD
STRING movstr(a,b)
REG STRING a, b;
{
- WHILE *b++ = *a++ DONE
+ while(*b++ = *a++ DONE
return(--b);
}
{
REG CHAR d;
- WHILE d = *s++
+ while(d = *s++
DO if(d==c
) { return(TRUE);
;}
INT cf(s1, s2)
REG STRING s1, s2;
{
- WHILE *s1++ == *s2
+ while(*s1++ == *s2
DO if(*s2++==0
) { return(0);
;}
{
REG STRING s;
- if(s=as ) { WHILE *s++ DONE ;}
+ if(s=as ) { while(*s++ DONE ;}
return(s-as);
}
wdnum=0; wdset=0;
- WHILE (c=nextc(0), space(c)) DONE
+ while((c=nextc(0), space(c)) DONE
if(!eofmeta(c)
) { REP if(c==LITERAL
) { *argp++=(DQUOTE);
- WHILE (c=readc()) && c!=LITERAL
+ while((c=readc()) && c!=LITERAL
DO *argp++=(c|QUOTE); chkpr(c) OD
*argp++=(DQUOTE);
} else { *argp++=(c);
if(!alphanum(c) ) { alpha=0 ;}
if(qotchar(c)
) { d=c;
- WHILE (*argp++=(c=nextc(d))) && c!=d
+ while((*argp++=(c=nextc(d))) && c!=d
DO chkpr(c) OD
;}
;}
) { /* print command if execpr */
if( flags&execpr
) { argn=0; prs(execpmsg);
- WHILE com[argn]!=ENDARGS
+ while(com[argn]!=ENDARGS
DO prs(com[argn++]); blank() OD
newline();
;}
if( (clear=digit(*a1))==0
) { ++com;
;}
- WHILE *++com
+ while(*++com
DO INT i;
if( (i=stoi(*com))>=MAXTRAP || i<MINTRAP
) { failed(*com,badtrap);
if( exitval==0 ) { exitval=N_EXPORT; ;}
if( a1
- ) { WHILE *++com
+ ) { while(*++com
DO attrib(lookup(*com), exitval) OD
} else { namscan(printflg);
;}
case TFORK:
if( execflg && (treeflgs&(FAMP|FPOU))==0
) { parent=0;
- } else { WHILE (parent=fork()) == -1
+ } else { while((parent=fork()) == -1
DO sigchk(); alarm(10); pause() OD
;}
gchain=schain;
;}
loopcnt++;
- WHILE *args!=ENDARGS && execbrk==0
+ while(*args!=ENDARGS && execbrk==0
DO assign(n,*args++);
execute(((FORPTR)t)->fortre,0);
if( execbrk<0 ) { execbrk=0 ;}
INT i=0;
loopcnt++;
- WHILE execbrk==0 && (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 ) { execbrk=0 ;}
OD
{
REG STRING r = mactrim(((SWPTR)t)->swarg);
t=(TREPTR)((SWPTR)t)->swlst;
- WHILE t
+ while(t
DO ARGPTR rex=((REGPTR)t)->regptr;
- WHILE rex
+ while(rex
DO REG STRING s;
if( gmatch(r,s=macro(rex->argval)) || (trim(s), eq(r,s))
) { execute(((REGPTR)t)->regcom,0);