diff --git a/src/task_ag.c b/src/task_ag.c index 3ecc6431c2c5f166b0ad92402783695cf63050f0..9b0645d49dd51541155b0ed92c337eee0bed20e8 100644 --- a/src/task_ag.c +++ b/src/task_ag.c @@ -130,8 +130,13 @@ static void plog(const unsigned int level, const char *fmt, ...) { va_end(args); } -static int search_buf(buf, f_len, file_full_path, literal) { - fprintf(stderr, "%d: %s", f_len, buf); +static int search_buf(const char *buf, size_t f_len, const char *file_full_path, + const char *literal) { + size_t literal_len = strlen(literal); + for (int i = 0; i < f_len - literal_len + 1; i++) { + if (!memcmp(buf + i, literal, literal_len)) + printf("%d\n", i); + } return EXIT_SUCCESS; }