home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 11 Util
/
11-Util.zip
/
DIFFPT.ZIP
/
PATCHFMT.DIF
< prev
next >
Wrap
Text File
|
1991-07-01
|
5KB
|
180 lines
Index: analyze.c
***************
*** 751,755 ****
{
setup_output (files[0].name, files[1].name, depth);
! if (output_style == OUTPUT_CONTEXT)
print_context_header (files);
--- 751,755 ----
{
setup_output (files[0].name, files[1].name, depth);
! if (output_style == OUTPUT_CONTEXT || output_patch_flag)
print_context_header (files);
Index: context.c
***************
*** 38,45 ****
struct file_data *inf;
{
! fprintf (outfile, "*** %s\t%s", inf[0].name,
ctime (&inf[0].stat.st_mtime));
! fprintf (outfile, "--- %s\t%s", inf[1].name,
ctime (&inf[1].stat.st_mtime));
}
--- 39,57 ----
struct file_data *inf;
{
! if (output_patch_flag)
! {
! char *cp = strlen (inf[0].name) <= strlen (inf[1].name)
! ? inf[0].name : inf[1].name;
! if (cp[0] == '.' && cp[1] == '/')
! cp += 2;
! fprintf (outfile, "Index: %s\n", cp);
! }
! else
! {
! fprintf (outfile, "*** %s\t%s", inf[0].name,
ctime (&inf[0].stat.st_mtime));
! fprintf (outfile, "--- %s\t%s", inf[1].name,
ctime (&inf[1].stat.st_mtime));
+ }
}
Index: diff.c
***************
*** 96,99 ****
--- 96,100 ----
{"expand-tabs", 0, 0, 't'},
{"ignore-all-space", 0, 0, 'w'},
+ {"patch", 0, 0, 'P'},
{"version", 0, 0, 'v'},
{0, 0, 0, 0}
***************
*** 133,136 ****
--- 135,139 ----
ifdef_string = NULL;
heuristic = FALSE;
+ output_patch_flag = 0;
dir_start_file = NULL;
msg_chain = NULL;
***************
*** 141,145 ****
while ((c = getopt_long (argc, argv,
! "0123456789abBcC:dD:efF:hHiI:lnNpqrsS:tTvw",
longopts, &longind)) != EOF)
{
--- 145,149 ----
while ((c = getopt_long (argc, argv,
! "0123456789abBcC:dD:efF:hHiI:lnNpPqrsS:tTvw",
longopts, &longind)) != EOF)
{
***************
*** 284,287 ****
--- 288,295 ----
break;
+ case 'P':
+ output_patch_flag = 1;
+ break;
+
case 'q':
no_details_flag = 1;
***************
*** 378,382 ****
{
fprintf (stderr, "\
! Usage: diff [-#] [-abBcdefhHilnNprstTvw] [-C lines] [-F regexp] [-I regexp]\n\
[-S file] [-D symbol] [+ignore-blank-lines] [+context[=lines]]\n\
[+ifdef symbol] [+show-function-line regexp] [+speed-large-files]\n");
--- 397,401 ----
{
fprintf (stderr, "\
! Usage: diff [-#] [-abBcdefhHilnNpPrstTvw] [-C lines] [-F regexp] [-I regexp]\n\
[-S file] [-D symbol] [+ignore-blank-lines] [+context[=lines]]\n\
[+ifdef symbol] [+show-function-line regexp] [+speed-large-files]\n");
***************
*** 388,392 ****
[+rcs] [+show-c-function] [+binary] [+brief] [+recursive]\n\
[+report-identical-files] [+expand-tabs] [+ignore-all-space]\n\
! [+version] path1 path2\n");
exit (1);
}
--- 407,411 ----
[+rcs] [+show-c-function] [+binary] [+brief] [+recursive]\n\
[+report-identical-files] [+expand-tabs] [+ignore-all-space]\n\
! [+patch] [+version] path1 path2\n");
exit (1);
}
***************
*** 429,433 ****
char *name = name0 == 0 ? name1 : name0;
char *dir = name0 == 0 ? dir1 : dir0;
! message ("Only in %s: %s\n", dir, name);
/* Return 1 so that diff_dirs will return 1 ("some files differ"). */
return 1;
--- 448,453 ----
char *name = name0 == 0 ? name1 : name0;
char *dir = name0 == 0 ? dir1 : dir0;
! if (!output_patch_flag)
! message ("Only in %s: %s\n", dir, name);
/* Return 1 so that diff_dirs will return 1 ("some files differ"). */
return 1;
***************
*** 535,539 ****
/* But don't compare dir contents one level down
unless -r was specified. */
! message ("Common subdirectories: %s and %s\n",
inf[0].name, inf[1].name);
val = 0;
--- 555,560 ----
/* But don't compare dir contents one level down
unless -r was specified. */
! if (!output_patch_flag)
! message ("Common subdirectories: %s and %s\n",
inf[0].name, inf[1].name);
val = 0;
***************
*** 601,605 ****
{
char *dir = (inf[0].desc == -1) ? dir1 : dir0;
! message ("Only in %s: %s\n", dir, name0);
val = 1;
}
--- 622,627 ----
{
char *dir = (inf[0].desc == -1) ? dir1 : dir0;
! if (!output_patch_flag)
! message ("Only in %s: %s\n", dir, name0);
val = 1;
}
Index: diff.h
***************
*** 185,188 ****
--- 185,191 ----
EXTERN int heuristic;
+ /* Reduce extraneous output when they're outputting a patch. */
+ EXTERN int output_patch_flag;
+
/* Name of program the user invoked (for error messages). */
EXTERN char * program;
Index: util.c
***************
*** 170,174 ****
/* If handling multiple files (because scanning a directory),
print which files the following output is about. */
! if (depth > 0)
printf ("%s\n", name);
}
--- 170,174 ----
/* If handling multiple files (because scanning a directory),
print which files the following output is about. */
! if (depth > 0 && !output_patch_flag)
printf ("%s\n", name);
}