/* Pattern word filter for CS 638. Eric Bach 11/30/98 Usage: pattern ABACDE < /usr/dict/words selects all words matching the pattern. Patterns can be any string of letters. This program is case sensitive. If you don't want this, pipe the dictionary through tr "a-z" "A-Z" first. */ #include #define MAXWORD 100 #define NUMCHARS 256 char P[MAXWORD]; /* Pattern */ int Plen; char W[MAXWORD]; /* Current word */ int Wlen; standardize(P, Plen) /* Put P into standard form, e.g. THAT --> ABCA */ char P[]; int Plen; { char S[MAXWORD]; /* pattern in standard form */ char T[NUMCHARS]; /* translation table */ int i; char next; for (i=0;i