diff --ignore-new-file -ur diffutils-2.7/diff.c diffutils-2.7-new/diff.c --- diffutils-2.7/diff.c Thu Sep 22 11:47:00 1994 +++ diffutils-2.7-new/diff.c Fri Feb 8 17:15:33 2002 @@ -221,6 +221,7 @@ {"horizon-lines", 1, 0, 140}, {"help", 0, 0, 141}, {"binary", 0, 0, 142}, + {"ignore-new-file", 0, 0, 143 }, {0, 0, 0, 0} }; @@ -560,6 +561,10 @@ #endif break; + case 143: + ignore_new_file_flag = 1; + break; + default: try_help (0); } @@ -569,6 +574,12 @@ if (argc - optind != 2) try_help (argc - optind < 2 ? "missing operand" : "extra operand"); + if(ignore_new_file_flag && (entire_new_file_flag + || unidirectional_new_file_flag)) + { + fatal ("conflicting treatment of absent files"); + } + { /* @@ -730,6 +741,7 @@ "-r --recursive Recursively compare any subdirectories found.", "-N --new-file Treat absent files as empty.", "-P --unidirectional-new-file Treat absent first files as empty.", +"--ignore-new-file Ignore absent files.", "-s --report-identical-files Report when two files are the same.", "-x PAT --exclude=PAT Exclude files that match PAT.", "-X FILE --exclude-from=FILE Exclude files that match any pattern in FILE.", @@ -853,9 +865,12 @@ || (unidirectional_new_file_flag && name1 != 0) || entire_new_file_flag)) { - char const *name = name0 == 0 ? name1 : name0; - char const *dir = name0 == 0 ? dir1 : dir0; - message ("Only in %s: %s\n", dir, name); + if(!ignore_new_file_flag) + { + char const *name = name0 == 0 ? name1 : name0; + char const *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; } @@ -1011,10 +1026,13 @@ val = diff_dirs (inf, compare_files, depth); else { - char const *dir = (inf[0].desc == -1) ? dir1 : dir0; - /* See Posix.2 section 4.17.6.1.1 for this format. */ - message ("Only in %s: %s\n", dir, name0); - val = 1; + if(!ignore_new_file_flag) + { + char const *dir = (inf[0].desc == -1) ? dir1 : dir0; + /* See Posix.2 section 4.17.6.1.1 for this format. */ + message ("Only in %s: %s\n", dir, name0); + } + val = 1; } } else diff --ignore-new-file -ur diffutils-2.7/diff.h diffutils-2.7-new/diff.h --- diffutils-2.7/diff.h Thu Sep 22 11:47:00 1994 +++ diffutils-2.7-new/diff.h Fri Feb 8 17:06:29 2002 @@ -134,6 +134,11 @@ Then `patch' would create the file with appropriate contents. */ EXTERN int unidirectional_new_file_flag; +/* If a file is new (appears in only one dir) + just ignore it. + Then `patch' wouldn't do anything with the appropriate contents. */ +EXTERN int ignore_new_file_flag; + /* Pipe each file's output through pr (-l). */ EXTERN int paginate_flag;