home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / diff / sprite / RCS / diff.man,v < prev   
Encoding:
Text File  |  1991-02-23  |  7.0 KB  |  347 lines

  1. head     1.2;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @@;
  7.  
  8.  
  9. 1.2
  10. date     91.02.22.17.21.54;  author kupfer;  state Exp;
  11. branches ;
  12. next     1.1;
  13.  
  14. 1.1
  15. date     91.02.22.17.12.51;  author kupfer;  state Exp;
  16. branches ;
  17. next     ;
  18.  
  19.  
  20. desc
  21. @man page for "diff"
  22. @
  23.  
  24.  
  25. 1.2
  26. log
  27. @Note that the GNU diff doesn't name common subdirectories when using
  28. -r, though the BSD diff does.
  29. @
  30. text
  31. @.\" Copyright (c) 1980 Regents of the University of California.
  32. .\" All rights reserved.  The Berkeley software License Agreement
  33. .\" specifies the terms and conditions for redistribution.
  34. .\"
  35. .\"    @@(#)diff.1    6.4 (Berkeley) 5/19/86
  36. .\"  $Header$
  37. .\"
  38. .TH DIFF 1 "May 19, 1986"
  39. .UC 4
  40. .SH NAME
  41. diff \- differential file and directory comparator
  42. .SH SYNOPSIS
  43. .B diff
  44. [
  45. .B \-l
  46. ] [
  47. .B \-r
  48. ] [
  49. .B \-s
  50. ] [
  51. \fB\-cefhn\fR
  52. ] [
  53. .B \-biwt
  54. ] dir1 dir2
  55. .br
  56. .B diff
  57. [
  58. \fB\-cefhn
  59. ] [
  60. \fB\-biwt\fR
  61. ] file1 file2
  62. .br
  63. .B diff
  64. [
  65. .BI \-D string
  66. ] [
  67. .B \-biw
  68. ]
  69. file1 file2
  70. .SH DESCRIPTION
  71. If both arguments are directories,
  72. .I diff
  73. sorts the contents of the directories by name, and then runs the
  74. regular file
  75. .I diff
  76. algorithm (described below)
  77. on text files which are different.
  78. Binary files which differ and files which appear in only one directory
  79. are listed.
  80. Options when comparing directories are:
  81. .TP
  82. .B \-l
  83. long output format; each text file
  84. .I diff
  85. is piped through
  86. .IR pr (1)
  87. to paginate it,
  88. other differences are remembered and summarized
  89. after all text file differences are reported.
  90. .TP
  91. .B \-r
  92. causes application of
  93. .I diff
  94. recursively to common subdirectories encountered.
  95. .TP
  96. .B \-s
  97. causes 
  98. .I diff
  99. to report files which are the same, which are otherwise not mentioned.
  100. .TP
  101. .B \-Sname
  102. starts a directory
  103. .I diff
  104. in the middle beginning with file
  105. .I name.
  106. .PP
  107. When run on regular files, and when comparing text files which differ
  108. during directory comparison,
  109. .I diff
  110. tells what lines must be changed in the files to bring them into agreement.
  111. Except in rare circumstances,
  112. .I diff
  113. finds a smallest sufficient set of file differences.
  114. If neither
  115. .I file1
  116. nor
  117. .I file2
  118. is a directory, then either
  119. may be given as `\-', in which case the standard input is used.
  120. If
  121. .I file1
  122. is a directory,
  123. then a file in that directory whose file-name is the same as the file-name of
  124. .I file2
  125. is used (and vice versa).
  126. .PP
  127. There are several options for output format;
  128. the default output format contains lines of these forms:
  129. .IP "" 5
  130. .I n1
  131. a
  132. .I n3,n4
  133. .br
  134. .I n1,n2
  135. d
  136. .I n3
  137. .br
  138. .I n1,n2
  139. c
  140. .I n3,n4
  141. .PP
  142. These lines resemble
  143. .I ed
  144. commands to convert
  145. .I file1
  146. into
  147. .IR file2 .
  148. The numbers after the letters pertain to
  149. .IR file2 .
  150. In fact, by exchanging `a' for `d' and reading backward
  151. one may ascertain equally how to convert 
  152. .I file2
  153. into
  154. .IR file1 .
  155. As in 
  156. .I ed,
  157. identical pairs where
  158. .I n1
  159. =
  160. .I n2
  161. or
  162. .I n3
  163. =
  164. .I n4
  165. are abbreviated as a single number.
  166. .PP
  167. Following each of these lines come all the lines that are
  168. affected in the first file flagged by `<', 
  169. then all the lines that are affected in the second file
  170. flagged by `>'.
  171. .PP
  172. Except for
  173. \fB\-b, -w, -i\fP or \fB-t\fP
  174. which may be given with any of the others,
  175. the following options are mutually exclusive:
  176. .TP 9
  177. .B \-e
  178. produces a script of
  179. .I "a, c"
  180. and 
  181. .I d
  182. commands for the editor
  183. .I ed,
  184. which will recreate
  185. .I file2
  186. from
  187. .IR file1 .
  188. In connection with
  189. .BR \-e ,
  190. the following shell program may help maintain
  191. multiple versions of a file.
  192. Only an ancestral file ($1) and a chain of 
  193. version-to-version
  194. .I ed
  195. scripts ($2,$3,...) made by
  196. .I diff
  197. need be on hand.
  198. A `latest version' appears on
  199. the standard output.
  200. .IP
  201. \ \ \ \ \ \ \ \ (shift; cat $*; echo \'1,$p\') \(bv ed \- $1
  202. .IP
  203. Extra commands are added to the output when comparing directories with
  204. .B \-e,
  205. so that the result is a
  206. .IR sh (1)
  207. script for converting text files which are common to the two directories
  208. from their state in
  209. .I dir1
  210. to their state in
  211. .I dir2.
  212. .TP 9
  213. .B \-f
  214. produces a script similar to that of
  215. .B \-e,
  216. not useful with
  217. .I ed,
  218. and in the opposite order.
  219. .TP 9
  220. .B \-n
  221. produces a script similar to that of
  222. .B \-e,
  223. but in the opposite order and with a count of changed lines on each
  224. insert or delete command.  This is the form used by
  225. .IR rcsdiff (1).
  226. .TP 9
  227. .B \-c
  228. produces a diff with lines of context.
  229. The default is to present 3 lines of context and may be changed, e.g to 10, by
  230. .BR \-c10 \&.
  231. With
  232. .B \-c
  233. the output format is modified slightly:
  234. the output beginning with identification of the files involved and
  235. their creation dates and then each change is separated
  236. by a line with a dozen *'s.
  237. The lines removed from
  238. .I file1
  239. are marked with `\(mi '; those added to
  240. .I file2
  241. are marked `+ '.  Lines which are changed from one
  242. file to the other are marked in both files with with `! '.
  243.  
  244. Changes which lie within <context> lines of each other are grouped
  245. together on output.  (This is a change from the previous ``diff -c''
  246. but the resulting output is usually much easier to interpret.)
  247. .TP 9
  248. .B \-h
  249. does a fast, half-hearted job.
  250. It works only when changed stretches are short
  251. and well separated,
  252. but does work on files of unlimited length.
  253. .TP
  254. .B \-Dstring
  255. causes
  256. .I diff
  257. to create a merged version of
  258. .I file1
  259. and
  260. .I file2
  261. on the standard output, with C preprocessor controls included so that
  262. a compilation of the result without defining \fIstring\fR is equivalent
  263. to compiling
  264. .I file1,
  265. while defining
  266. .I string
  267. will yield
  268. .I file2.
  269. .TP 9
  270. .B \-b
  271. causes trailing blanks (spaces and tabs) to be ignored, and other
  272. strings of blanks to compare equal.
  273. .TP 9
  274. .B \-w
  275. is similar to
  276. .B \-b
  277. but causes whitespace (blanks and tabs) to be totally ignored.  E.g.,
  278. ``if\ (\ a\ ==\ b\ )'' will compare equal to ``if(a==b)''.
  279. .TP 9
  280. .B \-i
  281. ignores the case of letters.  E.g., ``A'' will compare equal to ``a''.
  282. .TP 9
  283. .B \-t
  284. will expand tabs in output lines.  Normal or
  285. .B \-c
  286. output adds character(s) to the front of each line which may screw up
  287. the indentation of the original source lines and make the output listing
  288. difficult to interpret.  This option will preserve the original source's
  289. indentation.
  290. .SH FILES
  291. /tmp/d?????
  292. .br
  293. /usr/lib/diffh for 
  294. .B \-h
  295. .br
  296. /bin/diff for directory diffs
  297. .br
  298. /bin/pr
  299. .SH "SEE ALSO"
  300. cmp(1), cc(1), comm(1), ed(1), diff3(1)
  301. .SH DIAGNOSTICS
  302. Exit status is 0 for no differences, 1 for some, 2 for trouble.
  303. .SH BUGS
  304. Editing scripts produced under the
  305. .BR \-e " or"
  306. .BR \-f " option are naive about"
  307. creating lines consisting of a single `\fB.\fR'.
  308. .PP
  309. When comparing directories with the
  310. \fB\-b, -w\fP or \fB-i\fP
  311. options specified,
  312. .I diff
  313. first compares the files ala
  314. .I cmp,
  315. and then decides to run the
  316. .I diff
  317. algorithm if they are not equal.
  318. This may cause a small amount of spurious output if the files
  319. then turn out to be identical because the only differences are
  320. insignificant blank string or case differences.
  321. .PP
  322. The GNU
  323. .I diff
  324. is not completely compatible with the BSD
  325. .IR diff .
  326. In particular, when recursively comparing directories, the BSD
  327. .I diff
  328. names all common subdirectories, and the GNU
  329. .I diff
  330. does not.  It has been argued that this is a feature of the GNU 
  331. .IR diff .
  332. @
  333.  
  334.  
  335. 1.1
  336. log
  337. @BSD man page.
  338. @
  339. text
  340. @d6 1
  341. d48 1
  342. a48 2
  343. Binary files which differ,
  344. common subdirectories, and files which appear in only one directory
  345. d291 11
  346. @
  347.