Lines 35-40
Link Here
|
35 |
#include <sys/stat.h> |
35 |
#include <sys/stat.h> |
36 |
#include <sys/types.h> |
36 |
#include <sys/types.h> |
37 |
|
37 |
|
|
|
38 |
#include <assert.h> |
38 |
#include <ctype.h> |
39 |
#include <ctype.h> |
39 |
#include <err.h> |
40 |
#include <err.h> |
40 |
#include <errno.h> |
41 |
#include <errno.h> |
Lines 466-473
Link Here
|
466 |
if ((oflag || color) && m > 0) { |
467 |
if ((oflag || color) && m > 0) { |
467 |
for (i = 0; i < m; i++) { |
468 |
for (i = 0; i < m; i++) { |
468 |
if (!oflag) |
469 |
if (!oflag) |
|
|
470 |
{ |
471 |
assert(a >= 0 && matches[i].rm_so >= 0 && |
472 |
a <= (size_t) matches[i].rm_so); |
473 |
|
469 |
fwrite(line->dat + a, matches[i].rm_so - a, 1, |
474 |
fwrite(line->dat + a, matches[i].rm_so - a, 1, |
470 |
stdout); |
475 |
stdout); |
|
|
476 |
} |
471 |
if (color) |
477 |
if (color) |
472 |
fprintf(stdout, "\33[%sm\33[K", color); |
478 |
fprintf(stdout, "\33[%sm\33[K", color); |
473 |
|
479 |
|