|
|
1.1 ! root 1: /*% cc -c -O % ! 2: */ ! 3: #include "vars.h" ! 4: #define ALWAYS 2 ! 5: #define GBSIZE 256 ! 6: until(nfl, n) ! 7: { ! 8: register c, type; ! 9: char ubuf[GBSIZE]; ! 10: ! 11: c = getchar(); ! 12: type=posn(c, "ft "); ! 13: if(type < 0){ ! 14: if(nfl==0) ! 15: error('x'); ! 16: ungetchar(c); ! 17: } ! 18: getglob(ubuf); ! 19: settruth(FALSE); ! 20: if(nfl && n<=0) ! 21: return; /* do it zero times */ ! 22: do ; while (exglob(ubuf, ubuf) && ! 23: !((nfl && --n==0) || ! 24: (type != ALWAYS && type == truth()))); ! 25: } ! 26: global(k) ! 27: { ! 28: register int *a1; ! 29: char globuf[GBSIZE]; ! 30: struct buffer *startbuf; ! 31: ! 32: if(gflag++) ! 33: error('g'); ! 34: setall(); ! 35: if(nextchar() == '\n') ! 36: error('x'); ! 37: compile(getchar()); ! 38: getglob(globuf); ! 39: for (a1=zero; ++a1<=dol;) { ! 40: *a1 &= ~01; ! 41: if (a1>=addr1 && a1<=addr2 && execute(a1)==k) ! 42: *a1 |= 01; ! 43: } ! 44: startbuf = curbuf; ! 45: for (a1=zero; ++a1<=dol; ) { ! 46: if (*a1 & 01) { ! 47: *a1 &= ~01; ! 48: dot = a1; ! 49: if (!exglob(globuf, "p")) ! 50: break; ! 51: chngbuf(startbuf-buffer); ! 52: a1 = zero; ! 53: } ! 54: } ! 55: chngbuf(startbuf-buffer); ! 56: gflag=FALSE; ! 57: } ! 58: ! 59: globuf(k) ! 60: { ! 61: register struct buffer *bp; ! 62: char globbuf[GBSIZE]; ! 63: ! 64: if (biggflag++) ! 65: error('G'); ! 66: if (nextchar() =='\n') ! 67: error('x'); ! 68: compile(getchar()); ! 69: getglob(globbuf); ! 70: for (bp=buffer; bp < &buffer[NBUFS]; bp++) ! 71: bp->gmark = FALSE; ! 72: ncom('G'); /* mark interesting buffers */ ! 73: for (bp=buffer; bp < &buffer[NBUFS]; bp++) ! 74: if (bp->gmark == k) { ! 75: chngbuf(bp-buffer); ! 76: if (!exglob(globbuf, "f\n")) ! 77: break; ! 78: } ! 79: biggflag = FALSE; ! 80: } ! 81: ! 82: getglob(globuf) ! 83: char globuf[]; ! 84: { ! 85: register char *gp; ! 86: register c; ! 87: int getchar(); ! 88: gp = globuf; ! 89: while ((c = getquote("\n", getchar)) != '\n') { ! 90: if (c==EOF) ! 91: error('x'); ! 92: *gp++ = c & 0177; ! 93: if (gp >= &globuf[GBSIZE-2]) ! 94: error('l'); ! 95: } ! 96: *gp++ = '\n'; ! 97: *gp++ = 0; ! 98: } ! 99: ! 100: exglob(cmd, dflt) ! 101: char *cmd, *dflt; ! 102: { ! 103: register int nesting; ! 104: ! 105: pushinp(GLOB, eqstr(cmd,"\n")? dflt : cmd, FALSE); ! 106: nesting = ++nestlevel; ! 107: commands(); ! 108: if (nesting!=nestlevel) ! 109: return(FALSE); ! 110: nestlevel--; ! 111: return(TRUE); ! 112: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.