diff --git a/usr.bin/diff/diff.h b/usr.bin/diff/diff.h --- a/usr.bin/diff/diff.h +++ b/usr.bin/diff/diff.h @@ -80,6 +80,7 @@ #define D_STRIPCR 0x400 /* Strip trailing cr */ #define D_SKIPBLANKLINES 0x800 /* Skip blank lines */ #define D_MATCHLAST 0x1000 /* Display last line matching provided regex */ +#define D_PAGINATION 0x2000 /* Paginate via pr(1) */ /* Features supported by new algorithms */ #define D_NEWALGO_FLAGS (D_FORCEASCII | D_PROTOTYPE | D_IGNOREBLANKS) diff --git a/usr.bin/diff/diff.c b/usr.bin/diff/diff.c --- a/usr.bin/diff/diff.c +++ b/usr.bin/diff/diff.c @@ -249,6 +249,7 @@ usage(); break; case 'l': + dflags |= D_PAGINATION; lflag = true; break; case 'N': diff --git a/usr.bin/diff/diffreg_new.c b/usr.bin/diff/diffreg_new.c --- a/usr.bin/diff/diffreg_new.c +++ b/usr.bin/diff/diffreg_new.c @@ -33,6 +33,7 @@ #include #include +#include "pr.h" #include "diff.h" #include #include @@ -146,6 +147,7 @@ { char *str1, *str2; FILE *f1, *f2; + struct pr *pr = NULL; struct stat st1, st2; struct diff_input_info info; struct diff_data left = {}, right = {}; @@ -178,6 +180,9 @@ f1 = openfile(file1, &str1, &st1); f2 = openfile(file2, &str2, &st2); + if (flags & D_PAGINATION) + pr = start_pr(file1, file2); + if (capsicum) { cap_rights_init(&rights_ro, CAP_READ, CAP_FSTAT, CAP_SEEK); if (caph_rights_limit(fileno(f1), &rights_ro) < 0) @@ -271,6 +276,8 @@ status |= 1; } done: + if (pr != NULL) + stop_pr(pr); diff_result_free(result); diff_data_free(&left); diff_data_free(&right);