This should improve performance when doing recursive comparisons.
Currently there is no attempt to avoid file descriptor exhaustion,
just as previously there is no attempt to avoid file names
that provoke ENAMETOOLONG. Because of this change, ‘diff - A/B’
now works correctly when standard input is a directory.
* .gitignore: Add lib/dirent.h.
* bootstrap.conf (gnulib_modules): Add fdopendir.
* src/diff.c (main): Initialize noparent’s desc to AT_FDCWD.
(compare_files): Use fstatat with parent directory’s file
descriptor and relative name, instead of lstat or stat.
Likewise for openat and open.
* src/diff.h (struct file_data): New member ‘dirstream’.
(struct comparison): The ‘parent’ member is now &noparent (instead
of null) if there is no parent. All uses changed.
(curr): New toplevel variable, replacing ‘files’. All uses changed.
* src/dir.c: Include dirname.h, for last_component.
(dir_read): New arg PARENTDIRFD. Arg DIR is no longer
pointer-to-const since DIR->desc and DIR->dirstream are now
updated. Use PARENTDIRFD to open the directory via
opendat+fdopendir instead of via opendir. Update new dirstream
component instead of closing the directory, since it’s now the
caller’s responsibility to close the directory because callers now
want the file descriptor. All callers changed.
(diff_dirs): First arg CMP is no longer pointer-to-const since
CMP->file is updated by dir_read. All callers changed.
(find_dir_file_pathname): First arg is now struct file_data *,
not merely a file name. All callers changed.
* tests/stdin: Test new behavior when stdin is a directory.
Prefer C11-style char32_t to wchar_t, as char32_t works better on
platforms where wchar_t is only 16 bits.
* .gitignore: Add lib/uchar.h.
* bootstrap.conf (gnulib_modules): Add c32width, mbrtoc32.
Remove mbrtowc. Sort.
* src/side.c: Include uchar.h instead of wchar.h.
(print_half_line): Use c32width and mbrtowc instead of
wcwidth and mbrtowc.
* .gitignore: Remove lib/unused-parameter.h. Add all of m4, since
no files there need to be committed; this lets us remove
m4/.gitignore and m4/gnulib-cache.m4. Add *.orig, *.patch, .Tpo,
/*.diff, lib/*/ (which lets us remove /lib/sys/), lib/ctype.h,
lib/errno.h, lib/float.h, lib/fnmatch.h, lib/getopt-cdefs.h,
lib/getopt.h, lib/limits.h, lib/sigsegv.h, lib/stdalign.h,
lib/stdarg.h, lib/stdbool.h, lib/stddef.h, lib/stdint.h,
lib/stdopen.[ch], vc-dwim-log-*. Add slashes to autom4te.cache,
build-aux. Remove redundant initial slashes from patterns that
also have internal slashes. Remove plain ABOUT-NLS, since
/ABOUT-NLS suffices. Sort using LC_ALL=C.
* src/Makefile.am: Generate version.c and version.h and put the
new symbol in a tiny library to be used by each program.
(LDADD): Add the new library.
* src/cmp.c (main): Use Version, not PACKAGE_VERSION, so the .o
file does not change with each commit-derived version increment.
* src/diff.c (main): Likewise.
* src/diff3.c (main): Likewise.
* src/sdiff.c (main): Likewise.
* src/system.h: Include "version.h".
* .gitignore: Add version.[ch]
This makes the .texi basename the same as the package name,
which is consistent with most other GNU packages.
* doc/diffutils.texi: Rename from...
* doc/diff.texi: ...removed.
* doc/Makefile.am (info_TEXINFOS): Reflect name change.
(diffutils_TEXINFOS): Likewise.
* cfg.mk (gendocs_options_): Remove this customization. It is no
longer needed, now that the .texi name matches that of the package.
* man/Makefile.am ($(dist_man1_MANS)): Remove now-unnecessary sed
filter.
* README: Update references to diffutils.texi etc. here, too.
* .gitignore: Update here, too.
Suggested by Karl Berry.
* bootstrap.conf (gnulib_modules): Add readme-release.
(bootstrap_epilogue): Add the recommended perl one-liner.
* README-release: Remove file; it is now generated from gnulib.
* .gitignore: Add it.