Lines Matching +defs:match +defs:line
76 static void printline_metadata(struct str *line, int sep);
180 * symlinks on the command line are followed
215 /* Print the matching line, but only if not quiet/binary */
246 * line being rotated out, then go ahead and increment
247 * last_outed to signify a gap between context/match.
263 * We already hit our match count, but we need to keep dumping
273 * line-by-line basis, setting up a `struct str` as needed.
279 /* Count the matches if we have a match limit */
293 * Opens a file and processes it. Each file is processed line-by-line
350 * not going to be doing per-line statistics because of the
353 /* Reset per-line statistics */
378 * Short-circuit, already hit match count and now we're
389 /* Halt processing if we hit our match limit */
464 /* We only needed to know if we match or not */
479 * Processes a line comparing it with the specified patterns. Each pattern
481 * match, which is necessary to colorize the output and to count the
505 /* Matches every line (no -w or -x). */
510 * If we only have the NULL pattern, whether we match or not
529 /* Loop to process the whole line */
549 /* Check for full match */
553 /* Check for whole word match */
572 * the earliest match. This allows the pattern
573 * to match later on in the line and possibly
574 * still match a whole word.
590 * Replace previous match if the new one is earlier
619 * Advance to just past the start of the earliest match, try
620 * again just in case we still have a chance to match later in
641 /* Zero-length match -- advance one more so we don't get stuck */
710 * Print an entire line as-is, there are no inline matches to consider. This is
713 void grep_printline(struct str *line, int sep) {
714 printline_metadata(line, sep);
715 fwrite(line->dat, line->len, 1, stdout);
720 printline_metadata(struct str *line, int sep)
727 fputs(line->file, stdout);
730 printf("%s", line->file);
737 printf("%d", line->line_no);
743 printf("%lld", (long long)(line->off + line->boff));
751 * Prints a matching line according to the command line options.
758 regmatch_t match;
768 /* Only print metadata once per line if --color */
772 match = pc->matches[i];
774 if (match.rm_so == match.rm_eo)
777 * Metadata is printed on a per-line basis, so every
778 * match gets file metadata with the -o flag.
781 pc->ln.boff = match.rm_so;
784 fwrite(pc->ln.dat + a, match.rm_so - a, 1,
788 fwrite(pc->ln.dat + match.rm_so,
789 match.rm_eo - match.rm_so, 1, stdout);
792 a = match.rm_eo;