ucbdiff(1) ucbdiff(1)NAME ucbdiff - reports differences between two files or directories SYNOPSIS ucbdiff [-b] [-c] [-e] [-f] [-h] [-i] [-l] [-n] [-r] [-s] [-S file] [-t] [-w] dir1 dir2 ucbdiff [-b] [-c] [-e] [-f] [-h] [-i] [-n] [-t] [-w] file1 file2 ucbdiff [-b] [-Dstring] [-i] [-w] file1 file2 ARGUMENTS -b Ignores trailing blanks (spaces and tabs) and other strings of blanks to compare equal. -c Produces a ucbdiff with lines of context. The default is to present 3 lines of context; this may be changed, for example to 10, by -c10. With -c, the output format is modified slightly. The output begins with an identification of the files involved and their creation dates; then each change is separated by a line with a dozen *'s. The lines removed from file1 are marked with a -; those added to file2 are marked +. Lines which are changed from one file to the other are marked in both files with a !. Changes that are separated by fewer than the number of lines in the current context are grouped together on output. (This is a change from the previous ucbdiff -c but the resulting output is usually much easier to interpret.) -e Produces a script of a, c, and d commands for the ed, editor which will recreate file2 from file1. In connection with -e, the following shell program may help maintain multiple versions of a file. Only an ancestral file ($1) and a chain of version-to-version ed scripts ($2, $3,...) made by ucbdiff need be on hand. A ``latest version'' appears on the standard output. (shift;cat $*;echo '1,$p')|ed - $1 Extra commands are added to the output when comparing directories with -e, so that the result is a sh script for converting text files common to the two directories from their state in dir1 to their state in dir2. -f Produces a script similar to that of -e, but in the opposite order and not useful with ed. January 1992 1
ucbdiff(1) ucbdiff(1)-h Does a fast, half-hearted job. It works only when changed stretches are short and well separated, but will work on files of unlimited length. -i Ignores the case of letters. For example, A will compare equal to a. -n Produces a script similar to that of -e, but in the opposite order and with a count of changed lines on each insert or delete command. This is the form used by rcsdiff. -t Expands tabs in output lines. Normal or -c output adds character(s) to the front of each line, which may alter the indentation of the original source lines and make the output listing difficult to interpret. This option will preserve the original source's indentation. -w Totally ignores whitespace (blanks and tabs). This option is similar to -b. For example, the following two lines will compare equal. if ( a == b ) if(a==b) dir1 dir2 Specifies the two directories to be compared. -Dstring Creates a merged version of file1 and file2 on the standard output with C preprocessor controls included, so that a compilation of the result without defining string is equivalent to compiling file1, while defining string will yield file2. file1 file2 Specifies the two files to be compared. -l Displays long output format. Each set of text file differences is piped through pr to paginate the output; other differences are remembered and summarized after all text file differences are reported. -r Causes application of ucbdiff recursively to common subdirectories encountered. -s Reports files which are the same and are otherwise not mentioned. -Sfile Starts a directory ucbdiff in the middle, beginning with specified file. 2 January 1992
ucbdiff(1) ucbdiff(1)DESCRIPTION ucbdiff is used by the rcs(1) Revision Control System. If both arguments are directories, ucbdiff sorts the contents of the directories by name and then runs the regular file diff algorithm (described later in this section) on text files which are different. Binary files which differ, common subdirectories, and files which appear in only one directory are listed. When ucbdiff is run on regular files and when comparing text files which differ during directory comparison, ucbdiff tells what lines must be changed in the files to bring them into agreement. Except in rare circumstances, ucbdiff finds the smallest sufficient set of file differences. If neither file1 nor file2 is a directory, then either may be given as -, in which case the standard input is used. If file1 is a directory, then a file in that directory whose filename is the same as the filename of file2 is used (and vice versa). There are several options for output format; the default output format contains lines of these forms: n1 a n3,n4 n1,n2 d n3 n1,n2 c n3,n4 These lines resemble ed commands to convert file1 into file2. The numbers after the letters pertain to file2. In fact, by exchanging a for d and reading backward, one may ascertain how to equally convert file2 into file1. As in ed, identical pairs (where n1=n2 or n3=n4) are abbreviated as a single number. Following each of these lines are all the lines affected in the first file flagged by <, then all the lines that are affected in the second file flagged by >. STATUS MESSAGES AND VALUES Exit status is 0 for no differences, 1 for some, 2 for trouble. LIMITATIONS Editing scripts produced under the -e or -f option are naive about creating lines consisting of a single period (.). When comparing directories with the -b, -w, or -i options specified, ucbdiff first compares the files like cmp and then decides to run the ucbdiff algorithm if they are not equal. This may cause a small amount of spurious output if the files then turn out to be identical because the only differences are insignificant blank string or case differences. January 1992 3
ucbdiff(1) ucbdiff(1)FILES /usr/ucb/ucbdiff Executable file /tmp/d????? Temporary file /usr/lib/ucbdiffh File used with the -h option /bin/diff Executable file used for directory comparisons /bin/pr Executable file SEE ALSO cc(1), cmp(1), comm(1), diff(1), ed(1), rcs(1), ucbdiff3(1) 4 January 1992