+ removed some cruft left over from when lines could be too long.
This commit is contained in:
parent
854e11581f
commit
d84990eb1f
@ -66,15 +66,12 @@ static int match = FALSE, beQuiet = FALSE;
|
|||||||
static void do_grep(FILE * fp, char *needle, char *fileName, int tellName,
|
static void do_grep(FILE * fp, char *needle, char *fileName, int tellName,
|
||||||
int ignoreCase, int tellLine, int invertSearch)
|
int ignoreCase, int tellLine, int invertSearch)
|
||||||
{
|
{
|
||||||
char *cp;
|
|
||||||
long line = 0;
|
long line = 0;
|
||||||
char *haystack;
|
char *haystack;
|
||||||
int truth = !invertSearch;
|
int truth = !invertSearch;
|
||||||
|
|
||||||
while ((haystack = cstring_lineFromFile(fp))) {
|
while ((haystack = cstring_lineFromFile(fp))) {
|
||||||
line++;
|
line++;
|
||||||
cp = &haystack[strlen(haystack) - 1];
|
|
||||||
|
|
||||||
if (find_match(haystack, needle, ignoreCase) == truth) {
|
if (find_match(haystack, needle, ignoreCase) == truth) {
|
||||||
if (tellName == TRUE)
|
if (tellName == TRUE)
|
||||||
printf("%s:", fileName);
|
printf("%s:", fileName);
|
||||||
|
3
grep.c
3
grep.c
@ -66,15 +66,12 @@ static int match = FALSE, beQuiet = FALSE;
|
|||||||
static void do_grep(FILE * fp, char *needle, char *fileName, int tellName,
|
static void do_grep(FILE * fp, char *needle, char *fileName, int tellName,
|
||||||
int ignoreCase, int tellLine, int invertSearch)
|
int ignoreCase, int tellLine, int invertSearch)
|
||||||
{
|
{
|
||||||
char *cp;
|
|
||||||
long line = 0;
|
long line = 0;
|
||||||
char *haystack;
|
char *haystack;
|
||||||
int truth = !invertSearch;
|
int truth = !invertSearch;
|
||||||
|
|
||||||
while ((haystack = cstring_lineFromFile(fp))) {
|
while ((haystack = cstring_lineFromFile(fp))) {
|
||||||
line++;
|
line++;
|
||||||
cp = &haystack[strlen(haystack) - 1];
|
|
||||||
|
|
||||||
if (find_match(haystack, needle, ignoreCase) == truth) {
|
if (find_match(haystack, needle, ignoreCase) == truth) {
|
||||||
if (tellName == TRUE)
|
if (tellName == TRUE)
|
||||||
printf("%s:", fileName);
|
printf("%s:", fileName);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user