Tools: MPW
Advanced Search
Apple Developer Connection
Member Login Log In | Not a Member? Support

MPW Command Reference


CompareFiles

Script

SYNTAX

CompareFiles [-9 | (-12 | -LC) | -13 | (-15 | -Portrait) | -16 | -17 |
(-21 | -TwoPage) | -b w h | -r t,l,b,r] [-compareOpts options]
[-topdown] oldFile newFile

DESCRIPTION

The CompareFiles script compares two versions of a text file and allows you to interactively view and edit any differences. The script uses the Compare tool to identify any differences between the files. If there are differences, CompareFiles displays them in adjacent windows and uses the output of the Compare tool to help locate and explain the differences. CompareFiles saves the states of the file before comparing them and then restores them after comparing them.

A Compare File window appears below the adjacent windows to display messages produced by Compare. These messages indicate the source of each difference, starting with the last. See the description of the Compare tool for more information about these messages.

Note
By default, CompareFiles will tile the windows to fit all available real estate on the main monitor. You can change this behavior by specifiying one of the "monitor size" options listed in the Options section. •

The temporary Compare menu, shown below, appears in the menu bar to help you step through the differences.

This menu contains four items for viewing and editing differences:

Find Next Change

Finds the next difference and highlights it in each window. By default, differences are shown from bottom to top. If the -topdown option is specified, the differences are shown from top to bottom.

Copy Selection » »

Replaces the highlighted text in newFile with that in oldFile.

« « Copy Selection

Replaces the highlighted text in oldFile with that in newFile.

Done

Closes the files (after asking in a dialog box if you want to save changes) and deletes the Compare menu. If you close any of the windows yourself, CompareFiles does not restore them to their previous size and position.


In addition to the menu, the following keys are provided to do the menu operations:

Key Combination

Bottom-up Compare

Top-down Compare

Control+Home

n/a

Restarts the compare from the beginning of the files

Control+UpArrow

Moves to the next mismatch

Restarts the compare from the beginning of the files

Control+DownArrow

Moves to the next mismatch

Moves to the next mismatch

Control+RightArrow

Copy selection from left file to right file

Copy selection from left file to right file

Control+LeftArrow

Copy selection from right file to left file

Copy selection from right file to left file

INPUT

None

OUTPUT

None

STATUS

CompareFiles can return the following status codes:

0

files match

1

syntax error

2

files differ

3

compare cancelled by user

PARAMETERS

oldFile

Specifies an older version of the file.

newFile

Specifies a newer version of the file.

IMPORTANT
You must specify these parameters after any options, as shown in the command syntax. •

OPTIONS

-9

Tiles the open windows to fit a screen size of 512 x 342.

-12 | -LC

Tiles the open windows to fit a screen size of 512 x 384 (12" RGB)

-13

Tiles the open windows to fit a screen size of 640 x 480.

-15 | -Portrait

Tiles the open windows to fit a screen size of 640 x 870 (Apple Macintosh Portrait Display).

-16

Tiles the open windows to fit a screen size of 832 x 624 (16" RGB)

-17

Tiles the open windows to fit a screen size of 1024 x 768.

-21 | -TwoPage

Tiles the open windows to fit a screen size of 1152 x 870 (Apple Two-Page Monochrome Monitor).

-b w h

Tiles the open windows to fit within the area specified by w (width) and h (height).

-compareOpts options

Specifies options to pass along to the Compare tool.

-r t,l,b,r

Tiles the open windows to fit on a rectangle specified by the top, left (t,l) and bottom, right (b,r) corner points.

If you have two or more monitors, the global screen coordinate 0,0 is assigned to the upper-left corner of the monitor that displays the menu bar, the primary monitor.

-topdown

Show differences from top to bottom instead of from bottom to top (the default).

EXAMPLES

The following command line compares the file Sample.c to Sample.c.old. If there are any differences, CompareFiles opens both files side by side on the screen.

CompareFiles Sample.c.old Sample.c

Option -b in the following command line specifies a screen size of 1024 by 1024 pixels. If the file Sample.c and Sample.c.old are different, the command opens the files and tiles them into a 1024 by 1024 square.

CompareFiles -b 1024 1024 Sample.c.old Sample.c

Option -r in the following command line shows how a person with two monitors--a 13-inch monitor on their left, displaying the menu bar, and a two-page monochrome monitor on their right--would tell CompareFiles to display the files on the two-page display.

CompareFiles -r -345,640,460,1789 Sample.c.old Sample.c

LIMITATIONS

Options must appear on the command line before the file names.

SEE ALSO

Compare

Equal

 
 


Last Updated July 2000