|
|
1.1 ! root 1: #include "hdr.h" ! 2: ! 3: State states[NSTATES]; ! 4: State *nxtst(); ! 5: int state[NSTATES]; ! 6: int line = 1; ! 7: int name[MAXLIN]; ! 8: int left[MAXLIN]; ! 9: int right[MAXLIN]; ! 10: int parent[MAXLIN]; ! 11: int foll[MAXLIN]; ! 12: int positions[MAXPOS]; ! 13: char chars[MAXLIN]; ! 14: int nxtpos = 0; ! 15: int inxtpos; ! 16: int nxtchar = 0; ! 17: int tmpstat[MAXLIN]; ! 18: int begstat[MAXLIN]; ! 19: int colpos[MAXLIN]; ! 20: State *istat; ! 21: int nstate = 1; ! 22: int xstate; ! 23: int count; ! 24: int icount; ! 25: char *input; ! 26: ! 27: char reinit = 0; ! 28: ! 29: long lnum; ! 30: int bflag; ! 31: int cflag; ! 32: int fflag; ! 33: int hflag = 1; ! 34: int iflag; ! 35: int lflag; ! 36: int nflag; ! 37: int sflag; ! 38: int vflag; ! 39: int nfile; ! 40: long tln; ! 41: int nsucc; ! 42: int badbotch; ! 43: ! 44: int expfile; ! 45: int bmegrep = 0; ! 46: ! 47: main(argc, argv) ! 48: char **argv; ! 49: { ! 50: int (*fn)(), execute(), bmexecute(); ! 51: int etext(); ! 52: char buf[2048]; ! 53: ! 54: ! 55: while (--argc > 0 && (++argv)[0][0]=='-') ! 56: switch (argv[0][1]) { ! 57: ! 58: case 'b': ! 59: bflag++; ! 60: continue; ! 61: ! 62: case 'c': ! 63: cflag++; ! 64: continue; ! 65: ! 66: case 'e': ! 67: argc--; ! 68: argv++; ! 69: goto cut; ! 70: ! 71: case 'f': ! 72: fflag++; ! 73: continue; ! 74: ! 75: case 'h': ! 76: hflag = 0; ! 77: continue; ! 78: ! 79: case 'i': ! 80: iflag++; ! 81: continue; ! 82: ! 83: case 'l': ! 84: lflag++; ! 85: continue; ! 86: ! 87: case 'n': ! 88: nflag++; ! 89: continue; ! 90: ! 91: case 's': ! 92: sflag++; ! 93: continue; ! 94: ! 95: case 'v': ! 96: vflag++; ! 97: continue; ! 98: ! 99: default: ! 100: fprint(2, "egrep: unknown flag\n"); ! 101: continue; ! 102: } ! 103: cut: ! 104: if (argc<=0) ! 105: exit(2); ! 106: if (fflag) { ! 107: if ((expfile = open(*argv, 0)) < 0) { ! 108: fprint(2, "egrep: can't open %s\n", *argv); ! 109: exit(2); ! 110: } ! 111: } ! 112: else input = *argv; ! 113: Finit(1, (char *)0); ! 114: argc--; ! 115: argv++; ! 116: ! 117: /*mailprep();/**/ ! 118: yyparse(); ! 119: maildone(); ! 120: if(!vflag && islit(buf)){ ! 121: bmprep(buf); ! 122: fn = bmexecute; ! 123: } else ! 124: fn = execute; ! 125: ! 126: cgotofn(); ! 127: nfile = argc; ! 128: if (argc<=0) { ! 129: if (lflag) exit(1); ! 130: (*fn)((char *)0); ! 131: } ! 132: else while (--argc >= 0) { ! 133: if (reinit == 1) clearg(); ! 134: (*fn)(*argv++); ! 135: } ! 136: exit(badbotch ? 2 : nsucc==0); ! 137: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.