Date: Sat, 14 Nov 2020 00:59:55 +0000 (UTC) From: Kyle Evans <kevans@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367656 - stable/12/usr.bin/diff Message-ID: <202011140059.0AE0xtT1058008@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kevans Date: Sat Nov 14 00:59:55 2020 New Revision: 367656 URL: https://svnweb.freebsd.org/changeset/base/367656 Log: MFC r367076: diff: don't force the format to 'context' with -p immediately Instead, leave the fomat as unspecified (if it hasn't been) and use the -p flag as a hint to 'context' if no other formatting option is specified. This fixes `diff -purw`, used frequently by emaste, and matches the behavior of its GNU counterpart. PR: 250015 Modified: stable/12/usr.bin/diff/diff.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/diff/diff.c ============================================================================== --- stable/12/usr.bin/diff/diff.c Fri Nov 13 23:18:04 2020 (r367655) +++ stable/12/usr.bin/diff/diff.c Sat Nov 14 00:59:55 2020 (r367656) @@ -210,17 +210,6 @@ main(int argc, char **argv) diff_format = D_NREVERSE; break; case 'p': - /* - * If it's not unset and it's not set to context or - * unified, we'll error out here as a conflicting - * format. If it's unset, we'll go ahead and set it to - * context. - */ - if (FORMAT_MISMATCHED(D_CONTEXT) && - FORMAT_MISMATCHED(D_UNIFIED)) - conflicting_format(); - if (diff_format == D_UNSET) - diff_format = D_CONTEXT; dflags |= D_PROTOTYPE; break; case 'P': @@ -320,6 +309,8 @@ main(int argc, char **argv) newarg = optind != prevoptind; prevoptind = optind; } + if (diff_format == D_UNSET && (dflags & D_PROTOTYPE) != 0) + diff_format = D_CONTEXT; if (diff_format == D_UNSET) diff_format = D_NORMAL; argc -= optind;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202011140059.0AE0xtT1058008>