aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/diff/diffreg.c
diff options
context:
space:
mode:
authorKyle Evans <kevans@FreeBSD.org>2018-08-19 03:57:20 +0000
committerKyle Evans <kevans@FreeBSD.org>2018-08-19 03:57:20 +0000
commite68edb8cf06a796453378b98d963692c838c400f (patch)
tree477137d7ee0c4b2dd86e3dc4e9815300643d8753 /usr.bin/diff/diffreg.c
parentd17f8070a1341a2f35a1f25d85dbe98abddf2033 (diff)
Notes
Diffstat (limited to 'usr.bin/diff/diffreg.c')
-rw-r--r--usr.bin/diff/diffreg.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c
index 47825e1daf46..b872badbc599 100644
--- a/usr.bin/diff/diffreg.c
+++ b/usr.bin/diff/diffreg.c
@@ -79,6 +79,7 @@ __FBSDID("$FreeBSD$");
#include <fcntl.h>
#include <paths.h>
#include <regex.h>
+#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
@@ -1000,6 +1001,31 @@ restart:
}
return;
}
+ if (*pflags & D_SKIPBLANKLINES) {
+ char *line;
+ /*
+ * All lines in the change, insert, or delete must not be
+ * empty for the change to be ignored.
+ */
+ if (a <= b) { /* Changes and deletes. */
+ for (i = a; i <= b; i++) {
+ line = preadline(fileno(f1),
+ ixold[i] - ixold[i - 1], ixold[i - 1]);
+ if (*line != '\0')
+ goto proceed;
+ }
+ }
+ if (a > b || c <= d) { /* Changes and inserts. */
+ for (i = c; i <= d; i++) {
+ line = preadline(fileno(f2),
+ ixnew[i] - ixnew[i - 1], ixnew[i - 1]);
+ if (*line != '\0')
+ goto proceed;
+ }
+ }
+ return;
+
+ }
proceed:
if (*pflags & D_HEADER && diff_format != D_BRIEF) {
diff_output("%s %s %s\n", diffargs, file1, file2);