home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 4 / FreshFish_May-June1994.bin / bbs / gnu / diffutils-2.6-bin.lha / info / diff.info-1 next >
Encoding:
GNU Info File  |  1994-02-23  |  46.3 KB  |  1,198 lines

  1. This is Info file diff.info, produced by Makeinfo-1.55 from the input
  2. file ./diff.texi.
  3.  
  4.    This file documents the the GNU `diff', `diff3', `sdiff', and `cmp'
  5. commands for showing the differences between text files and the `patch'
  6. command for using their output to update files.
  7.  
  8.    Copyright (C) 1992, 1993 Free Software Foundation, Inc.
  9.  
  10.    Permission is granted to make and distribute verbatim copies of this
  11. manual provided the copyright notice and this permission notice are
  12. preserved on all copies.
  13.  
  14.    Permission is granted to copy and distribute modified versions of
  15. this manual under the conditions for verbatim copying, provided that
  16. the entire resulting derived work is distributed under the terms of a
  17. permission notice identical to this one.
  18.  
  19.    Permission is granted to copy and distribute translations of this
  20. manual into another language, under the above conditions for modified
  21. versions, except that this permission notice may be stated in a
  22. translation approved by the Foundation.
  23.  
  24. 
  25. File: diff.info,  Node: Top,  Up: (dir)
  26.  
  27.    This file documents the the GNU `diff', `diff3', `sdiff', and `cmp'
  28. commands for showing the differences between text files and the `patch'
  29. command for using their output to update files.
  30.  
  31.    This is Edition 1.2, for `diff' 2.4 and `patch' 2.1.
  32.  
  33. * Menu:
  34.  
  35. * Overview::        Preliminary information.
  36.  
  37. * Comparison::        What file comparison means.
  38. * Output Formats::    Formats for difference reports.
  39. * Comparing Directories::    Comparing files and directories.
  40. * Adjusting Output::    Making `diff' output prettier.
  41. * diff Performance::    Making `diff' smarter or faster.
  42. * Comparing Three Files:: Formats for three-way difference reports.
  43.  
  44. * diff3 Merging::    Merging from a common ancestor.
  45. * Interactive Merging::    Interactive merging with `sdiff'.
  46. * Merging with patch::    Using `patch' to change old files into new ones.
  47. * Making Patches::    Tips for making patch distributions.
  48.  
  49. * Invoking cmp::    How to run `cmp' and a summary of its options.
  50. * Invoking diff::    How to run `diff' and a summary of its options.
  51. * Invoking diff3::    How to run `diff3' and a summary of its options.
  52. * Invoking patch::    How to run `patch' and a summary of its options.
  53. * Invoking sdiff::    How to run `sdiff' and a summary of its options.
  54.  
  55. * Incomplete Lines::    Lines that lack trailing newlines.
  56. * Projects::        If you think you've found a bug or other shortcoming.
  57.  
  58. * Concept Index::    Index of concepts.
  59.  
  60. 
  61. File: diff.info,  Node: Overview,  Next: Comparison,  Up: Top
  62.  
  63. Overview
  64. ********
  65.  
  66.    Computer users often find occasion to ask how two files differ.
  67. Perhaps one file is a newer version of the other file.  Or maybe the
  68. two files started out as identical copies but were changed by different
  69. people.
  70.  
  71.    You can use the `diff' command to show differences between two
  72. files, or each corresponding file in two directories.  `diff' outputs
  73. differences between files line by line in any of several formats,
  74. selectable by command line options.  This set of differences is often
  75. called a "diff" or "patch".  For files that are identical, `diff'
  76. normally produces no output; for binary (non-text) files, `diff'
  77. normally reports only that they are different.
  78.  
  79.    You can use the `cmp' command to show the offsets and line numbers
  80. where two files differ.  `cmp' can also show all the characters that
  81. differ between the two files, side by side.  Another way to compare two
  82. files character by character is the Emacs command `M-x
  83. compare-windows'.  *Note Other Window: (emacs)Other Window, for more
  84. information on that command.
  85.  
  86.    You can use the `diff3' command to show differences among three
  87. files.  When two people have made independent changes to a common
  88. original, `diff3' can report the differences between the original and
  89. the two changed versions, and can produce a merged file that contains
  90. both persons' changes together with warnings about conflicts.
  91.  
  92.    You can use the `sdiff' command to merge two files interactively.
  93.  
  94.    You can use the set of differences produced by `diff' to distribute
  95. updates to text files (such as program source code) to other people.
  96. This method is especially useful when the differences are small compared
  97. to the complete files.  Given `diff' output, you can use the `patch'
  98. program to update, or "patch", a copy of the file.  If you think of
  99. `diff' as subtracting one file from another to produce their
  100. difference, you can think of `patch' as adding the difference to one
  101. file to reproduce the other.
  102.  
  103.    This manual first concentrates on making diffs, and later shows how
  104. to use diffs to update files.
  105.  
  106.    GNU `diff' was written by Mike Haertel, David Hayes, Richard
  107. Stallman, Len Tower, and Paul Eggert.  Wayne Davison designed and
  108. implemented the unified output format.  The basic algorithm is described
  109. in "An O(ND) Difference Algorithm and its Variations", Eugene W. Myers,
  110. `Algorithmica' Vol. 1 No. 2, 1986, pp. 251-266; and in "A File
  111. Comparison Program", Webb Miller and Eugene W. Myers,
  112. `Software--Practice and Experience' Vol. 15 No. 11, 1985, pp. 1025-1040.
  113. The algorithm was independently discovered as described in "Algorithms
  114. for Approximate String Matching", E. Ukkonen, `Information and Control'
  115. Vol. 64, 1985, pp. 100-118.
  116.  
  117.    GNU `diff3' was written by Randy Smith.  GNU `sdiff' was written by
  118. Thomas Lord.  GNU `cmp' was written by Torbjorn Granlund and David
  119. MacKenzie.
  120.  
  121.    `patch' was written mainly by Larry Wall; the GNU enhancements were
  122. written mainly by Wayne Davison and David MacKenzie.  Parts of this
  123. manual are adapted from a manual page written by Larry Wall, with his
  124. permission.
  125.  
  126. 
  127. File: diff.info,  Node: Comparison,  Next: Output Formats,  Prev: Overview,  Up: Top
  128.  
  129. What Comparison Means
  130. *********************
  131.  
  132.    There are several ways to think about the differences between two
  133. files.  One way to think of the differences is as a series of lines
  134. that were deleted from, inserted in, or changed in one file to produce
  135. the other file.  `diff' compares two files line by line, finds groups of
  136. lines that differ, and reports each group of differing lines.  It can
  137. report the differing lines in several formats, which have different
  138. purposes.
  139.  
  140.    GNU `diff' can show whether files are different without detailing
  141. the differences.  It also provides ways to suppress certain kinds of
  142. differences that are not important to you.  Most commonly, such
  143. differences are changes in the amount of white space between words or
  144. lines.  `diff' also provides ways to suppress differences in alphabetic
  145. case or in lines that match a regular expression that you provide.
  146. These options can accumulate; for example, you can ignore changes in
  147. both white space and alphabetic case.
  148.  
  149.    Another way to think of the differences between two files is as a
  150. sequence of pairs of characters that can be either identical or
  151. different.  `cmp' reports the differences between two files character
  152. by character, instead of line by line.  As a result, it is more useful
  153. than `diff' for comparing binary files.  For text files, `cmp' is
  154. useful mainly when you want to know only whether two files are
  155. identical.
  156.  
  157.    To illustrate the effect that considering changes character by
  158. character can have compared with considering them line by line, think
  159. of what happens if a single newline character is added to the beginning
  160. of a file.  If that file is then compared with an otherwise identical
  161. file that lacks the newline at the beginning, `diff' will report that a
  162. blank line has been added to the file, while `cmp' will report that
  163. almost every character of the two files differs.
  164.  
  165.    `diff3' normally compares three input files line by line, finds
  166. groups of lines that differ, and reports each group of differing lines.
  167. Its output is designed to make it easy to inspect two different sets of
  168. changes to the same file.
  169.  
  170. * Menu:
  171.  
  172. * Hunks::        Groups of differing lines.
  173. * White Space::        Suppressing differences in white space.
  174. * Blank Lines::        Suppressing differences in blank lines.
  175. * Case Folding::    Suppressing differences in alphabetic case.
  176. * Specified Folding::    Suppressing differences that match regular expressions.
  177. * Brief::        Summarizing which files are different.
  178. * Binary::        Comparing binary files or forcing text comparisons.
  179.  
  180. 
  181. File: diff.info,  Node: Hunks,  Next: White Space,  Up: Comparison
  182.  
  183. Hunks
  184. =====
  185.  
  186.    When comparing two files, `diff' finds sequences of lines common to
  187. both files, interspersed with groups of differing lines called "hunks".
  188. Comparing two identical files yields one sequence of common lines and
  189. no hunks, because no lines differ.  Comparing two entirely different
  190. files yields no common lines and one large hunk that contains all lines
  191. of both files.  In general, there are many ways to match up lines
  192. between two given files.  `diff' tries to minimize the total hunk size
  193. by finding large sequences of common lines interspersed with small
  194. hunks of differing lines.
  195.  
  196.    For example, suppose the file `F' contains the three lines `a', `b',
  197. `c', and the file `G' contains the same three lines in reverse order
  198. `c', `b', `a'.  If `diff' finds the line `c' as common, then the command
  199. `diff F G' produces this output:
  200.  
  201.      1,2d0
  202.      < a
  203.      < b
  204.      3a2,3
  205.      > b
  206.      > a
  207.  
  208. But if `diff' notices the common line `b' instead, it produces this
  209. output:
  210.  
  211.      1c1
  212.      < a
  213.      ---
  214.      > c
  215.      3c3
  216.      < c
  217.      ---
  218.      > a
  219.  
  220. It is also possible to find `a' as the common line.  `diff' does not
  221. always find an optimal matching between the files; it takes shortcuts
  222. to run faster.  But its output is usually close to the shortest
  223. possible.  You can adjust this tradeoff with the `--minimal' option
  224. (*note diff Performance::.).
  225.  
  226. 
  227. File: diff.info,  Node: White Space,  Next: Blank Lines,  Prev: Hunks,  Up: Comparison
  228.  
  229. Suppressing Differences in Blank and Tab Spacing
  230. ================================================
  231.  
  232.    The `-b' and `--ignore-space-change' options ignore white space at
  233. line end, and considers all other sequences of one or more white space
  234. characters to be equivalent.  With these options, `diff' considers the
  235. following two lines to be equivalent, where `$' denotes the line end:
  236.  
  237.      Here lyeth  muche rychnesse  in lytell space.   -- John Heywood$
  238.      Here lyeth muche rychnesse in lytell space. -- John Heywood   $
  239.  
  240.    The `-w' and `--ignore-all-space' options are stronger than `-b'.
  241. They ignore difference even if one file has white space where the other
  242. file has none.  "White space" characters include tab, vertical tab,
  243. form feed, carriage return, and space; some locales may define
  244. additional characters to be white space.  With these options, `diff'
  245. considers the following two lines to be equivalent, where `$' denotes
  246. the line end and `^M' denotes a carriage return:
  247.  
  248.      Here lyeth  muche  rychnesse in lytell space.--  John Heywood$
  249.        He relyeth much erychnes  seinly tells pace.  --John Heywood   ^M$
  250.  
  251. 
  252. File: diff.info,  Node: Blank Lines,  Next: Case Folding,  Prev: White Space,  Up: Comparison
  253.  
  254. Suppressing Differences in Blank Lines
  255. ======================================
  256.  
  257.    The `-B' and `--ignore-blank-lines' options ignore insertions or
  258. deletions of blank lines.  These options normally affect only lines
  259. that are completely empty; they do not affect lines that look empty but
  260. contain space or tab characters.  With these options, for example, a
  261. file containing
  262.      1.  A point is that which has no part.
  263.      
  264.      2.  A line is breadthless length.
  265.      -- Euclid, The Elements, I
  266.  
  267. is considered identical to a file containing
  268.      1.  A point is that which has no part.
  269.      2.  A line is breadthless length.
  270.      
  271.      
  272.      -- Euclid, The Elements, I
  273.  
  274. 
  275. File: diff.info,  Node: Case Folding,  Next: Specified Folding,  Prev: Blank Lines,  Up: Comparison
  276.  
  277. Suppressing Case Differences
  278. ============================
  279.  
  280.    GNU `diff' can treat lowercase letters as equivalent to their
  281. uppercase counterparts, so that, for example, it considers `Funky
  282. Stuff', `funky STUFF', and `fUNKy stuFf' to all be the same.  To
  283. request this, use the `-i' or `--ignore-case' option.
  284.  
  285. 
  286. File: diff.info,  Node: Specified Folding,  Next: Brief,  Prev: Case Folding,  Up: Comparison
  287.  
  288. Suppressing Lines Matching a Regular Expression
  289. ===============================================
  290.  
  291.    To ignore insertions and deletions of lines that match a regular
  292. expression, use the `-I REGEXP' or `--ignore-matching-lines=REGEXP'
  293. option.  You should escape regular expressions that contain shell
  294. metacharacters to prevent the shell from expanding them.  For example,
  295. `diff -I '^[0-9]'' ignores all changes to lines beginning with a digit.
  296.  
  297.    However, `-I' only ignores the insertion or deletion of lines that
  298. contain the regular expression if every changed line in the hunk--every
  299. insertion and every deletion--matches the regular expression.  In other
  300. words, for each nonignorable change, `diff' prints the complete set of
  301. changes in its vicinity, including the ignorable ones.
  302.  
  303.    You can specify more than one regular expression for lines to ignore
  304. by using more than one `-I' option.  `diff' tries to match each line
  305. against each regular expression, starting with the last one given.
  306.  
  307. 
  308. File: diff.info,  Node: Brief,  Next: Binary,  Prev: Specified Folding,  Up: Comparison
  309.  
  310. Summarizing Which Files Differ
  311. ==============================
  312.  
  313.    When you only want to find out whether files are different, and you
  314. don't care what the differences are, you can use the summary output
  315. format.  In this format, instead of showing the differences between the
  316. files, `diff' simply reports whether files differ.  The `-q' and
  317. `--brief' options select this output format.
  318.  
  319.    This format is especially useful when comparing the contents of two
  320. directories.  It is also much faster than doing the normal line by line
  321. comparisons, because `diff' can stop analyzing the files as soon as it
  322. knows that there are any differences.
  323.  
  324.    You can also get a brief indication of whether two files differ by
  325. using `cmp'.  For files that are identical, `cmp' produces no output.
  326. When the files differ, by default, `cmp' outputs the byte offset and
  327. line number where the first difference occurs.  You can use the `-s'
  328. option to suppress that information, so that `cmp' produces no output
  329. and reports whether the files differ using only its exit status (*note
  330. Invoking cmp::.).
  331.  
  332.    Unlike `diff', `cmp' cannot compare directories; it can only compare
  333. two files.
  334.  
  335. 
  336. File: diff.info,  Node: Binary,  Prev: Brief,  Up: Comparison
  337.  
  338. Binary Files and Forcing Text Comparisons
  339. =========================================
  340.  
  341.    If `diff' thinks that either of the two files it is comparing is
  342. binary (a non-text file), it normally treats that pair of files much as
  343. if the summary output format had been selected (*note Brief::.), and
  344. reports only that the binary files are different.  This is because line
  345. by line comparisons are usually not meaningful for binary files.
  346.  
  347.    `diff' determines whether a file is text or binary by checking the
  348. first few bytes in the file; the exact number of bytes is system
  349. dependent, but it is typically several thousand.  If every character in
  350. that part of the file is non-null, `diff' considers the file to be
  351. text; otherwise it considers the file to be binary.
  352.  
  353.    Sometimes you might want to force `diff' to consider files to be
  354. text.  For example, you might be comparing text files that contain null
  355. characters; `diff' would erroneously decide that those are non-text
  356. files.  Or you might be comparing documents that are in a format used
  357. by a word processing system that uses null characters to indicate
  358. special formatting.  You can force `diff' to consider all files to be
  359. text files, and compare them line by line, by using the `-a' or
  360. `--text' option.  If the files you compare using this option do not in
  361. fact contain text, they will probably contain few newline characters,
  362. and the `diff' output will consist of hunks showing differences between
  363. long lines of whatever characters the files contain.
  364.  
  365.    You can also force `diff' to consider all files to be binary files,
  366. and report only whether they differ (but not how).  Use the `--brief'
  367. option for this.
  368.  
  369.    If you want to compare two files byte by byte, you can use the `cmp'
  370. program with the `-l' option to show the values of each differing byte
  371. in the two files.  With GNU `cmp', you can also use the `-c' option to
  372. show the ASCII representation of those bytes.  *Note Invoking cmp::,
  373. for more information.
  374.  
  375.    If `diff3' thinks that any of the files it is comparing is binary (a
  376. non-text file), it normally reports an error, because such comparisons
  377. are usually not useful.  `diff3' uses the same test as `diff' to decide
  378. whether a file is binary.  As with `diff', if the input files contain a
  379. few non-text characters but otherwise are like text files, you can
  380. force `diff3' to consider all files to be text files and compare them
  381. line by line by using the `-a' or `--text' options.
  382.  
  383. 
  384. File: diff.info,  Node: Output Formats,  Next: Comparing Directories,  Prev: Comparison,  Up: Top
  385.  
  386. `diff' Output Formats
  387. *********************
  388.  
  389.    `diff' has several mutually exclusive options for output format.
  390. The following sections describe each format, illustrating how `diff'
  391. reports the differences between two sample input files.
  392.  
  393. * Menu:
  394.  
  395. * Sample diff Input::    Sample `diff' input files for examples.
  396. * Normal::        Showing differences without surrounding text.
  397. * Context::        Showing differences with the surrounding text.
  398. * Side by Side::        Showing differences in two columns.
  399. * Scripts::        Generating scripts for other programs.
  400. * If-then-else::    Merging files with if-then-else.
  401.  
  402. 
  403. File: diff.info,  Node: Sample diff Input,  Next: Normal,  Up: Output Formats
  404.  
  405. Two Sample Input Files
  406. ======================
  407.  
  408.    Here are two sample files that we will use in numerous examples to
  409. illustrate the output of `diff' and how various options can change it.
  410.  
  411.    This is the file `lao':
  412.  
  413.      The Way that can be told of is not the eternal Way;
  414.      The name that can be named is not the eternal name.
  415.      The Nameless is the origin of Heaven and Earth;
  416.      The Named is the mother of all things.
  417.      Therefore let there always be non-being,
  418.        so we may see their subtlety,
  419.      And let there always be being,
  420.        so we may see their outcome.
  421.      The two are the same,
  422.      But after they are produced,
  423.        they have different names.
  424.  
  425.    This is the file `tzu':
  426.  
  427.      The Nameless is the origin of Heaven and Earth;
  428.      The named is the mother of all things.
  429.      
  430.      Therefore let there always be non-being,
  431.        so we may see their subtlety,
  432.      And let there always be being,
  433.        so we may see their outcome.
  434.      The two are the same,
  435.      But after they are produced,
  436.        they have different names.
  437.      They both may be called deep and profound.
  438.      Deeper and more profound,
  439.      The door of all subtleties!
  440.  
  441.    In this example, the first hunk contains just the first two lines of
  442. `lao', the second hunk contains the fourth line of `lao' opposing the
  443. second and third lines of `tzu', and the last hunk contains just the
  444. last three lines of `tzu'.
  445.  
  446. 
  447. File: diff.info,  Node: Normal,  Next: Context,  Prev: Sample diff Input,  Up: Output Formats
  448.  
  449. Showing Differences Without Context
  450. ===================================
  451.  
  452.    The "normal" `diff' output format shows each hunk of differences
  453. without any surrounding context.  Sometimes such output is the clearest
  454. way to see how lines have changed, without the clutter of nearby
  455. unchanged lines (although you can get similar results with the context
  456. or unified formats by using 0 lines of context).  However, this format
  457. is no longer widely used for sending out patches; for that purpose, the
  458. context format (*note Context Format::.) and the unified format (*note
  459. Unified Format::.) are superior.  Normal format is the default for
  460. compatibility with older versions of `diff' and the Posix standard.
  461.  
  462. * Menu:
  463.  
  464. * Detailed Normal::    A detailed description of normal output format.
  465. * Example Normal::    Sample output in the normal format.
  466.  
  467. 
  468. File: diff.info,  Node: Detailed Normal,  Next: Example Normal,  Up: Normal
  469.  
  470. Detailed Description of Normal Format
  471. -------------------------------------
  472.  
  473.    The normal output format consists of one or more hunks of
  474. differences; each hunk shows one area where the files differ.  Normal
  475. format hunks look like this:
  476.  
  477.      CHANGE-COMMAND
  478.      < FROM-FILE-LINE
  479.      < FROM-FILE-LINE...
  480.      ---
  481.      > TO-FILE-LINE
  482.      > TO-FILE-LINE...
  483.  
  484.    There are three types of change commands.  Each consists of a line
  485. number or comma-separated range of lines in the first file, a single
  486. character indicating the kind of change to make, and a line number or
  487. comma-separated range of lines in the second file.  All line numbers are
  488. the original line numbers in each file.  The types of change commands
  489. are:
  490.  
  491. `LaR'
  492.      Add the lines in range R of the second file after line L of the
  493.      first file.  For example, `8a12,15' means append lines 12-15 of
  494.      file 2 after line 8 of file 1; or, if changing file 2 into file 1,
  495.      delete lines 12-15 of file 2.
  496.  
  497. `FcT'
  498.      Replace the lines in range F of the first file with lines in range
  499.      T of the second file.  This is like a combined add and delete, but
  500.      more compact.  For example, `5,7c8,10' means change lines 5-7 of
  501.      file 1 to read as lines 8-10 of file 2; or, if changing file 2 into
  502.      file 1, change lines 8-10 of file 2 to read as lines 5-7 of file 1.
  503.  
  504. `RdL'
  505.      Delete the lines in range R from the first file; line L is where
  506.      they would have appeared in the second file had they not been
  507.      deleted.  For example, `5,7d3' means delete lines 5-7 of file 1;
  508.      or, if changing file 2 into file 1, append lines 5-7 of file 1
  509.      after line 3 of file 2.
  510.  
  511. 
  512. File: diff.info,  Node: Example Normal,  Prev: Detailed Normal,  Up: Normal
  513.  
  514. An Example of Normal Format
  515. ---------------------------
  516.  
  517.    Here is the output of the command `diff lao tzu' (*note Sample diff
  518. Input::., for the complete contents of the two files).  Notice that it
  519. shows only the lines that are different between the two files.
  520.  
  521.      1,2d0
  522.      < The Way that can be told of is not the eternal Way;
  523.      < The name that can be named is not the eternal name.
  524.      4c2,3
  525.      < The Named is the mother of all things.
  526.      ---
  527.      > The named is the mother of all things.
  528.      >
  529.      11a11,13
  530.      > They both may be called deep and profound.
  531.      > Deeper and more profound,
  532.      > The door of all subtleties!
  533.  
  534. 
  535. File: diff.info,  Node: Context,  Next: Side by Side,  Prev: Normal,  Up: Output Formats
  536.  
  537. Showing Differences in Their Context
  538. ====================================
  539.  
  540.    Usually, when you are looking at the differences between files, you
  541. will also want to see the parts of the files near the lines that
  542. differ, to help you understand exactly what has changed.  These nearby
  543. parts of the files are called the "context".
  544.  
  545.    GNU `diff' provides two output formats that show context around the
  546. differing lines: "context format" and "unified format".  It can
  547. optionally show in which function or section of the file the differing
  548. lines are found.
  549.  
  550.    If you are distributing new versions of files to other people in the
  551. form of `diff' output, you should use one of the output formats that
  552. show context so that they can apply the diffs even if they have made
  553. small changes of their own to the files.  `patch' can apply the diffs
  554. in this case by searching in the files for the lines of context around
  555. the differing lines; if those lines are actually a few lines away from
  556. where the diff says they are, `patch' can adjust the line numbers
  557. accordingly and still apply the diff correctly.  *Note Imperfect::, for
  558. more information on using `patch' to apply imperfect diffs.
  559.  
  560. * Menu:
  561.  
  562. * Context Format::    An output format that shows surrounding lines.
  563. * Unified Format::    A more compact output format that shows context.
  564. * Sections::        Showing which sections of the files differences are in.
  565. * Alternate Names::    Showing alternate file names in context headers.
  566.  
  567. 
  568. File: diff.info,  Node: Context Format,  Next: Unified Format,  Up: Context
  569.  
  570. Context Format
  571. --------------
  572.  
  573.    The context output format shows several lines of context around the
  574. lines that differ.  It is the standard format for distributing updates
  575. to source code.
  576.  
  577.    To select this output format, use the `-C LINES',
  578. `--context[=LINES]', or `-c' option.  The argument LINES that some of
  579. these options take is the number of lines of context to show.  If you
  580. do not specify LINES, it defaults to three.  For proper operation,
  581. `patch' typically needs at least two lines of context.
  582.  
  583. * Menu:
  584.  
  585. * Detailed Context::    A detailed description of the context output format.
  586. * Example Context::    Sample output in context format.
  587. * Less Context::    Another sample with less context.
  588.  
  589. 
  590. File: diff.info,  Node: Detailed Context,  Next: Example Context,  Up: Context Format
  591.  
  592. Detailed Description of Context Format
  593. ......................................
  594.  
  595.    The context output format starts with a two-line header, which looks
  596. like this:
  597.  
  598.      *** FROM-FILE FROM-FILE-MODIFICATION-TIME
  599.      --- TO-FILE TO-FILE-MODIFICATION TIME
  600.  
  601. You can change the header's content with the `-L LABEL' or
  602. `--label=LABEL' option; see *Note Alternate Names::.
  603.  
  604.    Next come one or more hunks of differences; each hunk shows one area
  605. where the files differ.  Context format hunks look like this:
  606.  
  607.      ***************
  608.      *** FROM-FILE-LINE-RANGE ****
  609.        FROM-FILE-LINE
  610.        FROM-FILE-LINE...
  611.      --- TO-FILE-LINE-RANGE ----
  612.        TO-FILE-LINE
  613.        TO-FILE-LINE...
  614.  
  615.    The lines of context around the lines that differ start with two
  616. space characters.  The lines that differ between the two files start
  617. with one of the following indicator characters, followed by a space
  618. character:
  619.  
  620. `!'
  621.      A line that is part of a group of one or more lines that changed
  622.      between the two files.  There is a corresponding group of lines
  623.      marked with `!' in the part of this hunk for the other file.
  624.  
  625. `+'
  626.      An "inserted" line in the second file that corresponds to nothing
  627.      in the first file.
  628.  
  629. `-'
  630.      A "deleted" line in the first file that corresponds to nothing in
  631.      the second file.
  632.  
  633.    If all of the changes in a hunk are insertions, the lines of
  634. FROM-FILE are omitted.  If all of the changes are deletions, the lines
  635. of TO-FILE are omitted.
  636.  
  637. 
  638. File: diff.info,  Node: Example Context,  Next: Less Context,  Prev: Detailed Context,  Up: Context Format
  639.  
  640. An Example of Context Format
  641. ............................
  642.  
  643.    Here is the output of `diff -c lao tzu' (*note Sample diff Input::.,
  644. for the complete contents of the two files).  Notice that up to three
  645. lines that are not different are shown around each line that is
  646. different; they are the context lines.  Also notice that the first two
  647. hunks have run together, because their contents overlap.
  648.  
  649.      *** lao    Sat Jan 26 23:30:39 1991
  650.      --- tzu    Sat Jan 26 23:30:50 1991
  651.      ***************
  652.      *** 1,7 ****
  653.      - The Way that can be told of is not the eternal Way;
  654.      - The name that can be named is not the eternal name.
  655.        The Nameless is the origin of Heaven and Earth;
  656.      ! The Named is the mother of all things.
  657.        Therefore let there always be non-being,
  658.          so we may see their subtlety,
  659.        And let there always be being,
  660.      --- 1,6 ----
  661.        The Nameless is the origin of Heaven and Earth;
  662.      ! The named is the mother of all things.
  663.      !
  664.        Therefore let there always be non-being,
  665.          so we may see their subtlety,
  666.        And let there always be being,
  667.      ***************
  668.      *** 9,11 ****
  669.      --- 8,13 ----
  670.        The two are the same,
  671.        But after they are produced,
  672.          they have different names.
  673.      + They both may be called deep and profound.
  674.      + Deeper and more profound,
  675.      + The door of all subtleties!
  676.  
  677. 
  678. File: diff.info,  Node: Less Context,  Prev: Example Context,  Up: Context Format
  679.  
  680. An Example of Context Format with Less Context
  681. ..............................................
  682.  
  683.    Here is the output of `diff --context=1 lao tzu' (*note Sample diff
  684. Input::., for the complete contents of the two files).  Notice that at
  685. most one context line is reported here.
  686.  
  687.      *** lao    Sat Jan 26 23:30:39 1991
  688.      --- tzu    Sat Jan 26 23:30:50 1991
  689.      ***************
  690.      *** 1,5 ****
  691.      - The Way that can be told of is not the eternal Way;
  692.      - The name that can be named is not the eternal name.
  693.        The Nameless is the origin of Heaven and Earth;
  694.      ! The Named is the mother of all things.
  695.        Therefore let there always be non-being,
  696.      --- 1,4 ----
  697.        The Nameless is the origin of Heaven and Earth;
  698.      ! The named is the mother of all things.
  699.      !
  700.        Therefore let there always be non-being,
  701.      ***************
  702.      *** 11 ****
  703.      --- 10,13 ----
  704.          they have different names.
  705.      + They both may be called deep and profound.
  706.      + Deeper and more profound,
  707.      + The door of all subtleties!
  708.  
  709. 
  710. File: diff.info,  Node: Unified Format,  Next: Sections,  Prev: Context Format,  Up: Context
  711.  
  712. Unified Format
  713. --------------
  714.  
  715.    The unified output format is a variation on the context format that
  716. is more compact because it omits redundant context lines.  To select
  717. this output format, use the `-U LINES', `--unified[=LINES]', or `-u'
  718. option.  The argument LINES is the number of lines of context to show.
  719. When it is not given, it defaults to three.
  720.  
  721.    At present, only GNU `diff' can produce this format and only GNU
  722. `patch' can automatically apply diffs in this format.  For proper
  723. operation, `patch' typically needs at least two lines of context.
  724.  
  725. * Menu:
  726.  
  727. * Detailed Unified::    A detailed description of unified format.
  728. * Example Unified::    Sample output in unified format.
  729.  
  730. 
  731. File: diff.info,  Node: Detailed Unified,  Next: Example Unified,  Up: Unified Format
  732.  
  733. Detailed Description of Unified Format
  734. ......................................
  735.  
  736.    The unified output format starts with a two-line header, which looks
  737. like this:
  738.  
  739.      --- FROM-FILE FROM-FILE-MODIFICATION-TIME
  740.      +++ TO-FILE TO-FILE-MODIFICATION-TIME
  741.  
  742. You can change the header's content with the `-L LABEL' or
  743. `--label=LABEL' option; see *Note Alternate Names::.
  744.  
  745.    Next come one or more hunks of differences; each hunk shows one area
  746. where the files differ.  Unified format hunks look like this:
  747.  
  748.      @@ FROM-FILE-RANGE TO-FILE-RANGE @@
  749.       LINE-FROM-EITHER-FILE
  750.       LINE-FROM-EITHER-FILE...
  751.  
  752.    The lines common to both files begin with a space character.  The
  753. lines that actually differ between the two files have one of the
  754. following indicator characters in the left column:
  755.  
  756. `+'
  757.      A line was added here to the first file.
  758.  
  759. `-'
  760.      A line was removed here from the first file.
  761.  
  762. 
  763. File: diff.info,  Node: Example Unified,  Prev: Detailed Unified,  Up: Unified Format
  764.  
  765. An Example of Unified Format
  766. ............................
  767.  
  768.    Here is the output of the command `diff -u lao tzu' (*note Sample
  769. diff Input::., for the complete contents of the two files):
  770.  
  771.      --- lao    Sat Jan 26 23:30:39 1991
  772.      +++ tzu    Sat Jan 26 23:30:50 1991
  773.      @@ -1,7 +1,6 @@
  774.      -The Way that can be told of is not the eternal Way;
  775.      -The name that can be named is not the eternal name.
  776.       The Nameless is the origin of Heaven and Earth;
  777.      -The Named is the mother of all things.
  778.      +The named is the mother of all things.
  779.      +
  780.       Therefore let there always be non-being,
  781.         so we may see their subtlety,
  782.       And let there always be being,
  783.      @@ -9,3 +8,6 @@
  784.       The two are the same,
  785.       But after they are produced,
  786.         they have different names.
  787.      +They both may be called deep and profound.
  788.      +Deeper and more profound,
  789.      +The door of all subtleties!
  790.  
  791. 
  792. File: diff.info,  Node: Sections,  Next: Alternate Names,  Prev: Unified Format,  Up: Context
  793.  
  794. Showing Which Sections Differences Are in
  795. -----------------------------------------
  796.  
  797.    Sometimes you might want to know which part of the files each change
  798. falls in.  If the files are source code, this could mean which function
  799. was changed.  If the files are documents, it could mean which chapter or
  800. appendix was changed.  GNU `diff' can show this by displaying the
  801. nearest section heading line that precedes the differing lines.  Which
  802. lines are "section headings" is determined by a regular expression.
  803.  
  804. * Menu:
  805.  
  806. * Specified Headings::    Showing headings that match regular expressions.
  807. * C Function Headings::    Showing headings of C functions.
  808.  
  809. 
  810. File: diff.info,  Node: Specified Headings,  Next: C Function Headings,  Up: Sections
  811.  
  812. Showing Lines That Match Regular Expressions
  813. ............................................
  814.  
  815.    To show in which sections differences occur for files that are not
  816. source code for C or similar languages, use the `-F REGEXP' or
  817. `--show-function-line=REGEXP' option.  `diff' considers lines that
  818. match the argument REGEXP to be the beginning of a section of the file.
  819. Here are suggested regular expressions for some common languages:
  820.  
  821. `^[A-Za-z_]'
  822.      C, C++, Prolog
  823.  
  824. `^('
  825.      Lisp
  826.  
  827. `^@\(chapter\|appendix\|unnumbered\|chapheading\)'
  828.      Texinfo
  829.  
  830.    This option does not automatically select an output format; in order
  831. to use it, you must select the context format (*note Context Format::.)
  832. or unified format (*note Unified Format::.).  In other output formats it
  833. has no effect.
  834.  
  835.    The `-F' and `--show-function-line' options find the nearest
  836. unchanged line that precedes each hunk of differences and matches the
  837. given regular expression.  Then they add that line to the end of the
  838. line of asterisks in the context format, or to the `@@' line in unified
  839. format.  If no matching line exists, they leave the output for that
  840. hunk unchanged.  If that line is more than 40 characters long, they
  841. output only the first 40 characters.  You can specify more than one
  842. regular expression for such lines; `diff' tries to match each line
  843. against each regular expression, starting with the last one given.  This
  844. means that you can use `-p' and `-F' together, if you wish.
  845.  
  846. 
  847. File: diff.info,  Node: C Function Headings,  Prev: Specified Headings,  Up: Sections
  848.  
  849. Showing C Function Headings
  850. ...........................
  851.  
  852.    To show in which functions differences occur for C and similar
  853. languages, you can use the `-p' or `--show-c-function' option.  This
  854. option automatically selects the context output format (*note Context
  855. Format::.), with the default number of lines of context.  You can
  856. override that number with `-C LINES' later in the command line.  You
  857. can override both the format and the number with `-U LINES' later in
  858. the command line.
  859.  
  860.    The `-p' and `--show-c-function' options are equivalent to `-c
  861. -F'^[_a-zA-Z$]'' (*note Specified Headings::.).  GNU `diff' provides
  862. them for the sake of convenience.
  863.  
  864. 
  865. File: diff.info,  Node: Alternate Names,  Prev: Sections,  Up: Context
  866.  
  867. Showing Alternate File Names
  868. ----------------------------
  869.  
  870.    If you are comparing two files that have meaningless or uninformative
  871. names, you might want `diff' to show alternate names in the header of
  872. the context and unified output formats.  To do this, use the `-L LABEL'
  873. or `--label=LABEL' option.  The first time you give this option, its
  874. argument replaces the name and date of the first file in the header;
  875. the second time, its argument replaces the name and date of the second
  876. file.  If you give this option more than twice, `diff' reports an
  877. error.  The `-L' option does not affect the file names in the `pr'
  878. header when the `-l' or `--paginate' option is used (*note
  879. Pagination::.).
  880.  
  881.    Here are the first two lines of the output from `diff -C2 -Loriginal
  882. -Lmodified lao tzu':
  883.  
  884.      *** original
  885.      --- modified
  886.  
  887. 
  888. File: diff.info,  Node: Side by Side,  Next: Scripts,  Prev: Context,  Up: Output Formats
  889.  
  890. Showing Differences Side by Side
  891. ================================
  892.  
  893.    `diff' can produce a side by side difference listing of two files.
  894. The files are listed in two columns with a gutter between them.  The
  895. gutter contains one of the following markers:
  896.  
  897. white space
  898.      The corresponding lines are in common.  That is, either the lines
  899.      are identical, or the difference is ignored because of one of the
  900.      `--ignore' options (*note White Space::.).
  901.  
  902. `|'
  903.      The corresponding lines differ, and they are either both complete
  904.      or both incomplete.
  905.  
  906. `<'
  907.      The files differ and only the first file contains the line.
  908.  
  909. `>'
  910.      The files differ and only the second file contains the line.
  911.  
  912. `('
  913.      Only the first file contains the line, but the difference is
  914.      ignored.
  915.  
  916. `)'
  917.      Only the second file contains the line, but the difference is
  918.      ignored.
  919.  
  920. `\'
  921.      The corresponding lines differ, and only the first line is
  922.      incomplete.
  923.  
  924. `/'
  925.      The corresponding lines differ, and only the second line is
  926.      incomplete.
  927.  
  928.    Normally, an output line is incomplete if and only if the lines that
  929. it contains are incomplete; *Note Incomplete Lines::.  However, when an
  930. output line represents two differing lines, one might be incomplete
  931. while the other is not.  In this case, the output line is complete, but
  932. its the gutter is marked `\' if the first line is incomplete, `/' if
  933. the second line is.
  934.  
  935.    Side by side format is sometimes easiest to read, but it has
  936. limitations.  It generates much wider output than usual, and truncates
  937. lines that are too long to fit.  Also, it relies on lining up output
  938. more heavily than usual, so its output looks particularly bad if you
  939. use varying width fonts, nonstandard tab stops, or nonprinting
  940. characters.
  941.  
  942.    You can use the `sdiff' command to interactively merge side by side
  943. differences.  *Note Interactive Merging::, for more information on
  944. merging files.
  945.  
  946. * Menu:
  947.  
  948. * Side by Side Format::        Controlling side by side output format.
  949. * Example Side by Side::    Sample side by side output.
  950.  
  951. 
  952. File: diff.info,  Node: Side by Side Format,  Next: Example Side by Side,  Up: Side by Side
  953.  
  954. Controlling Side by Side Format
  955. ===============================
  956.  
  957.    The `-y' or `--side-by-side' option selects side by side format.
  958. Because side by side output lines contain two input lines, they are
  959. wider than usual.  They are normally 130 columns, which can fit onto a
  960. traditional printer line.  You can set the length of output lines with
  961. the `-W COLUMNS' or `--width=COLUMNS' option.  The output line is split
  962. into two halves of equal length, separated by a small gutter to mark
  963. differences; the right half is aligned to a tab stop so that tabs line
  964. up.  Input lines that are too long to fit in half of an output line are
  965. truncated for output.
  966.  
  967.    The `--left-column' option prints only the left column of two common
  968. lines.  The `--suppress-common-lines' option suppresses common lines
  969. entirely.
  970.  
  971. 
  972. File: diff.info,  Node: Example Side by Side,  Prev: Side by Side Format,  Up: Side by Side
  973.  
  974. An Example of Side by Side Format
  975. ---------------------------------
  976.  
  977.    Here is the output of the command `diff -y -W 72 lao tzu' (*note
  978. Sample diff Input::., for the complete contents of the two files).
  979.  
  980.      The Way that can be told of is n   <
  981.      The name that can be named is no   <
  982.      The Nameless is the origin of He        The Nameless is the origin of He
  983.      The Named is the mother of all t   |    The named is the mother of all t
  984.                                         >
  985.      Therefore let there always be no        Therefore let there always be no
  986.        so we may see their subtlety,           so we may see their subtlety,
  987.      And let there always be being,          And let there always be being,
  988.        so we may see their outcome.            so we may see their outcome.
  989.      The two are the same,                   The two are the same,
  990.      But after they are produced,            But after they are produced,
  991.        they have different names.              they have different names.
  992.                                         >    They both may be called deep and
  993.                                         >    Deeper and more profound,
  994.                                         >    The door of all subtleties!
  995.  
  996. 
  997. File: diff.info,  Node: Scripts,  Next: If-then-else,  Prev: Side by Side,  Up: Output Formats
  998.  
  999. Making Edit Scripts
  1000. ===================
  1001.  
  1002.    Several output modes produce command scripts for editing FROM-FILE
  1003. to produce TO-FILE.
  1004.  
  1005. * Menu:
  1006.  
  1007. * ed Scripts::        Using `diff' to produce commands for `ed'.
  1008. * Forward ed::        Making forward `ed' scripts.
  1009. * RCS::            A special `diff' output format used by RCS.
  1010.  
  1011. 
  1012. File: diff.info,  Node: ed Scripts,  Next: Forward ed,  Up: Scripts
  1013.  
  1014. `ed' Scripts
  1015. ------------
  1016.  
  1017.    `diff' can produce commands that direct the `ed' text editor to
  1018. change the first file into the second file.  Long ago, this was the
  1019. only output mode that was suitable for editing one file into another
  1020. automatically; today, with `patch', it is almost obsolete.  Use the
  1021. `-e' or `--ed' option to select this output format.
  1022.  
  1023.    Like the normal format (*note Normal::.), this output format does not
  1024. show any context; unlike the normal format, it does not include the
  1025. information necessary to apply the diff in reverse (to produce the first
  1026. file if all you have is the second file and the diff).
  1027.  
  1028.    If the file `d' contains the output of `diff -e old new', then the
  1029. command `(cat d && echo w) | ed - old' edits `old' to make it a copy of
  1030. `new'.  More generally, if `d1', `d2', ..., `dN' contain the outputs of
  1031. `diff -e old new1', `diff -e new1 new2', ..., `diff -e newN-1 newN',
  1032. respectively, then the command `(cat d1 d2 ... dN && echo w) | ed -
  1033. old' edits `old' to make it a copy of `newN'.
  1034.  
  1035. * Menu:
  1036.  
  1037. * Detailed ed::        A detailed description of `ed' format.
  1038. * Example ed::        A sample `ed' script.
  1039.  
  1040. 
  1041. File: diff.info,  Node: Detailed ed,  Next: Example ed,  Up: ed Scripts
  1042.  
  1043. Detailed Description of `ed' Format
  1044. ...................................
  1045.  
  1046.    The `ed' output format consists of one or more hunks of differences.
  1047. The changes closest to the ends of the files come first so that
  1048. commands that change the number of lines do not affect how `ed'
  1049. interprets line numbers in succeeding commands.  `ed' format hunks look
  1050. like this:
  1051.  
  1052.      CHANGE-COMMAND
  1053.      TO-FILE-LINE
  1054.      TO-FILE-LINE...
  1055.      .
  1056.  
  1057.    Because `ed' uses a single period on a line to indicate the end of
  1058. input, GNU `diff' protects lines of changes that contain a single
  1059. period on a line by writing two periods instead, then writing a
  1060. subsequent `ed' command to change the two periods into one.  The `ed'
  1061. format cannot represent an incomplete line, so if the second file ends
  1062. in a changed incomplete line, `diff' reports an error and then pretends
  1063. that a newline was appended.
  1064.  
  1065.    There are three types of change commands.  Each consists of a line
  1066. number or comma-separated range of lines in the first file and a single
  1067. character indicating the kind of change to make.  All line numbers are
  1068. the original line numbers in the file.  The types of change commands
  1069. are:
  1070.  
  1071. `La'
  1072.      Add text from the second file after line L in the first file.  For
  1073.      example, `8a' means to add the following lines after line 8 of file
  1074.      1.
  1075.  
  1076. `Rc'
  1077.      Replace the lines in range R in the first file with the following
  1078.      lines.  Like a combined add and delete, but more compact.  For
  1079.      example, `5,7c' means change lines 5-7 of file 1 to read as the
  1080.      text file 2.
  1081.  
  1082. `Rd'
  1083.      Delete the lines in range R from the first file.  For example,
  1084.      `5,7d' means delete lines 5-7 of file 1.
  1085.  
  1086. 
  1087. File: diff.info,  Node: Example ed,  Prev: Detailed ed,  Up: ed Scripts
  1088.  
  1089. Example `ed' Script
  1090. ...................
  1091.  
  1092.    Here is the output of `diff -e lao tzu' (*note Sample diff Input::.,
  1093. for the complete contents of the two files):
  1094.  
  1095.      11a
  1096.      They both may be called deep and profound.
  1097.      Deeper and more profound,
  1098.      The door of all subtleties!
  1099.      .
  1100.      4c
  1101.      The named is the mother of all things.
  1102.      
  1103.      .
  1104.      1,2d
  1105.  
  1106. 
  1107. File: diff.info,  Node: Forward ed,  Next: RCS,  Prev: ed Scripts,  Up: Scripts
  1108.  
  1109. Forward `ed' Scripts
  1110. --------------------
  1111.  
  1112.    `diff' can produce output that is like an `ed' script, but with
  1113. hunks in forward (front to back) order.  The format of the commands is
  1114. also changed slightly: command characters precede the lines they
  1115. modify, spaces separate line numbers in ranges, and no attempt is made
  1116. to disambiguate hunk lines consisting of a single period.  Like `ed'
  1117. format, forward `ed' format cannot represent incomplete lines.
  1118.  
  1119.    Forward `ed' format is not very useful, because neither `ed' nor
  1120. `patch' can apply diffs in this format.  It exists mainly for
  1121. compatibility with older versions of `diff'.  Use the `-f' or
  1122. `--forward-ed' option to select it.
  1123.  
  1124. 
  1125. File: diff.info,  Node: RCS,  Prev: Forward ed,  Up: Scripts
  1126.  
  1127. RCS Scripts
  1128. -----------
  1129.  
  1130.    The RCS output format is designed specifically for use by the
  1131. Revision Control System, which is a set of free programs used for
  1132. organizing different versions and systems of files.  Use the `-n' or
  1133. `--rcs' option to select this output format.  It is like the forward
  1134. `ed' format (*note Forward ed::.), but it can represent arbitrary
  1135. changes to the contents of a file because it avoids the forward `ed'
  1136. format's problems with lines consisting of a single period and with
  1137. incomplete lines.  Instead of ending text sections with a line
  1138. consisting of a single period, each command specifies the number of
  1139. lines it affects; a combination of the `a' and `d' commands are used
  1140. instead of `c'.  Also, if the second file ends in a changed incomplete
  1141. line, then the output also ends in an incomplete line.
  1142.  
  1143.    Here is the output of `diff -n lao tzu' (*note Sample diff Input::.,
  1144. for the complete contents of the two files):
  1145.  
  1146.      d1 2
  1147.      d4 1
  1148.      a4 2
  1149.      The named is the mother of all things.
  1150.      
  1151.      a11 3
  1152.      They both may be called deep and profound.
  1153.      Deeper and more profound,
  1154.      The door of all subtleties!
  1155.  
  1156. 
  1157. File: diff.info,  Node: If-then-else,  Prev: Scripts,  Up: Output Formats
  1158.  
  1159. Merging Files with If-then-else
  1160. ===============================
  1161.  
  1162.    You can use `diff' to merge two files of C source code.  The output
  1163. of `diff' in this format contains all the lines of both files.  Lines
  1164. common to both files are output just once; the differing parts are
  1165. separated by the C preprocessor directives `#ifdef NAME' or `#ifndef
  1166. NAME', `#else', and `#endif'.  When compiling the output, you select
  1167. which version to use by either defining or leaving undefined the macro
  1168. NAME.
  1169.  
  1170.    To merge two files, use `diff' with the `-D NAME' or `--ifdef=NAME'
  1171. option.  The argument NAME is the C preprocessor identifier to use in
  1172. the `#ifdef' and `#ifndef' directives.
  1173.  
  1174.    For example, if you change an instance of `wait (&s)' to `waitpid
  1175. (-1, &s, 0)' and then merge the old and new files with the
  1176. `--ifdef=HAVE_WAITPID' option, then the affected part of your code
  1177. might look like this:
  1178.  
  1179.          do {
  1180.      #ifndef HAVE_WAITPID
  1181.              if ((w = wait (&s)) < 0  &&  errno != EINTR)
  1182.      #else /* HAVE_WAITPID */
  1183.              if ((w = waitpid (-1, &s, 0)) < 0  &&  errno != EINTR)
  1184.      #endif /* HAVE_WAITPID */
  1185.                  return w;
  1186.          } while (w != child);
  1187.  
  1188.    You can specify formats for languages other than C by using line
  1189. group formats and line formats, as described in the next sections.
  1190.  
  1191. * Menu:
  1192.  
  1193. * Line Group Formats::        Formats for general if-then-else line groups.
  1194. * Line Formats::        Formats for each line in a line group.
  1195. * Detailed If-then-else::    A detailed description of if-then-else format.
  1196. * Example If-then-else::    Sample if-then-else format output.
  1197.  
  1198.