home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / gnu / utils / bug / 2037 < prev    next >
Encoding:
Text File  |  1992-11-11  |  5.3 KB  |  153 lines

  1. Newsgroups: gnu.utils.bug
  2. Path: sparky!uunet!convex!linac!pacific.mps.ohio-state.edu!cis.ohio-state.edu!talisman.kaleida.com!conklin
  3. From: conklin@talisman.kaleida.com (J.T. Conklin)
  4. Subject: GNU diff `-U LINES' wanted
  5. Message-ID: <9211112159.AA13343@talisman.kaleida.com>
  6. Sender: gnulists@ai.mit.edu
  7. Reply-To: conklin@kaleida.com
  8. Organization: GNUs Not Usenet
  9. References: conklin@talisman.kaleida.com (J.T. Conklin)
  10. Distribution: gnu
  11. Date: Wed, 11 Nov 1992 21:59:53 GMT
  12. Approved: bug-gnu-utils@prep.ai.mit.edu
  13. Lines: 138
  14.  
  15. >>>>> pinard@icule.UUCP (Francois Pinard) writes:
  16. Francois> In GNU diff 2.0 documentation, -LINES is declared to be
  17. Francois> obsolescent.  Let me suggest implementing a new `-U LINES'
  18. Francois> meaning `--unified=LINES' to parallel the fact that `-C
  19. Francois> LINES' means `--context=LINES'.  One should not ought to
  20. Francois> recourse to full option names nor obsolescent features just
  21. Francois> for specifying a number of context lines for unidiffs.
  22.  
  23. I liked this idea so much, I added to my copy of diff.  If you haven't
  24. done this yourself, here is a patch containing the code and texinfo
  25. changes.
  26.  
  27.     --jtc
  28.  
  29. diff -c diff/ChangeLog:1.1.1.1 diff/ChangeLog:1.2
  30. *** diff/ChangeLog:1.1.1.1    Tue Nov 10 17:08:40 1992
  31. --- diff/ChangeLog    Tue Nov 10 17:08:41 1992
  32. ***************
  33. *** 1,3 ****
  34. --- 1,9 ----
  35. + Fri Nov  6 12:11:05 1992  J.T. Conklin  (conklin@talisman.kaleida.com)
  36. +     * diff.c (main): Allow -U.
  37. +     (usage): Document -U.
  38. +     diff.texi: Document -U.
  39. +     
  40.   Tue Sep 15 14:27:25 1992  David J. MacKenzie  (djm@nutrimat.gnu.ai.mit.edu)
  41.   
  42.       * Version 2.0.
  43. diff -c diff/diff.c:1.1.1.1 diff/diff.c:1.2
  44. *** diff/diff.c:1.1.1.1    Tue Nov 10 17:08:41 1992
  45. --- diff/diff.c    Tue Nov 10 17:08:41 1992
  46. ***************
  47. *** 243,249 ****
  48.     /* Decode the options.  */
  49.   
  50.     while ((c = getopt_long (argc, argv,
  51. !                "0123456789abBcC:dD:efF:hHiI:lL:nNpPqrsS:tTuvwW:x:X:y",
  52.                  longopts, (int *)0)) != EOF)
  53.       {
  54.         switch (c)
  55. --- 243,249 ----
  56.     /* Decode the options.  */
  57.   
  58.     while ((c = getopt_long (argc, argv,
  59. !                "0123456789abBcC:dD:efF:hHiI:lL:nNpPqrsS:tTuU:vwW:x:X:y",
  60.                  longopts, (int *)0)) != EOF)
  61.       {
  62.         switch (c)
  63. ***************
  64. *** 287,292 ****
  65. --- 287,293 ----
  66.         break;
  67.   
  68.       case 'C':
  69. +     case 'U':
  70.       case 129:        /* +context[=lines] */
  71.       case 130:        /* +unified[=lines] */
  72.         if (optarg)
  73. ***************
  74. *** 300,307 ****
  75.   
  76.         /* Falls through.  */
  77.       case 'c':
  78. !       /* Make context-style output.  */
  79. !       specify_style (c == 130 ? OUTPUT_UNIFIED : OUTPUT_CONTEXT);
  80.         break;
  81.   
  82.       case 'd':
  83. --- 301,311 ----
  84.   
  85.         /* Falls through.  */
  86.       case 'c':
  87. !     case 'u':
  88. !       /* context diffs are more common then unified diffs, so we
  89. !          test against the context diff flags first */
  90. !       specify_style ((c == 'c' || c == 'C' || c == 129)
  91. !              ? OUTPUT_CONTEXT : OUTPUT_UNIFIED);
  92.         break;
  93.   
  94.       case 'd':
  95. ***************
  96. *** 432,442 ****
  97.         tab_align_flag = 1;
  98.         break;
  99.   
  100. -     case 'u':
  101. -       /* Output the context diff in unidiff format.  */
  102. -       specify_style (OUTPUT_UNIFIED);
  103. -       break;
  104.       case 'v':
  105.         fprintf (stderr, "GNU diff version %s\n", version_string);
  106.         break;
  107. --- 436,441 ----
  108. ***************
  109. *** 560,566 ****
  110.     fprintf (stderr, "Usage: %s [options] from-file to-file\n", program);
  111.     fprintf (stderr, "Options:\n\
  112.          [-abBcdefhHilnNpPqrstTuvwy] [-C lines] [-D symbol] [-F regexp]\n\
  113. !        [-I regexp] [-L from-label [-L to-label]] [-S starting-file]\n\
  114.          [-W columns] [-x pattern] [-X pattern-file] [--exclude=pattern]\n\
  115.          [--exclude-from=pattern-file] [--ignore-blank-lines] [--context[=lines]]\n\
  116.          [--ifdef=symbol] [--show-function-line=regexp] [--speed-large-files]\n\
  117. --- 559,565 ----
  118.     fprintf (stderr, "Usage: %s [options] from-file to-file\n", program);
  119.     fprintf (stderr, "Options:\n\
  120.          [-abBcdefhHilnNpPqrstTuvwy] [-C lines] [-D symbol] [-F regexp]\n\
  121. !        [-I regexp] [-L from-label [-L to-label]] [-S starting-file] [-U lines]\n\
  122.          [-W columns] [-x pattern] [-X pattern-file] [--exclude=pattern]\n\
  123.          [--exclude-from=pattern-file] [--ignore-blank-lines] [--context[=lines]]\n\
  124.          [--ifdef=symbol] [--show-function-line=regexp] [--speed-large-files]\n\
  125. diff -c diff/diff.texi:1.1.1.1 diff/diff.texi:1.2
  126. *** diff/diff.texi:1.1.1.1    Tue Nov 10 17:08:42 1992
  127. --- diff/diff.texi    Tue Nov 10 17:08:42 1992
  128. ***************
  129. *** 756,764 ****
  130.   
  131.   The unified output format is a variation on the context format that is
  132.   more compact because it omits redundant context lines.  To select this
  133. ! output format, use the @samp{-u} or @samp{--unified@r{[}=@var{lines}@r{]}}
  134. ! option.  The argument @var{lines} is the number of lines of context to
  135. ! show.  When it is not given, it defaults to three.
  136.   
  137.   At present, only GNU @code{diff} can produce this format and only GNU
  138.   @code{patch} can automatically apply diffs in this format.
  139. --- 756,765 ----
  140.   
  141.   The unified output format is a variation on the context format that is
  142.   more compact because it omits redundant context lines.  To select this
  143. ! output format, use the @samp{-U @var{lines}},
  144. ! @samp{--unified@r{[}=@var{lines}@r{]}}, or @samp{-u} option.  The
  145. ! argument @var{lines} is the number of lines of context to show.  When it
  146. ! is not given, it defaults to three.
  147.   
  148.   At present, only GNU @code{diff} can produce this format and only GNU
  149.   @code{patch} can automatically apply diffs in this format.
  150.  
  151.