The diff utility shall conform to the Base Definitions volume of
POSIX.1‐2017, Section 12.2, Utility Syntax Guidelines.
The following options shall be supported:
-b
Cause any amount of white space at the end of a line to
be treated as a single <newline> (that is, the white-
space characters preceding the <newline> are ignored)
and other strings of white-space characters, not
including <newline> characters, to compare equal.
-c
Produce output in a form that provides three lines of
copied context.
-C
n Produce output in a form that provides n lines of
copied context (where n shall be interpreted as a
positive decimal integer).
-e
Produce output in a form suitable as input for the ed
utility, which can then be used to convert file1 into
file2.
-f
Produce output in an alternative form, similar in
format to -e
, but not intended to be suitable as input
for the ed utility, and in the opposite order.
-r
Apply diff recursively to files and directories of the
same name when file1 and file2 are both directories.
The diff utility shall detect infinite loops; that is,
entering a previously visited directory that is an
ancestor of the last file encountered. When it detects
an infinite loop, diff shall write a diagnostic message
to standard error and shall either recover its position
in the hierarchy or terminate.
-u
Produce output in a form that provides three lines of
unified context.
-U
n Produce output in a form that provides n lines of
unified context (where n shall be interpreted as a non-
negative decimal integer).