5.1 Differences with diff
GNU diff is a program which matured for a long while, and for which
algorithms are based on computer science literature. It is a fast program.
By comparison, mdiff is not more than a program kludged up rapidly
to satisfy a few precise needs. It only tries not being inordinately slow.
Most diff options are accepted by mdiff under the same
short and long option names, and is able to produce resembling output,
for making mdiff easier to learn and less surprising to users.
Yet, some differences exist in option decoding and output format. Since
diff and mdiff use different matching algorithms, it is
very likely that the differences will not be exactly analyzed identically.
- A few diff options, which either accept no argument or require
a mandatory one, are implemented in mdiff as options accepting
an optional argument. This may yield some surprises, for example,
-c4bir would be accepted by diff and rejected by
mdiff, yet it may rewritten -birc4 for both. See below.
- Options -c and -u in diff ask for regular context
and unified context output, respectively, without specifying the number
of lines in the context. diff has ‘-C number’ and
‘-U number’ options for asking for regular or unified context
diffs with number context lines. If -c4 asks for four lines
of context, the ‘4’ is not really an argument of -c, and this
is really interpreted as ‘-c -4’, where -number is
meant to be a deprecated option for choosing the number of context lines,
option which mdiff does not implement. In mdiff, -c
and -u are really two options which are allowed to receive an
optional argument, so the number of lines may, or may not be given, at
the choice of the user. In mdiff, options -C and -U
are completely equivalent to -c and -u, and are provided
only for the sake of compatibility.
- Option -v in diff means --version, while it
means --verbose in mdiff. There is no short form for
--version in mdiff.