diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2021-05-20 13:05:15 -0700 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2021-05-20 13:05:15 -0700 |
| commit | 8fcf6261bdb4bee39ce5d197340113ca72967774 (patch) | |
| tree | e0cb3c3b76e23835911be5330988348dfbcb424c | |
| parent | 13e1b20f436927e1550a02e7a90653352f70378a (diff) | |
Print errors to stderr instead of stdout
| -rw-r--r-- | print.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -408,17 +408,18 @@ void print_match(FILE *out, printer_t *pr, match_t *m) } // -// Print any errors that are present in the given match object. +// Print any errors that are present in the given match object to stderr and +// return the number of errors found. // int print_errors(printer_t *pr, match_t *m) { int ret = 0; if (m->pat->type == BP_ERROR) { - printf("\033[31;1m"); + fprintf(stderr, "\033[31;1m"); printer_t tmp = {.file = pr->file}; // No bells and whistles - print_match(stdout, &tmp, m); // Error message - printf("\033[0m\n"); - fprint_line(stdout, pr->file, m->start, m->end, " "); + print_match(stderr, &tmp, m); // Error message + fprintf(stderr, "\033[0m\n"); + fprint_line(stderr, pr->file, m->start, m->end, " "); return 1; } if (m->child) ret += print_errors(pr, m->child); |
