-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathdiff.cat1
More file actions
224 lines (173 loc) · 11.9 KB
/
Copy pathdiff.cat1
File metadata and controls
224 lines (173 loc) · 11.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
DIFF(1) BSD General Commands Manual DIFF(1)
NNAAMMEE
ddiiffff — differential file and directory comparator
SSYYNNOOPPSSIISS
ddiiffff [--aabbddiillppTTttww] [--cc | --ee | --ff | --nn | --qq | --uu] [--II _p_a_t_t_e_r_n] [--LL _l_a_b_e_l]
_f_i_l_e_1 _f_i_l_e_2
ddiiffff [--aabbddiillppTTttww] [--II _p_a_t_t_e_r_n] [--LL _l_a_b_e_l] --CC _n_u_m_b_e_r _f_i_l_e_1 _f_i_l_e_2
ddiiffff [--aabbddiillttww] [--II _p_a_t_t_e_r_n] --DD _s_t_r_i_n_g _f_i_l_e_1 _f_i_l_e_2
ddiiffff [--aabbddiillppTTttww] [--II _p_a_t_t_e_r_n] [--LL _l_a_b_e_l] --UU _n_u_m_b_e_r _f_i_l_e_1 _f_i_l_e_2
ddiiffff [--aabbddiillNNPPpprrssTTttww] [--cc | --ee | --ff | --nn | --qq | --uu] [--II _p_a_t_t_e_r_n]
[--LL _l_a_b_e_l] [--SS _n_a_m_e] [--XX _f_i_l_e] [--xx _p_a_t_t_e_r_n] _d_i_r_1 _d_i_r_2
DDEESSCCRRIIPPTTIIOONN
The ddiiffff utility compares the contents of _f_i_l_e_1 and _f_i_l_e_2 and writes to
the standard output the list of changes necessary to convert one file
into the other. No output is produced if the files are identical.
Output options (mutually exclusive):
--CC _n_u_m_b_e_r
Like --cc but produces a diff with _n_u_m_b_e_r lines of context.
--cc Produces a diff with 3 lines of context. With --cc the output for‐
mat is modified slightly: the output begins with identification
of the files involved and their creation dates and then each
change is separated by a line with fifteen *'s. The lines
removed from _f_i_l_e_1 are marked with ‘- ’; those added to _f_i_l_e_2 are
marked ‘+ ’. Lines which are changed from one file to the other
are marked in both files with ‘! ’. Changes which lie within 3
lines of each other are grouped together on output.
--DD _s_t_r_i_n_g
Creates a merged version of _f_i_l_e_1 and _f_i_l_e_2 on the standard out‐
put, with C preprocessor controls included so that a compilation
of the result without defining _s_t_r_i_n_g is equivalent to compiling
_f_i_l_e_1, while defining _s_t_r_i_n_g will yield _f_i_l_e_2.
--ee Produces output in a form suitable as input for the editor util‐
ity, ed(1), which can then be used to convert file1 into file2.
Extra commands are added to the output when comparing directories
with --ee, so that the result is a sh(1) script for converting text
files which are common to the two directories from their state in
_d_i_r_1 to their state in _d_i_r_2.
--ff Identical output to that of the --ee flag, but in reverse order.
It cannot be digested by ed(1).
--nn Produces a script similar to that of --ee, 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(1).
--qq Just print a line when the files differ. Does not output a list
of changes.
--UU _n_u_m_b_e_r
Like --uu but produces a diff with _n_u_m_b_e_r lines of context.
--uu Produces a _u_n_i_f_i_e_d diff with 3 lines of context. A unified diff
is similar to the context diff produced by the --cc option. How‐
ever, unlike with --cc, all lines to be changed (added and/or
removed) are present in a single section.
Comparison options:
--aa Treat all files as ASCII text. Normally ddiiffff will simply print
“Binary files ... differ” if files contain binary characters.
Use of this option forces ddiiffff to produce a diff.
--bb Causes trailing blanks (spaces and tabs) to be ignored, and other
strings of blanks to compare equal.
--dd Try very hard to produce a diff as small as possible. This may
consume a lot of processing power and memory when processing
large files with many changes.
--II _p_a_t_t_e_r_n
Ignores changes, insertions, and deletions whose lines match the
extended regular expression _p_a_t_t_e_r_n. Multiple --II patterns may be
specified. All lines in the change must match some pattern for
the change to be ignored. See re_format(7) for more information
on regular expression patterns.
--ii Ignores the case of letters. E.g., “A” will compare equal to
“a”.
--LL _l_a_b_e_l
Print _l_a_b_e_l instead of the first (and second, if this option is
specified twice) file name and time in the context or unified
diff header.
--ll Long output format; each text file ddiiffff'd is piped through pr(1)
to paginate it; other differences are remembered and summarized
after all text file differences are reported.
--pp With unified and context diffs, show with each change the first
40 characters of the last line before the context beginning with
a letter, an underscore or a dollar sign. For C source code fol‐
lowing standard layout conventions, this will show the prototype
of the function the change applies to.
--TT Print a tab rather than a space before the rest of the line for
the normal, context or unified output formats. This makes the
alignment of tabs in the line consistent.
--tt Will expand tabs in output lines. Normal or --cc output adds char‐
acter(s) to the front of each line which may screw up the inden‐
tation of the original source lines and make the output listing
difficult to interpret. This option will preserve the original
source's indentation.
--ww Is similar to --bb but causes whitespace (blanks and tabs) to be
totally ignored. E.g., “if ( a == b )” will compare equal to
“if(a==b)”.
Directory comparison options:
--NN If a file is found in only one directory, act as if it was found
in the other directory too but was of zero size.
--PP If a file is found only in _d_i_r_2, act as if it was found in _d_i_r_1
too but was of zero size.
--rr Causes application of ddiiffff recursively to common subdirectories
encountered.
--SS _n_a_m_e
Re-starts a directory ddiiffff in the middle, beginning with file
_n_a_m_e.
--ss Causes ddiiffff to report files which are the same, which are other‐
wise not mentioned.
--XX _f_i_l_e
Exclude files and subdirectories from comparison whose basenames
match lines in _f_i_l_e. Multiple --XX options may be specified.
--xx _p_a_t_t_e_r_n
Exclude files and subdirectories from comparison whose basenames
match _p_a_t_t_e_r_n. Patterns are matched using shell-style globbing
via fnmatch(3). Multiple --xx options may be specified.
If both arguments are directories, ddiiffff sorts the contents of the direc‐
tories by name, and then runs the regular file ddiiffff algorithm, producing
a change list, on text files which are different. Binary files which
differ, common subdirectories, and files which appear in only one direc‐
tory are described as such. In directory mode only regular files and
directories are compared. If a non-regular file such as a device special
file or FIFO is encountered, a diagnostic message is printed.
If only one of _f_i_l_e_1 and _f_i_l_e_2 is a directory, ddiiffff is applied to the
non-directory file and the file contained in the directory file with a
filename that is the same as the last component of the non-directory
file.
If either _f_i_l_e_1 or _f_i_l_e_2 is ‘--’, the standard input is used in its place.
OOuuttppuutt SSttyyllee
The default (without --ee, --cc, or --nn options) output contains lines of
these forms, where _X_X, _Y_Y, _Z_Z, _Q_Q are line numbers respective of file
order.
XXaaYY At (the end of) line _X_X of _f_i_l_e_1, append the contents of
line _Y_Y of _f_i_l_e_2 to make them equal.
XXaaYY,ZZ Same as above, but append the range of lines, _Y_Y through _Z_Z
of _f_i_l_e_2 to line _X_X of file1.
XXddYY At line _X_X delete the line. The value _Y_Y tells to which
line the change would bring _f_i_l_e_1 in line with _f_i_l_e_1.
XX,YYddZZ Delete the range of lines _X_X through _Y_Y in _f_i_l_e_1.
XXccYY Change the line _X_X in _f_i_l_e_1 to the line _Y_Y in _f_i_l_e_2.
XX,YYccZZ Replace the range of specified lines with the line _Z_Z.
XX,YYccZZ,QQ Replace the range _X_X,_Y_Y from _f_i_l_e_1 with the range _Z_Z,_Q_Q from
_f_i_l_e_2.
These lines resemble ed(1) subcommands to convert _f_i_l_e_1 into _f_i_l_e_2. The
line numbers before the action letters pertain to _f_i_l_e_1; those after per‐
tain to _f_i_l_e_2. Thus, by exchanging aa for dd and reading the line in
reverse order, one can also determine how to convert _f_i_l_e_2 into _f_i_l_e_1.
As in ed(1), identical pairs (where num1 = num2) are abbreviated as a
single number.
EENNVVIIRROONNMMEENNTT
TMPDIR If the environment variable TMPDIR exists, ddiiffff will use the
directory specified by TMPDIR as the temporary directory.
FFIILLEESS
/tmp/diff._X_X_X_X_X_X_X_X Temporary file used when comparing a device or the
standard input. Note that the temporary file is
unlinked as soon as it is created so it will not show
up in a directory listing.
EEXXIITT SSTTAATTUUSS
The ddiiffff utility exits with one of the following values:
0 No differences were found.
1 Differences were found.
>1 An error occurred.
SSEEEE AALLSSOO
cmp(1), comm(1), diff3(1), ed(1), patch(1), sdiff(1)
James W. Hunt and M. Douglas McIlroy, "An Algorithm for Differential File
Comparison", _C_o_m_p_u_t_i_n_g _S_c_i_e_n_c_e _T_e_c_h_n_i_c_a_l _R_e_p_o_r_t, Bell Laboratories 41,
June 1976.
SSTTAANNDDAARRDDSS
The ddiiffff utility is compliant with the IEEE Std 1003.1-2008 (“POSIX.1”)
specification.
The flags [--aaDDddIIiiLLllNNnnPPppqqSSssTTttwwXXxx] are extensions to that specification.
HHIISSTTOORRYY
A ddiiffff command appeared in Version 6 AT&T UNIX.
BBUUGGSS
When comparing directories with the --bb, --ww or --ii options specified, ddiiffff
first compares the files ala cmp(1), and then decides to run the ddiiffff
algorithm if they are not equal. This may cause a small amount of spuri‐
ous output if the files then turn out to be identical because the only
differences are insignificant whitespace or case differences.
BSD August 8, 2012 BSD