/* main.c - main program for match */ #include #include "own.h" static char string[STRINGSIZE]; /* our search string */ int ignore_case; /* don't care about letter cases (up/low) */ int line_beginning; /* must match to the beginning of a line */ int line_end; /* must match to the end of a line */ /**/ static int count_lines; /* only count lines that match the string */ /* get next line from input (K&R pp 29) */ static int getline(char s[], int lim) { int c,i; for (i=0;i 0) { if (buffer[len-1] == '\n') buffer[--len] = '\0'; if (match(buffer,string)) { if (count_lines) count++; else printf("%s\n",buffer); } } if (count_lines) printf("%s was found from %d line(s)\n",string,count); return 0; }