home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / DIFFPT.ZIP / PATCHFMT.DIF < prev    next >
Text File  |  1991-07-01  |  5KB  |  180 lines

  1. Index: analyze.c
  2. ***************
  3. *** 751,755 ****
  4.       {
  5.         setup_output (files[0].name, files[1].name, depth);
  6. !       if (output_style == OUTPUT_CONTEXT)
  7.       print_context_header (files);
  8.   
  9. --- 751,755 ----
  10.       {
  11.         setup_output (files[0].name, files[1].name, depth);
  12. !       if (output_style == OUTPUT_CONTEXT || output_patch_flag)
  13.       print_context_header (files);
  14.   
  15. Index: context.c
  16. ***************
  17. *** 38,45 ****
  18.        struct file_data *inf;
  19.   {
  20. !   fprintf (outfile, "*** %s\t%s", inf[0].name,
  21.          ctime (&inf[0].stat.st_mtime));
  22. !   fprintf (outfile, "--- %s\t%s", inf[1].name,
  23.          ctime (&inf[1].stat.st_mtime));
  24.   }
  25.   
  26. --- 39,57 ----
  27.        struct file_data *inf;
  28.   {
  29. !   if (output_patch_flag)
  30. !     {
  31. !       char *cp = strlen (inf[0].name) <= strlen (inf[1].name)
  32. !         ? inf[0].name : inf[1].name;
  33. !       if (cp[0] == '.' && cp[1] == '/')
  34. !     cp += 2;
  35. !       fprintf (outfile, "Index: %s\n", cp);
  36. !     }
  37. !   else
  38. !     {
  39. !       fprintf (outfile, "*** %s\t%s", inf[0].name,
  40.          ctime (&inf[0].stat.st_mtime));
  41. !       fprintf (outfile, "--- %s\t%s", inf[1].name,
  42.          ctime (&inf[1].stat.st_mtime));
  43. +     }
  44.   }
  45.   
  46. Index: diff.c
  47. ***************
  48. *** 96,99 ****
  49. --- 96,100 ----
  50.     {"expand-tabs", 0, 0, 't'},
  51.     {"ignore-all-space", 0, 0, 'w'},
  52. +   {"patch", 0, 0, 'P'},
  53.     {"version", 0, 0, 'v'},
  54.     {0, 0, 0, 0}
  55. ***************
  56. *** 133,136 ****
  57. --- 135,139 ----
  58.     ifdef_string = NULL;
  59.     heuristic = FALSE;
  60. +   output_patch_flag = 0;
  61.     dir_start_file = NULL;
  62.     msg_chain = NULL;
  63. ***************
  64. *** 141,145 ****
  65.   
  66.     while ((c = getopt_long (argc, argv,
  67. !                "0123456789abBcC:dD:efF:hHiI:lnNpqrsS:tTvw",
  68.                  longopts, &longind)) != EOF)
  69.       {
  70. --- 145,149 ----
  71.   
  72.     while ((c = getopt_long (argc, argv,
  73. !                "0123456789abBcC:dD:efF:hHiI:lnNpPqrsS:tTvw",
  74.                  longopts, &longind)) != EOF)
  75.       {
  76. ***************
  77. *** 284,287 ****
  78. --- 288,295 ----
  79.         break;
  80.   
  81. +     case 'P':
  82. +       output_patch_flag = 1;
  83. +       break;
  84.       case 'q':
  85.         no_details_flag = 1;
  86. ***************
  87. *** 378,382 ****
  88.   {
  89.     fprintf (stderr, "\
  90. ! Usage: diff [-#] [-abBcdefhHilnNprstTvw] [-C lines] [-F regexp] [-I regexp]\n\
  91.          [-S file] [-D symbol] [+ignore-blank-lines] [+context[=lines]]\n\
  92.          [+ifdef symbol] [+show-function-line regexp] [+speed-large-files]\n");
  93. --- 397,401 ----
  94.   {
  95.     fprintf (stderr, "\
  96. ! Usage: diff [-#] [-abBcdefhHilnNpPrstTvw] [-C lines] [-F regexp] [-I regexp]\n\
  97.          [-S file] [-D symbol] [+ignore-blank-lines] [+context[=lines]]\n\
  98.          [+ifdef symbol] [+show-function-line regexp] [+speed-large-files]\n");
  99. ***************
  100. *** 388,392 ****
  101.          [+rcs] [+show-c-function] [+binary] [+brief] [+recursive]\n\
  102.          [+report-identical-files] [+expand-tabs] [+ignore-all-space]\n\
  103. !        [+version] path1 path2\n");
  104.     exit (1);
  105.   }
  106. --- 407,411 ----
  107.          [+rcs] [+show-c-function] [+binary] [+brief] [+recursive]\n\
  108.          [+report-identical-files] [+expand-tabs] [+ignore-all-space]\n\
  109. !        [+patch] [+version] path1 path2\n");
  110.     exit (1);
  111.   }
  112. ***************
  113. *** 429,433 ****
  114.         char *name = name0 == 0 ? name1 : name0;
  115.         char *dir = name0 == 0 ? dir1 : dir0;
  116. !       message ("Only in %s: %s\n", dir, name);
  117.         /* Return 1 so that diff_dirs will return 1 ("some files differ").  */
  118.         return 1;
  119. --- 448,453 ----
  120.         char *name = name0 == 0 ? name1 : name0;
  121.         char *dir = name0 == 0 ? dir1 : dir0;
  122. !       if (!output_patch_flag)
  123. !     message ("Only in %s: %s\n", dir, name);
  124.         /* Return 1 so that diff_dirs will return 1 ("some files differ").  */
  125.         return 1;
  126. ***************
  127. *** 535,539 ****
  128.         /* But don't compare dir contents one level down
  129.            unless -r was specified.  */
  130. !       message ("Common subdirectories: %s and %s\n",
  131.              inf[0].name, inf[1].name);
  132.         val = 0;
  133. --- 555,560 ----
  134.         /* But don't compare dir contents one level down
  135.            unless -r was specified.  */
  136. !       if (!output_patch_flag)
  137. !         message ("Common subdirectories: %s and %s\n",
  138.              inf[0].name, inf[1].name);
  139.         val = 0;
  140. ***************
  141. *** 601,605 ****
  142.           {
  143.             char *dir = (inf[0].desc == -1) ? dir1 : dir0;
  144. !           message ("Only in %s: %s\n", dir, name0);
  145.             val = 1;
  146.           }
  147. --- 622,627 ----
  148.           {
  149.             char *dir = (inf[0].desc == -1) ? dir1 : dir0;
  150. !           if (!output_patch_flag)
  151. !         message ("Only in %s: %s\n", dir, name0);
  152.             val = 1;
  153.           }
  154. Index: diff.h
  155. ***************
  156. *** 185,188 ****
  157. --- 185,191 ----
  158.   EXTERN int    heuristic;
  159.   
  160. + /* Reduce extraneous output when they're outputting a patch. */
  161. + EXTERN int    output_patch_flag;
  162.   /* Name of program the user invoked (for error messages).  */
  163.   EXTERN char *    program;
  164. Index: util.c
  165. ***************
  166. *** 170,174 ****
  167.         /* If handling multiple files (because scanning a directory),
  168.        print which files the following output is about.  */
  169. !       if (depth > 0)
  170.       printf ("%s\n", name);
  171.       }
  172. --- 170,174 ----
  173.         /* If handling multiple files (because scanning a directory),
  174.        print which files the following output is about.  */
  175. !       if (depth > 0 && !output_patch_flag)
  176.       printf ("%s\n", name);
  177.       }
  178.