/* Program: WPFILT.C Author : Kim Moser Date : 29 December, 1990 System : IBM PC / Borland Turbo C 2.0 Descrip: Filters print-screen dumps from WP's SPELL.EXE program and dumps raw words to stdout. Usage : WPFILT #include #include #include static char tmp[512], prev[sizeof(tmp)]; static void process(char *s); static void process(char *s) { int i; for (i=0; !isalpha(*s); s++); while (isalpha(*s)) { tmp[i++] = *(s++); } tmp[i] = '\0'; /* Print word only if we didn't stop at punctuation: */ if (*s == ' ' && (strlen(tmp) > 1)) { if (strcmp(prev, strupr(tmp)) >= 0) { fprintf(stderr, "process(): word (%s) < prev (%s).\n", tmp, prev); exit(-1); } printf("%s\n", tmp); strcpy(prev, tmp); } } void main(void) { char str[512]; char *s; int done = 0; int i; prev[0] = '\0'; while (!done) { while (((s=gets(str)) != NULL) && (s[0] != '=')); if (s == NULL) break; if ((s=gets(str)) == NULL) break; for (i=0; i<17; i++) { if ((s=gets(str)) == NULL) { done = 1; break; } if (isdigit(s[2]) && (s[3] == '.')) { process(s+4); } if (isdigit(s[28]) && (s[29] == '.')) { process(s+30); } if (isdigit(s[54]) && (s[55] == '.')) { process(s+56); } } if (done) { if ((s=gets(str)) == NULL) { break; } else { fprintf(stderr, "loop was done, but gets() returned string.\n"); exit(-1); } } } }