"\t-q\tbe quiet. Returns 0 if result was found, 1 otherwise\n"
"\t-v\tselect non-matching lines\n\n"
#if defined BB_REGEXP
- "This version of grep matches full regular expresions.\n";
+ "This version of grep matches full regular expressions.\n";
#else
- "This version of grep matches strings (not regular expresions).\n"
+ "This version of grep matches strings (not regular expressions).\n"
#endif
#endif
;
static void do_grep(FILE * fp, char *needle, char *fileName, int tellName,
int ignoreCase, int tellLine, int invertSearch)
{
- char *cp;
long line = 0;
char *haystack;
int truth = !invertSearch;
while ((haystack = cstring_lineFromFile(fp))) {
line++;
- cp = &haystack[strlen(haystack) - 1];
-
if (find_match(haystack, needle, ignoreCase) == truth) {
if (tellName == TRUE)
printf("%s:", fileName);
fclose(fp);
}
}
- exit(match);
+ return(match);
}