www.riscos.com Technical Support:
DDE (Desktop Development Environment)



Diff displays the textual differences between two files on a line-by-line basis. To compare files more usefully various options allow you to display only those differences of specific interest.

The SetUp dialogue box

Clicking Select on the application icon or dragging the name of a file from a directory display to the icon brings up the SetUp dialogue box:


Path1 and Path2 allow you to specify the names of files to be processed (typed in or dragged from a directory display).

SetUp options

Case insensitive instructs Diff to ignore the case of letters; for example, Variable and variable would be considered as identical if this option was chosen.

Expand tabs substitutes tabs by multiples of eight spaces.

Remove spaces removes all spaces before comparing lines. This is useful if you wish to examine two files you have been editing but are not interested in any extra spaces you may have introduced.

Squash spaces replaces all instances of two or more spaces by one space.

Note: If you are using Diff to display the differences between two source files where spaces can be critical, e.g. assembler code, and you want to display lines where spaces have been deleted or added, it is essential to ensure that neither Remove spaces nor Squash spaces have been chosen.

The SetUp menu

Clicking Menu on the SetUp dialogue box displays the menu shown on the left.


Command line enables you to examine or edit the actual command line. For more information on this option see the chapter entitled Command line interface.

Dir. structure displays only the directory structure of the two files. It does not display any differences between the files.

Equate CR/LF instructs Diff to treat the linefeed and carriage return characters as identical. This is especially helpful when analysing files created by different editors where sometimes linefeeds and sometimes carriage returns are used as end of line terminators.

Fast performs a speedy analysis of two files. It reports only whether there are differences between the two files, not what or where the differences are.

Large files is helpful where very large files are being compared. It sometimes happens that two files differ completely over a large section of text because, for instance, you may have edited in several paragraphs or even several pages of text. Ordinarily Diff would not be able to detect this and would report every line from this point forward as different. However, if Large files has been chosen Diff performs a more detailed analysis (thereby taking longer) and can detect this situation. It will then pick up where the two files converge again and display only valid differences from that point onward.

Squidge removes all spaces, except between alphanumerics, where multiple spaces are replaced by one space.

Expand tabs allows you to replace tabs by multiples of any number of spaces you wish.

The Application Menu

Clicking Menu on the Diff application icon gives the following options:


For a description of each option in the application menu see the chapter entitled General features.

Note that Auto Run and Auto Save are not available for this application.

Example output

The output of Diff appears in one of the standard non-interactive tool output windows. For more details of these see the chapter entitled Output.

The following two examples show the use of options within Diff.

Example 1

In this example two text files have been analysed by Diff with no options being set:


Three differences have been found:

  • on line 6 of the first file Doncaster has been spelt with a lowercase d.
  • on line 7 of the first file stopping has been spelt with only one p.
  • on line 9 of the first file there is an extra space before bridge.
Example 2

In the this example the same two files are compared but the Case insensitive and Remove spaces options have been chosen.


The result is that only the different spelling of the word stopping has been displayed.

Command line interface

For normal use you do not need to understand the syntax of the Diff command line, as it is automatically generated for you from the SetUp dialogue box settings. The Command Line syntax for Diff is:

Diff [options] filename1 filename2

-d Show only the directory structure, do not display any differences
-e Equate CR and LF
-f Perform a fast Diff, all options except -d ignored, do not display any differences
-l Handle large files more effectively (but more slowly)
-n Ignore case sensitivity when comparing letters
-r Remove all spaces before comparing lines
-s Squash sequences of spaces to one space
-t As for -r, but -s when between two alphanumeric characters
-x Expand tabs to spaces (tab stops at multiples of 8)
-Xn Expand tabs to spaces (tab stops at multiples of n)
valid pathnames specifying objects to be 'diffed'

This edition Copyright © 3QD Developments Ltd 2015
Last Edit: Tue,03 Nov 2015