From db9cccfbb1a724acf65756da9439009da433b810 Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Mon, 20 Apr 2020 16:14:44 +0000 Subject: diff(1): reject conflicting formatting options This matches GNU diff(1) behavior and, more importantly, eliminates any source of confusion if multiple formatting options are specified. Note that the committed diff differs slightly from the submitted: I've modified it so that we initialize diff_format to something that isn't an accepted format option so that we can also reject --normal -c and -c --normal, which would've otherwise been accepted because the default was --normal. After option parsing we default it to D_NORMAL if it's still unset. PR: 243975 Submitted by: fehmi noyan isi MFC after: 1 week --- usr.bin/diff/diff.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'usr.bin/diff/diff.h') diff --git a/usr.bin/diff/diff.h b/usr.bin/diff/diff.h index 6a2c4cbea721..30387610fc19 100644 --- a/usr.bin/diff/diff.h +++ b/usr.bin/diff/diff.h @@ -50,6 +50,9 @@ #define D_GFORMAT 7 /* Diff with defined changed group format */ #define D_SIDEBYSIDE 8 /* Side by side */ +#define D_UNSET -2 + + /* * Output flags */ -- cgit v1.2.3