diff options
Diffstat (limited to 'usr.bin/diff/diffreg_new.c')
-rw-r--r-- | usr.bin/diff/diffreg_new.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/usr.bin/diff/diffreg_new.c b/usr.bin/diff/diffreg_new.c index 3b50dfd5940b..f54cd554ccad 100644 --- a/usr.bin/diff/diffreg_new.c +++ b/usr.bin/diff/diffreg_new.c @@ -218,10 +218,14 @@ diffreg_new(char *file1, char *file2, int flags, int capsicum) rc = D_ERROR; goto done; } + if (left.atomizer_flags & DIFF_ATOMIZER_FILE_TRUNCATED) + warnx("%s truncated", file1); if (diff_atomize_file(&right, cfg, f2, (uint8_t *)str2, st2.st_size, diff_flags)) { rc = D_ERROR; goto done; } + if (right.atomizer_flags & DIFF_ATOMIZER_FILE_TRUNCATED) + warnx("%s truncated", file2); result = diff_main(cfg, &left, &right); if (result->rc != DIFF_RC_OK) { @@ -249,6 +253,8 @@ diffreg_new(char *file1, char *file2, int flags, int capsicum) goto done; } + if (color) + diff_output_set_colors(color, del_code, add_code); if (diff_format == D_NORMAL) { rc = diff_output_plain(NULL, stdout, &info, result, false); } else if (diff_format == D_EDIT) { @@ -308,8 +314,8 @@ openfile(const char *path, char **p, struct stat *st) bool can_libdiff(int flags) { - /* We can't use fifos with libdiff yet */ - if (S_ISFIFO(stb1.st_mode) || S_ISFIFO(stb2.st_mode)) + /* libdiff's atomizer can only deal with files */ + if (!S_ISREG(stb1.st_mode) || !S_ISREG(stb2.st_mode)) return false; /* Is this one of the supported input/output modes for diffreg_new? */ |