diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 11 | ||||
-rw-r--r-- | src/Makefile.in | 211 | ||||
-rw-r--r-- | src/analyze.c | 17 | ||||
-rw-r--r-- | src/cmp.c | 58 | ||||
-rw-r--r-- | src/context.c | 33 | ||||
-rw-r--r-- | src/die.h | 3 | ||||
-rw-r--r-- | src/diff.c | 206 | ||||
-rw-r--r-- | src/diff.h | 56 | ||||
-rw-r--r-- | src/diff3.c | 173 | ||||
-rw-r--r-- | src/dir.c | 19 | ||||
-rw-r--r-- | src/ed.c | 4 | ||||
-rw-r--r-- | src/ifdef.c | 20 | ||||
-rw-r--r-- | src/io.c | 48 | ||||
-rw-r--r-- | src/normal.c | 2 | ||||
-rw-r--r-- | src/sdiff.c | 78 | ||||
-rw-r--r-- | src/side.c | 16 | ||||
-rw-r--r-- | src/system.h | 50 | ||||
-rw-r--r-- | src/util.c | 382 |
18 files changed, 796 insertions, 591 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index d27a54d..3364a00 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,6 +1,6 @@ # Automakefile for GNU diffutils programs. -# Copyright (C) 2001-2002, 2006, 2009-2013, 2015-2021 Free Software Foundation, +# Copyright (C) 2001-2002, 2006, 2009-2013, 2015-2023 Free Software Foundation, # Inc. # This program is free software: you can redistribute it and/or modify @@ -30,11 +30,16 @@ LDADD = \ $(LIBINTL) \ $(LIBICONV) \ $(LIBSIGSEGV) \ - $(LIB_CLOCK_GETTIME) + $(LIBTHREAD) \ + $(LIBUNISTRING) \ + $(CLOCK_TIME_LIB) \ + $(HARD_LOCALE_LIB) \ + $(MBRTOWC_LIB) \ + $(SETLOCALE_NULL_LIB) diff_LDADD = $(LDADD) cmp_LDADD = $(LDADD) -sdiff_LDADD = $(LDADD) +sdiff_LDADD = $(LDADD) $(GETRANDOM_LIB) diff3_LDADD = $(LDADD) cmp_SOURCES = cmp.c diff --git a/src/Makefile.in b/src/Makefile.in index de31548..dcd32d8 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16d from Makefile.am. +# Makefile.in generated by automake 1.16i from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2021 Free Software Foundation, Inc. +# Copyright (C) 1994-2023 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -16,7 +16,7 @@ # Automakefile for GNU diffutils programs. -# Copyright (C) 2001-2002, 2006, 2009-2013, 2015-2021 Free Software Foundation, +# Copyright (C) 2001-2002, 2006, 2009-2013, 2015-2023 Free Software Foundation, # Inc. # This program is free software: you can redistribute it and/or modify @@ -90,6 +90,8 @@ am__make_running_with_option = \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +am__rm_f = rm -f $(am__rm_f_notfound) +am__rm_rf = rm -rf $(am__rm_f_notfound) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -116,19 +118,22 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \ $(top_srcdir)/m4/__inline.m4 \ $(top_srcdir)/m4/absolute-header.m4 $(top_srcdir)/m4/alloca.m4 \ $(top_srcdir)/m4/arpa_inet_h.m4 \ - $(top_srcdir)/m4/asm-underscore.m4 $(top_srcdir)/m4/atoll.m4 \ + $(top_srcdir)/m4/asm-underscore.m4 \ + $(top_srcdir)/m4/assert_h.m4 $(top_srcdir)/m4/atoll.m4 \ $(top_srcdir)/m4/btowc.m4 $(top_srcdir)/m4/builtin-expect.m4 \ - $(top_srcdir)/m4/c-stack.m4 $(top_srcdir)/m4/calloc.m4 \ - $(top_srcdir)/m4/clock_time.m4 $(top_srcdir)/m4/close.m4 \ - $(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/config-h.m4 \ - $(top_srcdir)/m4/ctype_h.m4 \ + $(top_srcdir)/m4/c-bool.m4 $(top_srcdir)/m4/c-stack.m4 \ + $(top_srcdir)/m4/calloc.m4 $(top_srcdir)/m4/clock_time.m4 \ + $(top_srcdir)/m4/close.m4 $(top_srcdir)/m4/codeset.m4 \ + $(top_srcdir)/m4/config-h.m4 $(top_srcdir)/m4/ctype_h.m4 \ $(top_srcdir)/m4/double-slash-root.m4 $(top_srcdir)/m4/dup2.m4 \ $(top_srcdir)/m4/eealloc.m4 $(top_srcdir)/m4/environ.m4 \ $(top_srcdir)/m4/errno_h.m4 $(top_srcdir)/m4/error.m4 \ - $(top_srcdir)/m4/exponentd.m4 $(top_srcdir)/m4/extensions.m4 \ - $(top_srcdir)/m4/extern-inline.m4 $(top_srcdir)/m4/fcntl-o.m4 \ - $(top_srcdir)/m4/fcntl.m4 $(top_srcdir)/m4/fcntl_h.m4 \ - $(top_srcdir)/m4/fdopen.m4 $(top_srcdir)/m4/filenamecat.m4 \ + $(top_srcdir)/m4/error_h.m4 $(top_srcdir)/m4/exponentd.m4 \ + $(top_srcdir)/m4/extensions.m4 \ + $(top_srcdir)/m4/extern-inline.m4 $(top_srcdir)/m4/fclose.m4 \ + $(top_srcdir)/m4/fcntl-o.m4 $(top_srcdir)/m4/fcntl.m4 \ + $(top_srcdir)/m4/fcntl_h.m4 $(top_srcdir)/m4/fdopen.m4 \ + $(top_srcdir)/m4/fflush.m4 $(top_srcdir)/m4/filenamecat.m4 \ $(top_srcdir)/m4/flexmember.m4 $(top_srcdir)/m4/float_h.m4 \ $(top_srcdir)/m4/fnmatch.m4 $(top_srcdir)/m4/fnmatch_h.m4 \ $(top_srcdir)/m4/fopen.m4 $(top_srcdir)/m4/fpieee.m4 \ @@ -144,15 +149,16 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \ $(top_srcdir)/m4/host-cpu-c-abi.m4 $(top_srcdir)/m4/iconv.m4 \ $(top_srcdir)/m4/iconv_h.m4 $(top_srcdir)/m4/iconv_open.m4 \ $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/inet_pton.m4 \ - $(top_srcdir)/m4/inline.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/intmax_t.m4 $(top_srcdir)/m4/inttostr.m4 \ - $(top_srcdir)/m4/inttypes.m4 $(top_srcdir)/m4/inttypes_h.m4 \ - $(top_srcdir)/m4/ioctl.m4 $(top_srcdir)/m4/isblank.m4 \ - $(top_srcdir)/m4/iswblank.m4 $(top_srcdir)/m4/iswdigit.m4 \ - $(top_srcdir)/m4/iswxdigit.m4 $(top_srcdir)/m4/langinfo_h.m4 \ - $(top_srcdir)/m4/largefile.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libsigsegv.m4 \ + $(top_srcdir)/m4/inline.m4 \ + $(top_srcdir)/m4/intl-thread-locale.m4 \ + $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intmax_t.m4 \ + $(top_srcdir)/m4/inttostr.m4 $(top_srcdir)/m4/inttypes.m4 \ + $(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/ioctl.m4 \ + $(top_srcdir)/m4/isblank.m4 $(top_srcdir)/m4/iswblank.m4 \ + $(top_srcdir)/m4/iswdigit.m4 $(top_srcdir)/m4/iswxdigit.m4 \ + $(top_srcdir)/m4/langinfo_h.m4 $(top_srcdir)/m4/largefile.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libsigsegv.m4 \ $(top_srcdir)/m4/libunistring-base.m4 \ $(top_srcdir)/m4/limits-h.m4 $(top_srcdir)/m4/localcharset.m4 \ $(top_srcdir)/m4/locale-fr.m4 $(top_srcdir)/m4/locale-ja.m4 \ @@ -174,11 +180,13 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \ $(top_srcdir)/m4/netinet_in_h.m4 \ $(top_srcdir)/m4/nl_langinfo.m4 $(top_srcdir)/m4/nls.m4 \ $(top_srcdir)/m4/nocrash.m4 $(top_srcdir)/m4/nstrftime.m4 \ - $(top_srcdir)/m4/off_t.m4 $(top_srcdir)/m4/open-cloexec.m4 \ + $(top_srcdir)/m4/nullptr.m4 $(top_srcdir)/m4/off_t.m4 \ + $(top_srcdir)/m4/open-cloexec.m4 \ $(top_srcdir)/m4/open-slash.m4 $(top_srcdir)/m4/open.m4 \ - $(top_srcdir)/m4/pathmax.m4 $(top_srcdir)/m4/perror.m4 \ - $(top_srcdir)/m4/pipe.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/printf.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/m4/pathmax.m4 $(top_srcdir)/m4/perl.m4 \ + $(top_srcdir)/m4/perror.m4 $(top_srcdir)/m4/pipe.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/printf.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/pselect.m4 \ $(top_srcdir)/m4/pthread-thread.m4 \ $(top_srcdir)/m4/pthread_h.m4 \ $(top_srcdir)/m4/pthread_rwlock_rdlock.m4 \ @@ -189,9 +197,8 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \ $(top_srcdir)/m4/reallocarray.m4 $(top_srcdir)/m4/regex.m4 \ $(top_srcdir)/m4/sched_h.m4 $(top_srcdir)/m4/select.m4 \ $(top_srcdir)/m4/setenv.m4 $(top_srcdir)/m4/setlocale_null.m4 \ - $(top_srcdir)/m4/sigaction.m4 $(top_srcdir)/m4/sigaltstack.m4 \ - $(top_srcdir)/m4/signal_h.m4 \ - $(top_srcdir)/m4/signalblocking.m4 \ + $(top_srcdir)/m4/sigaltstack.m4 $(top_srcdir)/m4/signal_h.m4 \ + $(top_srcdir)/m4/signalblocking.m4 $(top_srcdir)/m4/sigsegv.m4 \ $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/sleep.m4 \ $(top_srcdir)/m4/snprintf.m4 $(top_srcdir)/m4/socketlib.m4 \ $(top_srcdir)/m4/sockets.m4 $(top_srcdir)/m4/socklen.m4 \ @@ -199,9 +206,9 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \ $(top_srcdir)/m4/stack-direction.m4 \ $(top_srcdir)/m4/stat-time.m4 $(top_srcdir)/m4/stat.m4 \ $(top_srcdir)/m4/stdalign.m4 $(top_srcdir)/m4/stdarg.m4 \ - $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stddef_h.m4 \ - $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdint_h.m4 \ - $(top_srcdir)/m4/stdio_h.m4 $(top_srcdir)/m4/stdlib_h.m4 \ + $(top_srcdir)/m4/stddef_h.m4 $(top_srcdir)/m4/stdint.m4 \ + $(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/stdio_h.m4 \ + $(top_srcdir)/m4/stdlib_h.m4 $(top_srcdir)/m4/stpcpy.m4 \ $(top_srcdir)/m4/strcase.m4 $(top_srcdir)/m4/strerror.m4 \ $(top_srcdir)/m4/strerror_r.m4 $(top_srcdir)/m4/string_h.m4 \ $(top_srcdir)/m4/strings_h.m4 $(top_srcdir)/m4/strnlen.m4 \ @@ -215,12 +222,12 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \ $(top_srcdir)/m4/sys_types_h.m4 $(top_srcdir)/m4/sys_uio_h.m4 \ $(top_srcdir)/m4/sys_wait_h.m4 $(top_srcdir)/m4/tempname.m4 \ $(top_srcdir)/m4/thread.m4 $(top_srcdir)/m4/threadlib.m4 \ - $(top_srcdir)/m4/time_h.m4 $(top_srcdir)/m4/time_r.m4 \ - $(top_srcdir)/m4/time_rz.m4 $(top_srcdir)/m4/timegm.m4 \ - $(top_srcdir)/m4/timespec.m4 $(top_srcdir)/m4/tm_gmtoff.m4 \ - $(top_srcdir)/m4/tzset.m4 $(top_srcdir)/m4/unistd_h.m4 \ - $(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/vasnprintf.m4 \ - $(top_srcdir)/m4/vasprintf.m4 $(top_srcdir)/m4/version-etc.m4 \ + $(top_srcdir)/m4/time.m4 $(top_srcdir)/m4/time_h.m4 \ + $(top_srcdir)/m4/time_r.m4 $(top_srcdir)/m4/time_rz.m4 \ + $(top_srcdir)/m4/timegm.m4 $(top_srcdir)/m4/timespec.m4 \ + $(top_srcdir)/m4/tm_gmtoff.m4 $(top_srcdir)/m4/tzset.m4 \ + $(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/unlocked-io.m4 \ + $(top_srcdir)/m4/vasnprintf.m4 $(top_srcdir)/m4/version-etc.m4 \ $(top_srcdir)/m4/visibility.m4 $(top_srcdir)/m4/warn-on-use.m4 \ $(top_srcdir)/m4/warnings.m4 $(top_srcdir)/m4/wchar_h.m4 \ $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wcrtomb.m4 \ @@ -229,7 +236,6 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \ $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/wmemchr.m4 \ $(top_srcdir)/m4/wmempcpy.m4 $(top_srcdir)/m4/xalloc.m4 \ $(top_srcdir)/m4/xsize.m4 $(top_srcdir)/m4/xstrtol.m4 \ - $(top_srcdir)/m4/xvasprintf.m4 $(top_srcdir)/m4/year2038.m4 \ $(top_srcdir)/m4/zzgnulib.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) @@ -247,6 +253,7 @@ am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) am__v_AR_0 = @echo " AR " $@; am__v_AR_1 = libver_a_AR = $(AR) $(ARFLAGS) +libver_a_RANLIB = $(RANLIB) libver_a_LIBADD = nodist_libver_a_OBJECTS = version.$(OBJEXT) libver_a_OBJECTS = $(nodist_libver_a_OBJECTS) @@ -256,6 +263,8 @@ am__DEPENDENCIES_1 = am__DEPENDENCIES_2 = libver.a ../lib/libdiffutils.a \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) cmp_DEPENDENCIES = $(am__DEPENDENCIES_2) am_diff_OBJECTS = analyze.$(OBJEXT) context.$(OBJEXT) diff.$(OBJEXT) \ @@ -268,7 +277,7 @@ diff3_OBJECTS = $(am_diff3_OBJECTS) diff3_DEPENDENCIES = $(am__DEPENDENCIES_2) am_sdiff_OBJECTS = sdiff.$(OBJEXT) sdiff_OBJECTS = $(am_sdiff_OBJECTS) -sdiff_DEPENDENCIES = $(am__DEPENDENCIES_2) +sdiff_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false @@ -341,6 +350,7 @@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_UNIVERSAL_BUILD = @APPLE_UNIVERSAL_BUILD@ AR = @AR@ ARFLAGS = @ARFLAGS@ +ASSERT_H = @ASSERT_H@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -354,6 +364,7 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CFLAG_VISIBILITY = @CFLAG_VISIBILITY@ +CLOCK_TIME_LIB = @CLOCK_TIME_LIB@ CONFIG_INCLUDE = @CONFIG_INCLUDE@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ @@ -365,7 +376,6 @@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ -EGREP = @EGREP@ EMULTIHOP_HIDDEN = @EMULTIHOP_HIDDEN@ EMULTIHOP_VALUE = @EMULTIHOP_VALUE@ ENOLINK_HIDDEN = @ENOLINK_HIDDEN@ @@ -373,14 +383,17 @@ ENOLINK_VALUE = @ENOLINK_VALUE@ EOVERFLOW_HIDDEN = @EOVERFLOW_HIDDEN@ EOVERFLOW_VALUE = @EOVERFLOW_VALUE@ ERRNO_H = @ERRNO_H@ +ERROR_H = @ERROR_H@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FLOAT_H = @FLOAT_H@ FNMATCH_H = @FNMATCH_H@ GETOPT_CDEFS_H = @GETOPT_CDEFS_H@ GETOPT_H = @GETOPT_H@ +GETRANDOM_LIB = @GETRANDOM_LIB@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GL_CFLAG_ALLOW_WARNINGS = @GL_CFLAG_ALLOW_WARNINGS@ +GL_CFLAG_GNULIB_WARNINGS = @GL_CFLAG_GNULIB_WARNINGS@ GL_CXXFLAG_ALLOW_WARNINGS = @GL_CXXFLAG_ALLOW_WARNINGS@ GL_GNULIB_ACCEPT = @GL_GNULIB_ACCEPT@ GL_GNULIB_ACCEPT4 = @GL_GNULIB_ACCEPT4@ @@ -389,9 +402,11 @@ GL_GNULIB_ALIGNED_ALLOC = @GL_GNULIB_ALIGNED_ALLOC@ GL_GNULIB_ATOLL = @GL_GNULIB_ATOLL@ GL_GNULIB_BIND = @GL_GNULIB_BIND@ GL_GNULIB_BTOWC = @GL_GNULIB_BTOWC@ +GL_GNULIB_CALLOC_GNU = @GL_GNULIB_CALLOC_GNU@ GL_GNULIB_CALLOC_POSIX = @GL_GNULIB_CALLOC_POSIX@ GL_GNULIB_CANONICALIZE_FILE_NAME = @GL_GNULIB_CANONICALIZE_FILE_NAME@ GL_GNULIB_CHDIR = @GL_GNULIB_CHDIR@ +GL_GNULIB_CHMOD = @GL_GNULIB_CHMOD@ GL_GNULIB_CHOWN = @GL_GNULIB_CHOWN@ GL_GNULIB_CLOSE = @GL_GNULIB_CLOSE@ GL_GNULIB_CONNECT = @GL_GNULIB_CONNECT@ @@ -429,6 +444,7 @@ GL_GNULIB_FGETC = @GL_GNULIB_FGETC@ GL_GNULIB_FGETS = @GL_GNULIB_FGETS@ GL_GNULIB_FNMATCH = @GL_GNULIB_FNMATCH@ GL_GNULIB_FOPEN = @GL_GNULIB_FOPEN@ +GL_GNULIB_FOPEN_GNU = @GL_GNULIB_FOPEN_GNU@ GL_GNULIB_FPRINTF = @GL_GNULIB_FPRINTF@ GL_GNULIB_FPRINTF_POSIX = @GL_GNULIB_FPRINTF_POSIX@ GL_GNULIB_FPURGE = @GL_GNULIB_FPURGE@ @@ -464,7 +480,9 @@ GL_GNULIB_GETLOGIN_R = @GL_GNULIB_GETLOGIN_R@ GL_GNULIB_GETOPT_POSIX = @GL_GNULIB_GETOPT_POSIX@ GL_GNULIB_GETPAGESIZE = @GL_GNULIB_GETPAGESIZE@ GL_GNULIB_GETPASS = @GL_GNULIB_GETPASS@ +GL_GNULIB_GETPASS_GNU = @GL_GNULIB_GETPASS_GNU@ GL_GNULIB_GETPEERNAME = @GL_GNULIB_GETPEERNAME@ +GL_GNULIB_GETPROGNAME = @GL_GNULIB_GETPROGNAME@ GL_GNULIB_GETRANDOM = @GL_GNULIB_GETRANDOM@ GL_GNULIB_GETSOCKNAME = @GL_GNULIB_GETSOCKNAME@ GL_GNULIB_GETSOCKOPT = @GL_GNULIB_GETSOCKOPT@ @@ -496,6 +514,7 @@ GL_GNULIB_LOCALENAME = @GL_GNULIB_LOCALENAME@ GL_GNULIB_LOCALTIME = @GL_GNULIB_LOCALTIME@ GL_GNULIB_LSEEK = @GL_GNULIB_LSEEK@ GL_GNULIB_LSTAT = @GL_GNULIB_LSTAT@ +GL_GNULIB_MALLOC_GNU = @GL_GNULIB_MALLOC_GNU@ GL_GNULIB_MALLOC_POSIX = @GL_GNULIB_MALLOC_POSIX@ GL_GNULIB_MBRLEN = @GL_GNULIB_MBRLEN@ GL_GNULIB_MBRTOWC = @GL_GNULIB_MBRTOWC@ @@ -516,6 +535,7 @@ GL_GNULIB_MBSSEP = @GL_GNULIB_MBSSEP@ GL_GNULIB_MBSSPN = @GL_GNULIB_MBSSPN@ GL_GNULIB_MBSSTR = @GL_GNULIB_MBSSTR@ GL_GNULIB_MBSTOK_R = @GL_GNULIB_MBSTOK_R@ +GL_GNULIB_MBSTOWCS = @GL_GNULIB_MBSTOWCS@ GL_GNULIB_MBTOWC = @GL_GNULIB_MBTOWC@ GL_GNULIB_MDA_ACCESS = @GL_GNULIB_MDA_ACCESS@ GL_GNULIB_MDA_CHDIR = @GL_GNULIB_MDA_CHDIR@ @@ -562,6 +582,7 @@ GL_GNULIB_MEMCHR = @GL_GNULIB_MEMCHR@ GL_GNULIB_MEMMEM = @GL_GNULIB_MEMMEM@ GL_GNULIB_MEMPCPY = @GL_GNULIB_MEMPCPY@ GL_GNULIB_MEMRCHR = @GL_GNULIB_MEMRCHR@ +GL_GNULIB_MEMSET_EXPLICIT = @GL_GNULIB_MEMSET_EXPLICIT@ GL_GNULIB_MKDIR = @GL_GNULIB_MKDIR@ GL_GNULIB_MKDIRAT = @GL_GNULIB_MKDIRAT@ GL_GNULIB_MKDTEMP = @GL_GNULIB_MKDTEMP@ @@ -618,6 +639,7 @@ GL_GNULIB_READ = @GL_GNULIB_READ@ GL_GNULIB_READLINK = @GL_GNULIB_READLINK@ GL_GNULIB_READLINKAT = @GL_GNULIB_READLINKAT@ GL_GNULIB_REALLOCARRAY = @GL_GNULIB_REALLOCARRAY@ +GL_GNULIB_REALLOC_GNU = @GL_GNULIB_REALLOC_GNU@ GL_GNULIB_REALLOC_POSIX = @GL_GNULIB_REALLOC_POSIX@ GL_GNULIB_REALPATH = @GL_GNULIB_REALPATH@ GL_GNULIB_RECV = @GL_GNULIB_RECV@ @@ -681,8 +703,10 @@ GL_GNULIB_STRVERSCMP = @GL_GNULIB_STRVERSCMP@ GL_GNULIB_SYMLINK = @GL_GNULIB_SYMLINK@ GL_GNULIB_SYMLINKAT = @GL_GNULIB_SYMLINKAT@ GL_GNULIB_SYSTEM_POSIX = @GL_GNULIB_SYSTEM_POSIX@ +GL_GNULIB_TIME = @GL_GNULIB_TIME@ GL_GNULIB_TIMEGM = @GL_GNULIB_TIMEGM@ GL_GNULIB_TIMESPEC_GET = @GL_GNULIB_TIMESPEC_GET@ +GL_GNULIB_TIMESPEC_GETRES = @GL_GNULIB_TIMESPEC_GETRES@ GL_GNULIB_TIME_R = @GL_GNULIB_TIME_R@ GL_GNULIB_TIME_RZ = @GL_GNULIB_TIME_RZ@ GL_GNULIB_TMPFILE = @GL_GNULIB_TMPFILE@ @@ -756,6 +780,7 @@ GNULIBHEADERS_OVERRIDE_WINT_T = @GNULIBHEADERS_OVERRIDE_WINT_T@ GNULIB_GETTIMEOFDAY = @GNULIB_GETTIMEOFDAY@ GNULIB_WARN_CFLAGS = @GNULIB_WARN_CFLAGS@ GREP = @GREP@ +HARD_LOCALE_LIB = @HARD_LOCALE_LIB@ HAVE_ACCEPT4 = @HAVE_ACCEPT4@ HAVE_ALIGNED_ALLOC = @HAVE_ALIGNED_ALLOC@ HAVE_ALLOCA_H = @HAVE_ALLOCA_H@ @@ -786,6 +811,7 @@ HAVE_DECL_GETLOGIN = @HAVE_DECL_GETLOGIN@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@ HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@ +HAVE_DECL_GETW = @HAVE_DECL_GETW@ HAVE_DECL_IMAXABS = @HAVE_DECL_IMAXABS@ HAVE_DECL_IMAXDIV = @HAVE_DECL_IMAXDIV@ HAVE_DECL_INET_NTOP = @HAVE_DECL_INET_NTOP@ @@ -795,6 +821,8 @@ HAVE_DECL_LOCALTIME_R = @HAVE_DECL_LOCALTIME_R@ HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ HAVE_DECL_OBSTACK_PRINTF = @HAVE_DECL_OBSTACK_PRINTF@ +HAVE_DECL_PROGRAM_INVOCATION_NAME = @HAVE_DECL_PROGRAM_INVOCATION_NAME@ +HAVE_DECL_PUTW = @HAVE_DECL_PUTW@ HAVE_DECL_SETENV = @HAVE_DECL_SETENV@ HAVE_DECL_SETHOSTNAME = @HAVE_DECL_SETHOSTNAME@ HAVE_DECL_SETSTATE = @HAVE_DECL_SETSTATE@ @@ -818,6 +846,9 @@ HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@ HAVE_DPRINTF = @HAVE_DPRINTF@ HAVE_DUP3 = @HAVE_DUP3@ HAVE_DUPLOCALE = @HAVE_DUPLOCALE@ +HAVE_ERROR = @HAVE_ERROR@ +HAVE_ERROR_AT_LINE = @HAVE_ERROR_AT_LINE@ +HAVE_ERROR_H = @HAVE_ERROR_H@ HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ HAVE_EXECVPE = @HAVE_EXECVPE@ HAVE_EXPLICIT_BZERO = @HAVE_EXPLICIT_BZERO@ @@ -848,12 +879,15 @@ HAVE_GETLOGIN = @HAVE_GETLOGIN@ HAVE_GETOPT_H = @HAVE_GETOPT_H@ HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ HAVE_GETPASS = @HAVE_GETPASS@ +HAVE_GETPROGNAME = @HAVE_GETPROGNAME@ HAVE_GETRANDOM = @HAVE_GETRANDOM@ HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ HAVE_GETTIMEOFDAY = @HAVE_GETTIMEOFDAY@ HAVE_GETUMASK = @HAVE_GETUMASK@ HAVE_GRANTPT = @HAVE_GRANTPT@ HAVE_GROUP_MEMBER = @HAVE_GROUP_MEMBER@ +HAVE_IMAXABS = @HAVE_IMAXABS@ +HAVE_IMAXDIV = @HAVE_IMAXDIV@ HAVE_IMAXDIV_T = @HAVE_IMAXDIV_T@ HAVE_INITSTATE = @HAVE_INITSTATE@ HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ @@ -881,6 +915,7 @@ HAVE_MBSNRTOWCS = @HAVE_MBSNRTOWCS@ HAVE_MBSRTOWCS = @HAVE_MBSRTOWCS@ HAVE_MBTOWC = @HAVE_MBTOWC@ HAVE_MEMPCPY = @HAVE_MEMPCPY@ +HAVE_MEMSET_EXPLICIT = @HAVE_MEMSET_EXPLICIT@ HAVE_MKDIRAT = @HAVE_MKDIRAT@ HAVE_MKDTEMP = @HAVE_MKDTEMP@ HAVE_MKFIFO = @HAVE_MKFIFO@ @@ -1038,9 +1073,11 @@ HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ HAVE_SYS_UIO_H = @HAVE_SYS_UIO_H@ HAVE_TIMEGM = @HAVE_TIMEGM@ HAVE_TIMESPEC_GET = @HAVE_TIMESPEC_GET@ +HAVE_TIMESPEC_GETRES = @HAVE_TIMESPEC_GETRES@ HAVE_TIMEZONE_T = @HAVE_TIMEZONE_T@ HAVE_TYPE_VOLATILE_SIG_ATOMIC_T = @HAVE_TYPE_VOLATILE_SIG_ATOMIC_T@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ +HAVE_UNISTRING_WOE32DLL_H = @HAVE_UNISTRING_WOE32DLL_H@ HAVE_UNLINKAT = @HAVE_UNLINKAT@ HAVE_UNLOCKPT = @HAVE_UNLOCKPT@ HAVE_USLEEP = @HAVE_USLEEP@ @@ -1090,7 +1127,6 @@ HAVE_WMEMPCPY = @HAVE_WMEMPCPY@ HAVE_WMEMSET = @HAVE_WMEMSET@ HAVE_WS2TCPIP_H = @HAVE_WS2TCPIP_H@ HAVE_XLOCALE_H = @HAVE_XLOCALE_H@ -HAVE__BOOL = @HAVE__BOOL@ HAVE__EXIT = @HAVE__EXIT@ HELP2MAN = @HELP2MAN@ HOST_CPU = @HOST_CPU@ @@ -1156,15 +1192,20 @@ LTLIBOBJS = @LTLIBOBJS@ LTLIBSIGSEGV = @LTLIBSIGSEGV@ LTLIBTHREAD = @LTLIBTHREAD@ MAKEINFO = @MAKEINFO@ +MBRTOWC_LIB = @MBRTOWC_LIB@ MKDIR_P = @MKDIR_P@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ +NANOSLEEP_LIB = @NANOSLEEP_LIB@ NETINET_IN_H = @NETINET_IN_H@ NEXT_ARPA_INET_H = @NEXT_ARPA_INET_H@ +NEXT_ASSERT_H = @NEXT_ASSERT_H@ NEXT_AS_FIRST_DIRECTIVE_ARPA_INET_H = @NEXT_AS_FIRST_DIRECTIVE_ARPA_INET_H@ +NEXT_AS_FIRST_DIRECTIVE_ASSERT_H = @NEXT_AS_FIRST_DIRECTIVE_ASSERT_H@ NEXT_AS_FIRST_DIRECTIVE_CTYPE_H = @NEXT_AS_FIRST_DIRECTIVE_CTYPE_H@ NEXT_AS_FIRST_DIRECTIVE_ERRNO_H = @NEXT_AS_FIRST_DIRECTIVE_ERRNO_H@ +NEXT_AS_FIRST_DIRECTIVE_ERROR_H = @NEXT_AS_FIRST_DIRECTIVE_ERROR_H@ NEXT_AS_FIRST_DIRECTIVE_FCNTL_H = @NEXT_AS_FIRST_DIRECTIVE_FCNTL_H@ NEXT_AS_FIRST_DIRECTIVE_FLOAT_H = @NEXT_AS_FIRST_DIRECTIVE_FLOAT_H@ NEXT_AS_FIRST_DIRECTIVE_FNMATCH_H = @NEXT_AS_FIRST_DIRECTIVE_FNMATCH_H@ @@ -1200,6 +1241,7 @@ NEXT_AS_FIRST_DIRECTIVE_WCHAR_H = @NEXT_AS_FIRST_DIRECTIVE_WCHAR_H@ NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H = @NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H@ NEXT_CTYPE_H = @NEXT_CTYPE_H@ NEXT_ERRNO_H = @NEXT_ERRNO_H@ +NEXT_ERROR_H = @NEXT_ERROR_H@ NEXT_FCNTL_H = @NEXT_FCNTL_H@ NEXT_FLOAT_H = @NEXT_FLOAT_H@ NEXT_FNMATCH_H = @NEXT_FNMATCH_H@ @@ -1242,27 +1284,35 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ POSUB = @POSUB@ PRAGMA_COLUMNS = @PRAGMA_COLUMNS@ PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@ PRIPTR_PREFIX = @PRIPTR_PREFIX@ PR_PROGRAM = @PR_PROGRAM@ PTHREAD_H_DEFINES_STRUCT_TIMESPEC = @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@ +PTHREAD_SIGMASK_LIB = @PTHREAD_SIGMASK_LIB@ PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ RANLIB = @RANLIB@ REPLACE_ACCESS = @REPLACE_ACCESS@ REPLACE_ALIGNED_ALLOC = @REPLACE_ALIGNED_ALLOC@ REPLACE_BTOWC = @REPLACE_BTOWC@ -REPLACE_CALLOC = @REPLACE_CALLOC@ +REPLACE_CALLOC_FOR_CALLOC_GNU = @REPLACE_CALLOC_FOR_CALLOC_GNU@ +REPLACE_CALLOC_FOR_CALLOC_POSIX = @REPLACE_CALLOC_FOR_CALLOC_POSIX@ REPLACE_CANONICALIZE_FILE_NAME = @REPLACE_CANONICALIZE_FILE_NAME@ +REPLACE_CHMOD = @REPLACE_CHMOD@ REPLACE_CHOWN = @REPLACE_CHOWN@ REPLACE_CLOSE = @REPLACE_CLOSE@ +REPLACE_COPY_FILE_RANGE = @REPLACE_COPY_FILE_RANGE@ REPLACE_CREAT = @REPLACE_CREAT@ REPLACE_CTIME = @REPLACE_CTIME@ REPLACE_DPRINTF = @REPLACE_DPRINTF@ REPLACE_DUP = @REPLACE_DUP@ REPLACE_DUP2 = @REPLACE_DUP2@ +REPLACE_DUP3 = @REPLACE_DUP3@ REPLACE_DUPLOCALE = @REPLACE_DUPLOCALE@ +REPLACE_ERROR = @REPLACE_ERROR@ +REPLACE_ERROR_AT_LINE = @REPLACE_ERROR_AT_LINE@ REPLACE_EXECL = @REPLACE_EXECL@ REPLACE_EXECLE = @REPLACE_EXECLE@ REPLACE_EXECLP = @REPLACE_EXECLP@ @@ -1275,11 +1325,13 @@ REPLACE_FCHMODAT = @REPLACE_FCHMODAT@ REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@ REPLACE_FCLOSE = @REPLACE_FCLOSE@ REPLACE_FCNTL = @REPLACE_FCNTL@ +REPLACE_FDATASYNC = @REPLACE_FDATASYNC@ REPLACE_FDOPEN = @REPLACE_FDOPEN@ REPLACE_FFLUSH = @REPLACE_FFLUSH@ REPLACE_FFSLL = @REPLACE_FFSLL@ REPLACE_FNMATCH = @REPLACE_FNMATCH@ REPLACE_FOPEN = @REPLACE_FOPEN@ +REPLACE_FOPEN_FOR_FOPEN_GNU = @REPLACE_FOPEN_FOR_FOPEN_GNU@ REPLACE_FPRINTF = @REPLACE_FPRINTF@ REPLACE_FPURGE = @REPLACE_FPURGE@ REPLACE_FREE = @REPLACE_FREE@ @@ -1297,17 +1349,24 @@ REPLACE_GETCWD = @REPLACE_GETCWD@ REPLACE_GETDELIM = @REPLACE_GETDELIM@ REPLACE_GETDOMAINNAME = @REPLACE_GETDOMAINNAME@ REPLACE_GETDTABLESIZE = @REPLACE_GETDTABLESIZE@ +REPLACE_GETENTROPY = @REPLACE_GETENTROPY@ REPLACE_GETGROUPS = @REPLACE_GETGROUPS@ REPLACE_GETLINE = @REPLACE_GETLINE@ +REPLACE_GETLOADAVG = @REPLACE_GETLOADAVG@ REPLACE_GETLOGIN_R = @REPLACE_GETLOGIN_R@ REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ REPLACE_GETPASS = @REPLACE_GETPASS@ +REPLACE_GETPASS_FOR_GETPASS_GNU = @REPLACE_GETPASS_FOR_GETPASS_GNU@ +REPLACE_GETPROGNAME = @REPLACE_GETPROGNAME@ REPLACE_GETRANDOM = @REPLACE_GETRANDOM@ +REPLACE_GETSUBOPT = @REPLACE_GETSUBOPT@ REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@ REPLACE_GMTIME = @REPLACE_GMTIME@ REPLACE_ICONV = @REPLACE_ICONV@ REPLACE_ICONV_OPEN = @REPLACE_ICONV_OPEN@ REPLACE_ICONV_UTF = @REPLACE_ICONV_UTF@ +REPLACE_IMAXABS = @REPLACE_IMAXABS@ +REPLACE_IMAXDIV = @REPLACE_IMAXDIV@ REPLACE_INET_NTOP = @REPLACE_INET_NTOP@ REPLACE_INET_PTON = @REPLACE_INET_PTON@ REPLACE_INITSTATE = @REPLACE_INITSTATE@ @@ -1326,21 +1385,27 @@ REPLACE_LOCALTIME = @REPLACE_LOCALTIME@ REPLACE_LOCALTIME_R = @REPLACE_LOCALTIME_R@ REPLACE_LSEEK = @REPLACE_LSEEK@ REPLACE_LSTAT = @REPLACE_LSTAT@ -REPLACE_MALLOC = @REPLACE_MALLOC@ +REPLACE_MALLOC_FOR_MALLOC_GNU = @REPLACE_MALLOC_FOR_MALLOC_GNU@ +REPLACE_MALLOC_FOR_MALLOC_POSIX = @REPLACE_MALLOC_FOR_MALLOC_POSIX@ REPLACE_MBRLEN = @REPLACE_MBRLEN@ REPLACE_MBRTOWC = @REPLACE_MBRTOWC@ REPLACE_MBSINIT = @REPLACE_MBSINIT@ REPLACE_MBSNRTOWCS = @REPLACE_MBSNRTOWCS@ REPLACE_MBSRTOWCS = @REPLACE_MBSRTOWCS@ REPLACE_MBSTATE_T = @REPLACE_MBSTATE_T@ +REPLACE_MBSTOWCS = @REPLACE_MBSTOWCS@ REPLACE_MBTOWC = @REPLACE_MBTOWC@ +REPLACE_MB_CUR_MAX = @REPLACE_MB_CUR_MAX@ REPLACE_MEMCHR = @REPLACE_MEMCHR@ REPLACE_MEMMEM = @REPLACE_MEMMEM@ +REPLACE_MEMPCPY = @REPLACE_MEMPCPY@ REPLACE_MKDIR = @REPLACE_MKDIR@ REPLACE_MKFIFO = @REPLACE_MKFIFO@ REPLACE_MKFIFOAT = @REPLACE_MKFIFOAT@ REPLACE_MKNOD = @REPLACE_MKNOD@ REPLACE_MKNODAT = @REPLACE_MKNODAT@ +REPLACE_MKOSTEMP = @REPLACE_MKOSTEMP@ +REPLACE_MKOSTEMPS = @REPLACE_MKOSTEMPS@ REPLACE_MKSTEMP = @REPLACE_MKSTEMP@ REPLACE_MKTIME = @REPLACE_MKTIME@ REPLACE_NANOSLEEP = @REPLACE_NANOSLEEP@ @@ -1351,8 +1416,10 @@ REPLACE_OBSTACK_PRINTF = @REPLACE_OBSTACK_PRINTF@ REPLACE_OPEN = @REPLACE_OPEN@ REPLACE_OPENAT = @REPLACE_OPENAT@ REPLACE_PERROR = @REPLACE_PERROR@ +REPLACE_PIPE2 = @REPLACE_PIPE2@ REPLACE_POPEN = @REPLACE_POPEN@ REPLACE_POSIX_MEMALIGN = @REPLACE_POSIX_MEMALIGN@ +REPLACE_POSIX_OPENPT = @REPLACE_POSIX_OPENPT@ REPLACE_PREAD = @REPLACE_PREAD@ REPLACE_PRINTF = @REPLACE_PRINTF@ REPLACE_PSELECT = @REPLACE_PSELECT@ @@ -1419,8 +1486,9 @@ REPLACE_RANDOM_R = @REPLACE_RANDOM_R@ REPLACE_READ = @REPLACE_READ@ REPLACE_READLINK = @REPLACE_READLINK@ REPLACE_READLINKAT = @REPLACE_READLINKAT@ -REPLACE_REALLOC = @REPLACE_REALLOC@ REPLACE_REALLOCARRAY = @REPLACE_REALLOCARRAY@ +REPLACE_REALLOC_FOR_REALLOC_GNU = @REPLACE_REALLOC_FOR_REALLOC_GNU@ +REPLACE_REALLOC_FOR_REALLOC_POSIX = @REPLACE_REALLOC_FOR_REALLOC_POSIX@ REPLACE_REALPATH = @REPLACE_REALPATH@ REPLACE_REMOVE = @REPLACE_REMOVE@ REPLACE_RENAME = @REPLACE_RENAME@ @@ -1429,6 +1497,7 @@ REPLACE_RMDIR = @REPLACE_RMDIR@ REPLACE_SCHED_YIELD = @REPLACE_SCHED_YIELD@ REPLACE_SELECT = @REPLACE_SELECT@ REPLACE_SETENV = @REPLACE_SETENV@ +REPLACE_SETHOSTNAME = @REPLACE_SETHOSTNAME@ REPLACE_SETLOCALE = @REPLACE_SETLOCALE@ REPLACE_SETSTATE = @REPLACE_SETSTATE@ REPLACE_SLEEP = @REPLACE_SLEEP@ @@ -1437,6 +1506,7 @@ REPLACE_SPRINTF = @REPLACE_SPRINTF@ REPLACE_STAT = @REPLACE_STAT@ REPLACE_STDIO_READ_FUNCS = @REPLACE_STDIO_READ_FUNCS@ REPLACE_STDIO_WRITE_FUNCS = @REPLACE_STDIO_WRITE_FUNCS@ +REPLACE_STPCPY = @REPLACE_STPCPY@ REPLACE_STPNCPY = @REPLACE_STPNCPY@ REPLACE_STRCASESTR = @REPLACE_STRCASESTR@ REPLACE_STRCHRNUL = @REPLACE_STRCHRNUL@ @@ -1463,7 +1533,9 @@ REPLACE_STRUCT_LCONV = @REPLACE_STRUCT_LCONV@ REPLACE_STRUCT_TIMEVAL = @REPLACE_STRUCT_TIMEVAL@ REPLACE_SYMLINK = @REPLACE_SYMLINK@ REPLACE_SYMLINKAT = @REPLACE_SYMLINKAT@ +REPLACE_TIME = @REPLACE_TIME@ REPLACE_TIMEGM = @REPLACE_TIMEGM@ +REPLACE_TIMESPEC_GET = @REPLACE_TIMESPEC_GET@ REPLACE_TMPFILE = @REPLACE_TMPFILE@ REPLACE_TOWLOWER = @REPLACE_TOWLOWER@ REPLACE_TRUNCATE = @REPLACE_TRUNCATE@ @@ -1481,25 +1553,33 @@ REPLACE_VPRINTF = @REPLACE_VPRINTF@ REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@ REPLACE_VSPRINTF = @REPLACE_VSPRINTF@ REPLACE_WCRTOMB = @REPLACE_WCRTOMB@ +REPLACE_WCSCMP = @REPLACE_WCSCMP@ REPLACE_WCSFTIME = @REPLACE_WCSFTIME@ +REPLACE_WCSNCMP = @REPLACE_WCSNCMP@ REPLACE_WCSNRTOMBS = @REPLACE_WCSNRTOMBS@ REPLACE_WCSRTOMBS = @REPLACE_WCSRTOMBS@ +REPLACE_WCSSTR = @REPLACE_WCSSTR@ REPLACE_WCSTOK = @REPLACE_WCSTOK@ REPLACE_WCSWIDTH = @REPLACE_WCSWIDTH@ REPLACE_WCTOB = @REPLACE_WCTOB@ REPLACE_WCTOMB = @REPLACE_WCTOMB@ REPLACE_WCWIDTH = @REPLACE_WCWIDTH@ +REPLACE_WMEMCMP = @REPLACE_WMEMCMP@ +REPLACE_WMEMPCPY = @REPLACE_WMEMPCPY@ REPLACE_WRITE = @REPLACE_WRITE@ +REPLACE__EXIT = @REPLACE__EXIT@ +SCHED_YIELD_LIB = @SCHED_YIELD_LIB@ SED = @SED@ +SELECT_LIB = @SELECT_LIB@ +SETLOCALE_NULL_LIB = @SETLOCALE_NULL_LIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SIGSEGV_H = @SIGSEGV_H@ SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ SIZE_T_SUFFIX = @SIZE_T_SUFFIX@ SRC_VERSION_C = @SRC_VERSION_C@ -STDALIGN_H = @STDALIGN_H@ STDARG_H = @STDARG_H@ -STDBOOL_H = @STDBOOL_H@ +STDCKDINT_H = @STDCKDINT_H@ STDDEF_H = @STDDEF_H@ STDINT_H = @STDINT_H@ STRIP = @STRIP@ @@ -1537,8 +1617,10 @@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +am__rm_f_notfound = @am__rm_f_notfound@ am__tar = @am__tar@ am__untar = @am__untar@ +am__xargs_n = @am__xargs_n@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -1551,8 +1633,10 @@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ +gl_LIBOBJDEPS = @gl_LIBOBJDEPS@ gl_LIBOBJS = @gl_LIBOBJS@ gl_LTLIBOBJS = @gl_LTLIBOBJS@ +gltests_LIBOBJDEPS = @gltests_LIBOBJDEPS@ gltests_LIBOBJS = @gltests_LIBOBJS@ gltests_LTLIBOBJS = @gltests_LTLIBOBJS@ gltests_WITNESS = @gltests_WITNESS@ @@ -1594,11 +1678,16 @@ LDADD = \ $(LIBINTL) \ $(LIBICONV) \ $(LIBSIGSEGV) \ - $(LIB_CLOCK_GETTIME) + $(LIBTHREAD) \ + $(LIBUNISTRING) \ + $(CLOCK_TIME_LIB) \ + $(HARD_LOCALE_LIB) \ + $(MBRTOWC_LIB) \ + $(SETLOCALE_NULL_LIB) diff_LDADD = $(LDADD) cmp_LDADD = $(LDADD) -sdiff_LDADD = $(LDADD) +sdiff_LDADD = $(LDADD) $(GETRANDOM_LIB) diff3_LDADD = $(LDADD) cmp_SOURCES = cmp.c diff3_SOURCES = diff3.c @@ -1691,18 +1780,18 @@ uninstall-binPROGRAMS: `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(bindir)" && rm -f $$files + cd "$(DESTDIR)$(bindir)" && $(am__rm_f) $$files clean-binPROGRAMS: - -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + -$(am__rm_f) $(bin_PROGRAMS) clean-noinstLIBRARIES: - -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) + -$(am__rm_f) $(noinst_LIBRARIES) libver.a: $(libver_a_OBJECTS) $(libver_a_DEPENDENCIES) $(EXTRA_libver_a_DEPENDENCIES) $(AM_V_at)-rm -f libver.a $(AM_V_AR)$(libver_a_AR) libver.a $(libver_a_OBJECTS) $(libver_a_LIBADD) - $(AM_V_at)$(RANLIB) libver.a + $(AM_V_at)$(libver_a_RANLIB) libver.a cmp$(EXEEXT): $(cmp_OBJECTS) $(cmp_DEPENDENCIES) $(EXTRA_cmp_DEPENDENCIES) @rm -f cmp$(EXEEXT) @@ -1743,7 +1832,7 @@ distclean-compile: $(am__depfiles_remade): @$(MKDIR_P) $(@D) - @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + @: >>$@ am--depfiles: $(am__depfiles_remade) @@ -1877,27 +1966,27 @@ install-strip: "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: - -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) + -$(am__rm_f) $(MOSTLYCLEANFILES) clean-generic: distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + -$(am__rm_f) $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || $(am__rm_f) $(CONFIG_CLEAN_VPATH_FILES) + -$(am__rm_f) $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." - -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) + -$(am__rm_f) $(BUILT_SOURCES) + -$(am__rm_f) $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-noinstLIBRARIES \ mostlyclean-am distclean: distclean-am - -rm -f ./$(DEPDIR)/analyze.Po + -rm -f ./$(DEPDIR)/analyze.Po -rm -f ./$(DEPDIR)/cmp.Po -rm -f ./$(DEPDIR)/context.Po -rm -f ./$(DEPDIR)/diff.Po @@ -1956,7 +2045,7 @@ install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am - -rm -f ./$(DEPDIR)/analyze.Po + -rm -f ./$(DEPDIR)/analyze.Po -rm -f ./$(DEPDIR)/cmp.Po -rm -f ./$(DEPDIR)/context.Po -rm -f ./$(DEPDIR)/diff.Po diff --git a/src/analyze.c b/src/analyze.c index a5e4bdc..ddb601d 100644 --- a/src/analyze.c +++ b/src/analyze.c @@ -1,7 +1,7 @@ /* Analyze file differences for GNU DIFF. Copyright (C) 1988-1989, 1992-1995, 1998, 2001-2002, 2004, 2006-2007, - 2009-2013, 2015-2021 Free Software Foundation, Inc. + 2009-2013, 2015-2023 Free Software Foundation, Inc. This file is part of GNU DIFF. @@ -28,6 +28,7 @@ #define ELEMENT lin #define EQUAL(x,y) ((x) == (y)) #define OFFSET lin +#define OFFSET_MAX LIN_MAX #define EXTRA_CONTEXT_FIELDS /* none */ #define NOTE_DELETE(c, xoff) (files[0].changed[files[0].realindexes[xoff]] = 1) #define NOTE_INSERT(c, yoff) (files[1].changed[files[1].realindexes[yoff]] = 1) @@ -67,7 +68,7 @@ discard_confusing_lines (struct file_data filevec[]) /* Set up equiv_count[F][I] as the number of lines in file F that fall in equivalence class I. */ - p = zalloc (filevec[0].equiv_max * (2 * sizeof *p)); + p = xcalloc (filevec[0].equiv_max, 2 * sizeof *p); equiv_count[0] = p; equiv_count[1] = p + filevec[0].equiv_max; @@ -78,8 +79,8 @@ discard_confusing_lines (struct file_data filevec[]) /* Set up tables of which lines are going to be discarded. */ - discarded[0] = zalloc (filevec[0].buffered_lines - + filevec[1].buffered_lines); + discarded[0] = xzalloc (filevec[0].buffered_lines + + filevec[1].buffered_lines); discarded[1] = discarded[0] + filevec[0].buffered_lines; /* Mark to be discarded each line that matches no line of the other file. @@ -451,8 +452,8 @@ briefly_report (int changes, struct file_data const filevec[]) { if (changes) message ((brief - ? _("Files %s and %s differ\n") - : _("Binary files %s and %s differ\n")), + ? N_("Files %s and %s differ\n") + : N_("Binary files %s and %s differ\n")), file_label[0] ? file_label[0] : filevec[0].name, file_label[1] ? file_label[1] : filevec[1].name); } @@ -542,7 +543,7 @@ diff_2_files (struct comparison *cmp) Allocate an extra element, always 0, at each end of each vector. */ size_t s = cmp->file[0].buffered_lines + cmp->file[1].buffered_lines + 4; - char *flag_space = zalloc (s); + char *flag_space = xzalloc (s); cmp->file[0].changed = flag_space + 1; cmp->file[1].changed = flag_space + cmp->file[0].buffered_lines + 3; @@ -697,7 +698,7 @@ diff_2_files (struct comparison *cmp) free (e); } - if (! ROBUST_OUTPUT_STYLE (output_style)) + if (! robust_output_style (output_style)) for (f = 0; f < 2; ++f) if (cmp->file[f].missing_newline) { @@ -1,7 +1,7 @@ /* GNU cmp - compare two files byte by byte Copyright (C) 1990-1996, 1998, 2001-2002, 2004, 2006-2007, 2009-2013, - 2015-2021 Free Software Foundation, Inc. + 2015-2023 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -39,21 +39,25 @@ #include <xstrtol.h> /* The official name of this program (e.g., no 'g' prefix). */ -#define PROGRAM_NAME "cmp" +static char const PROGRAM_NAME[] = "cmp"; #define AUTHORS \ proper_name_utf8 ("Torbjorn Granlund", "Torbj\303\266rn Granlund"), \ proper_name ("David MacKenzie") +static bool +hard_locale_LC_MESSAGES (void) +{ #if defined LC_MESSAGES && ENABLE_NLS -# define hard_locale_LC_MESSAGES hard_locale (LC_MESSAGES) + return hard_locale (LC_MESSAGES); #else -# define hard_locale_LC_MESSAGES 0 + return false; #endif +} static int cmp (void); static off_t file_position (int); -static size_t block_compare (word const *, word const *) _GL_ATTRIBUTE_PURE; +static size_t block_compare (word const *, word const *) ATTRIBUTE_PURE; static size_t count_newlines (char *, size_t); static void sprintc (char *, unsigned char); @@ -63,7 +67,8 @@ static char const *file[2]; /* File descriptors of the files. */ static int file_desc[2]; -/* Status of the files. */ +/* Status of the files. If st_size is negative, the status is unknown + and st_blksize (if it exists) is just a reasonable guess. */ static struct stat stat_buf[2]; /* Read buffers for the files. */ @@ -110,8 +115,7 @@ static struct option const long_options[] = {0, 0, 0, 0} }; -static void try_help (char const *, char const *) __attribute__((noreturn)); -static void +static _Noreturn void try_help (char const *reason_msgid, char const *operand) { if (reason_msgid) @@ -252,7 +256,7 @@ main (int argc, char **argv) case 'v': version_etc (stdout, PROGRAM_NAME, PACKAGE_NAME, Version, - AUTHORS, (char *) NULL); + AUTHORS, nullptr); check_stdout (); return EXIT_SUCCESS; @@ -295,21 +299,31 @@ main (int argc, char **argv) set_binary_mode (STDIN_FILENO, O_BINARY); } else - file_desc[f] = open (file[f], O_RDONLY | O_BINARY, 0); + { + file_desc[f] = open (file[f], O_RDONLY | O_BINARY, 0); - if (file_desc[f] < 0 || fstat (file_desc[f], stat_buf + f) != 0) + if (file_desc[f] < 0) + { + if (comparison_type != type_status) + error (0, errno, "%s", file[f]); + exit (EXIT_TROUBLE); + } + } + + if (fstat (file_desc[f], stat_buf + f) < 0) { - if (file_desc[f] < 0 && comparison_type == type_status) - exit (EXIT_TROUBLE); - else - die (EXIT_TROUBLE, errno, "%s", file[f]); + stat_buf[f].st_size = -1; +#if HAVE_STRUCT_STAT_ST_BLKSIZE + stat_buf[f].st_blksize = 8 * 1024; +#endif } } /* If the files are links to the same inode and have the same file position, they are identical. */ - if (0 < same_file (&stat_buf[0], &stat_buf[1]) + if (0 <= stat_buf[0].st_size && 0 <= stat_buf[1].st_size + && 0 < same_file (&stat_buf[0], &stat_buf[1]) && same_file_attributes (&stat_buf[0], &stat_buf[1]) && file_position (0) == file_position (1)) return EXIT_SUCCESS; @@ -333,8 +347,8 @@ main (int argc, char **argv) and if more bytes will be compared than are in the smaller file. */ if (comparison_type == type_status - && S_ISREG (stat_buf[0].st_mode) - && S_ISREG (stat_buf[1].st_mode)) + && 0 <= stat_buf[0].st_size && S_ISREG (stat_buf[0].st_mode) + && 0 <= stat_buf[1].st_size && S_ISREG (stat_buf[1].st_mode)) { off_t s0 = stat_buf[0].st_size - file_position (0); off_t s1 = stat_buf[1].st_size - file_position (1); @@ -346,7 +360,7 @@ main (int argc, char **argv) exit (EXIT_FAILURE); } - /* Get the optimal block size of the files. */ + /* Guess a good block size for the files. */ buf_size = buffer_lcm (STAT_BLOCKSIZE (stat_buf[0]), STAT_BLOCKSIZE (stat_buf[1]), @@ -390,7 +404,7 @@ cmp (void) char *buf1 = (char *) buffer1; int differing = 0; int f; - int offset_width IF_LINT (= 0); + int offset_width IF_LINT (= 0); /* IF_LINT due to GCC bug 101768. */ if (comparison_type == type_all_diffs) { @@ -398,7 +412,7 @@ cmp (void) ? bytes : TYPE_MAXIMUM (off_t)); for (f = 0; f < 2; f++) - if (S_ISREG (stat_buf[f].st_mode)) + if (0 <= stat_buf[f].st_size && S_ISREG (stat_buf[f].st_mode)) { off_t file_bytes = stat_buf[f].st_size - file_position (f); if (file_bytes < byte_number_max) @@ -507,7 +521,7 @@ cmp (void) N_("%s %s differ: byte %s, line %s\n"); char const *byte_message = _(byte_msgid); bool use_byte_message = (byte_message != byte_msgid - || hard_locale_LC_MESSAGES); + || hard_locale_LC_MESSAGES ()); printf (use_byte_message ? byte_message : char_message, file[0], file[1], byte_num, line_num); diff --git a/src/context.c b/src/context.c index c65f427..a4c76ca 100644 --- a/src/context.c +++ b/src/context.c @@ -1,7 +1,7 @@ /* Context-format output routines for GNU DIFF. Copyright (C) 1988-1989, 1991-1995, 1998, 2001-2002, 2004, 2006, 2009-2013, - 2015-2021 Free Software Foundation, Inc. + 2015-2023 Free Software Foundation, Inc. This file is part of GNU DIFF. @@ -52,7 +52,7 @@ print_context_label (char const *mark, INT_STRLEN_BOUND (time_t) + 11)]; struct tm const *tm = localtime (&inf->stat.st_mtime); int nsec = get_stat_mtime_ns (&inf->stat); - if (! (tm && nstrftime (buf, sizeof buf, time_format, tm, 0, nsec))) + if (! (tm && nstrftime (buf, sizeof buf, time_format, tm, localtz, nsec))) { verify (TYPE_IS_INTEGER (time_t)); if (LONG_MIN <= TYPE_MINIMUM (time_t) @@ -127,7 +127,7 @@ print_context_script (struct change *script, bool unidiff) static void print_context_number_range (struct file_data const *file, lin a, lin b) { - printint trans_a, trans_b; + lin trans_a, trans_b; translate_range (file, a, b, &trans_a, &trans_b); /* We can have B <= A in the case of a range of no lines. @@ -196,7 +196,7 @@ pr_context_hunk (struct change *hunk) last1 = files[1].valid_lines - 1; /* If desired, find the preceding function definition line in file 0. */ - function = NULL; + function = nullptr; if (function_regexp.fastmap) function = find_function (files[0].linbuf, first0); @@ -296,7 +296,7 @@ pr_context_hunk (struct change *hunk) static void print_unidiff_number_range (struct file_data const *file, lin a, lin b) { - printint trans_a, trans_b; + lin trans_a, trans_b; translate_range (file, a, b, &trans_a, &trans_b); /* We can have B < A in the case of a range of no lines. @@ -345,7 +345,7 @@ pr_unidiff_hunk (struct change *hunk) last1 = files[1].valid_lines - 1; /* If desired, find the preceding function definition line in file 0. */ - function = NULL; + function = nullptr; if (function_regexp.fastmap) function = find_function (files[0].linbuf, first0); @@ -379,7 +379,7 @@ pr_unidiff_hunk (struct change *hunk) char const *const *line = &files[0].linbuf[i++]; if (! (suppress_blank_empty && **line == '\n')) putc (initial_tab ? '\t' : ' ', out); - print_1_line (NULL, line); + print_1_line (nullptr, line); j++; } else @@ -395,7 +395,7 @@ pr_unidiff_hunk (struct change *hunk) putc ('-', out); if (initial_tab && ! (suppress_blank_empty && **line == '\n')) putc ('\t', out); - print_1_line_nl (NULL, line, true); + print_1_line_nl (nullptr, line, true); set_color_context (RESET_CONTEXT); @@ -414,7 +414,7 @@ pr_unidiff_hunk (struct change *hunk) putc ('+', out); if (initial_tab && ! (suppress_blank_empty && **line == '\n')) putc ('\t', out); - print_1_line_nl (NULL, line, true); + print_1_line_nl (nullptr, line, true); set_color_context (RESET_CONTEXT); @@ -433,7 +433,7 @@ pr_unidiff_hunk (struct change *hunk) 2*CONTEXT unchanged lines appear, and return a pointer to the 'struct change' for the last change before those lines. */ -static struct change * _GL_ATTRIBUTE_PURE +static struct change * ATTRIBUTE_PURE find_hunk (struct change *start) { struct change *prev; @@ -481,7 +481,7 @@ mark_ignorable (struct change *script) lin first0, last0, first1, last1; /* Turn this change into a hunk: detach it from the others. */ - script->link = NULL; + script->link = nullptr; /* Determine whether this change is ignorable. */ script->ignore = ! analyze_hunk (script, @@ -497,7 +497,7 @@ mark_ignorable (struct change *script) /* Find the last function-header line in LINBUF prior to line number LINENUM. This is a line containing a match for the regexp in 'function_regexp'. - Return the address of the text, or NULL if no function-header is found. */ + Return the address of the text, or null if no function-header is found. */ static char const * find_function (char const * const *linbuf, lin linenum) @@ -512,10 +512,11 @@ find_function (char const * const *linbuf, lin linenum) char const *line = linbuf[i]; size_t linelen = linbuf[i + 1] - line - 1; - /* FIXME: re_search's size args should be size_t, not int. */ - int len = MIN (linelen, INT_MAX); + /* This line is for documentation; in practice it's equivalent + to LEN = LINELEN and no machine code is generated. */ + regoff_t len = MIN (linelen, TYPE_MAXIMUM (regoff_t)); - if (0 <= re_search (&function_regexp, line, len, 0, len, NULL)) + if (0 <= re_search (&function_regexp, line, len, 0, len, nullptr)) { find_function_last_match = i; return line; @@ -526,5 +527,5 @@ find_function (char const * const *linbuf, lin linenum) if (find_function_last_match != LIN_MAX) return linbuf[find_function_last_match]; - return NULL; + return nullptr; } @@ -1,5 +1,5 @@ /* Report an error and exit. - Copyright 2016-2021 Free Software Foundation, Inc. + Copyright 2016-2023 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,7 +20,6 @@ # define DIE_H # include <error.h> -# include <stdbool.h> # include <verify.h> /* Like 'error (STATUS, ...)', except STATUS must be a nonzero constant. @@ -1,7 +1,7 @@ /* GNU diff - compare files line by line Copyright (C) 1988-1989, 1992-1994, 1996, 1998, 2001-2002, 2004, 2006-2007, - 2009-2013, 2015-2021 Free Software Foundation, Inc. + 2009-2013, 2015-2023 Free Software Foundation, Inc. This file is part of GNU DIFF. @@ -33,7 +33,6 @@ #include <fnmatch.h> #include <getopt.h> #include <hard-locale.h> -#include <prepargs.h> #include <progname.h> #include <sh-quote.h> #include <stat-time.h> @@ -45,7 +44,7 @@ #include <binary-io.h> /* The official name of this program (e.g., no 'g' prefix). */ -#define PROGRAM_NAME "diff" +static char const PROGRAM_NAME[] = "diff"; #define AUTHORS \ proper_name ("Paul Eggert"), \ @@ -73,7 +72,7 @@ static void summarize_regexp_list (struct regexp_list *); static void specify_style (enum output_style); static void specify_value (char const **, char const *, char const *); static void specify_colors_style (char const *); -static void try_help (char const *, char const *) __attribute__((noreturn)); +static _Noreturn void try_help (char const *, char const *); static void check_stdout (void); static void usage (void); @@ -105,6 +104,9 @@ static bool unidirectional_new_file; /* Report files compared that are the same (-s). Normally nothing is output when that happens. */ static bool report_identical_files; + +/* Do not treat directories specially. */ +static bool no_directory; static char const shortopts[] = "0123456789abBcC:dD:eEfF:hHiI:lL:nNpPqrsS:tTuU:vwW:x:X:yZ"; @@ -144,6 +146,7 @@ enum COLOR_OPTION, COLOR_PALETTE_OPTION, + NO_DIRECTORY_OPTION, PRESUME_OUTPUT_TTY_OPTION, }; @@ -224,8 +227,11 @@ static struct option const longopts[] = {"version", 0, 0, 'v'}, {"width", 1, 0, 'W'}, + /* This is solely for diff3. Do not document. */ + {"-no-directory", no_argument, nullptr, NO_DIRECTORY_OPTION}, + /* This is solely for testing. Do not document. */ - {"-presume-output-tty", no_argument, NULL, PRESUME_OUTPUT_TTY_OPTION}, + {"-presume-output-tty", no_argument, nullptr, PRESUME_OUTPUT_TTY_OPTION}, {0, 0, 0, 0} }; @@ -246,7 +252,11 @@ option_list (char **optionvec, int count) char *p; for (i = 0; i < count; i++) - size += 1 + shell_quote_length (optionvec[i]); + { + size_t optsize = 1 + shell_quote_length (optionvec[i]); + if (INT_ADD_WRAPV (optsize, size, &size)) + xalloc_die (); + } p = result = xmalloc (size); @@ -280,8 +290,8 @@ main (int argc, char **argv) bool explicit_context = false; size_t width = 0; bool show_c_function = false; - char const *from_file = NULL; - char const *to_file = NULL; + char const *from_file = nullptr; + char const *to_file = nullptr; intmax_t numval; char *numend; @@ -302,7 +312,7 @@ main (int argc, char **argv) /* Decode the options. */ - while ((c = getopt_long (argc, argv, shortopts, longopts, NULL)) != -1) + while ((c = getopt_long (argc, argv, shortopts, longopts, nullptr)) != -1) { switch (c) { @@ -379,21 +389,60 @@ main (int argc, char **argv) case 'D': specify_style (OUTPUT_IFDEF); { - static char const C_ifdef_group_formats[] = - "%%=%c#ifndef %s\n%%<#endif /* ! %s */\n%c#ifdef %s\n%%>#endif /* %s */\n%c#ifndef %s\n%%<#else /* %s */\n%%>#endif /* %s */\n"; - char *b = xmalloc (sizeof C_ifdef_group_formats - + 7 * strlen (optarg) - 14 /* 7*"%s" */ - - 8 /* 5*"%%" + 3*"%c" */); - sprintf (b, C_ifdef_group_formats, - 0, - optarg, optarg, 0, - optarg, optarg, 0, - optarg, optarg, optarg); - for (i = 0; i < sizeof group_format / sizeof group_format[0]; i++) - { - specify_value (&group_format[i], b, "-D"); - b += strlen (b) + 1; - } + static char const C_ifdef_group_formats[] + = (/* UNCHANGED */ + "%=" + "\0" + + /* OLD */ + "#ifndef @\n" + "%<" + "#endif /* ! @ */\n" + "\0" + + /* NEW */ + "#ifdef @\n" + "%>" + "#endif /* @ */\n" + "\0" + + /* CHANGED */ + "#ifndef @\n" + "%<" + "#else /* @ */\n" + "%>" + "#endif /* @ */\n"); + + size_t alloc = strlen (optarg); + if (INT_MULTIPLY_WRAPV (alloc, 7, &alloc) + || INT_ADD_WRAPV (alloc, + sizeof C_ifdef_group_formats - 7 /* 7*"@" */, + &alloc)) + xalloc_die (); + char *b = xmalloc (alloc); + char *base = b; + int changes = 0; + + for (i = 0; i < sizeof C_ifdef_group_formats; i++) + { + char ch = C_ifdef_group_formats[i]; + switch (ch) + { + default: + *b++ = ch; + break; + + case '@': + b = stpcpy (b, optarg); + break; + + case '\0': + *b++ = ch; + specify_value (&group_format[changes++], base, "-D"); + base = b; + break; + } + } } break; @@ -435,7 +484,7 @@ main (int argc, char **argv) case 'l': if (!pr_program[0]) - try_help ("pagination not supported on this host", NULL); + try_help ("pagination not supported on this host", nullptr); paginate = true; #ifdef SIGCHLD /* Pagination requires forking and waiting, and @@ -502,7 +551,7 @@ main (int argc, char **argv) case 'v': version_etc (stdout, PROGRAM_NAME, PACKAGE_NAME, Version, - AUTHORS, (char *) NULL); + AUTHORS, nullptr); check_stdout (); return EXIT_SUCCESS; @@ -650,12 +699,16 @@ main (int argc, char **argv) set_color_palette (optarg); break; + case NO_DIRECTORY_OPTION: + no_directory = true; + break; + case PRESUME_OUTPUT_TTY_OPTION: presume_output_tty = true; break; default: - try_help (NULL, NULL); + try_help (nullptr, nullptr); } prev = c; } @@ -687,6 +740,9 @@ main (int argc, char **argv) #else time_format = "%Y-%m-%d %H:%M:%S %z"; #endif +#if !HAVE_TM_GMTOFF + localtz = tzalloc (getenv ("TZ")); +#endif } else { @@ -750,8 +806,12 @@ main (int argc, char **argv) if (!group_format[UNCHANGED]) group_format[UNCHANGED] = "%="; if (!group_format[CHANGED]) - group_format[CHANGED] = concat (group_format[OLD], - group_format[NEW], ""); + { + char *p = xmalloc (strlen (group_format[OLD]) + + strlen (group_format[NEW]) + 1); + group_format[CHANGED] = p; + strcpy (stpcpy (p, group_format[OLD]), group_format[NEW]); + } } no_diff_means_no_output = @@ -775,7 +835,7 @@ main (int argc, char **argv) else for (; optind < argc; optind++) { - int status = compare_files (NULL, from_file, argv[optind]); + int status = compare_files (nullptr, from_file, argv[optind]); if (exit_status < status) exit_status = status; } @@ -785,7 +845,7 @@ main (int argc, char **argv) if (to_file) for (; optind < argc; optind++) { - int status = compare_files (NULL, argv[optind], to_file); + int status = compare_files (nullptr, argv[optind], to_file); if (exit_status < status) exit_status = status; } @@ -799,7 +859,7 @@ main (int argc, char **argv) try_help ("extra operand '%s'", argv[optind + 2]); } - exit_status = compare_files (NULL, argv[optind], argv[optind + 1]); + exit_status = compare_files (nullptr, argv[optind], argv[optind + 1]); } } @@ -807,7 +867,7 @@ main (int argc, char **argv) print_message_queue (); check_stdout (); - exit (exit_status); + cleanup_signal_handlers (); return exit_status; } @@ -1032,7 +1092,7 @@ specify_value (char const **var, char const *value, char const *option) if (*var && ! STREQ (*var, value)) { error (0, 0, _("conflicting %s option value '%s'"), option, value); - try_help (NULL, NULL); + try_help (nullptr, nullptr); } *var = value; } @@ -1044,7 +1104,7 @@ specify_style (enum output_style style) if (output_style != style) { if (output_style != OUTPUT_UNSPECIFIED) - try_help ("conflicting output style options", NULL); + try_help ("conflicting output style options", nullptr); output_style = style; } } @@ -1053,7 +1113,7 @@ specify_style (enum output_style style) static void specify_colors_style (char const *value) { - if (value == NULL || STREQ (value, "auto")) + if (value == nullptr || STREQ (value, "auto")) colors_style = AUTO; else if (STREQ (value, "always")) colors_style = ALWAYS; @@ -1083,6 +1143,24 @@ set_mtime_to_now (struct stat *st) #endif } +/* cmp.file[f].desc markers */ +enum { NONEXISTENT = -1 }; /* nonexistent file */ +enum { UNOPENED = -2 }; /* unopened file (e.g. directory) */ + +/* encoded errno value */ +static int +errno_encode (int err) +{ + return -3 - err; +} + +/* inverse of errno_encode */ +static int +errno_decode (int desc) +{ + return -3 - desc; +} + /* Compare two files (or dirs) with parent comparison PARENT and names NAME0 and NAME1. (If PARENT is null, then the first name is just NAME0, etc.) @@ -1126,13 +1204,6 @@ compare_files (struct comparison const *parent, memset (cmp.file, 0, sizeof cmp.file); cmp.parent = parent; - /* cmp.file[f].desc markers */ -#define NONEXISTENT (-1) /* nonexistent file */ -#define UNOPENED (-2) /* unopened file (e.g. directory) */ -#define ERRNO_ENCODE(errno) (-3 - (errno)) /* encoded errno value */ - -#define ERRNO_DECODE(desc) (-3 - (desc)) /* inverse of ERRNO_ENCODE */ - cmp.file[0].desc = name0 ? UNOPENED : NONEXISTENT; cmp.file[1].desc = name1 ? UNOPENED : NONEXISTENT; @@ -1145,17 +1216,17 @@ compare_files (struct comparison const *parent, if (!parent) { - free0 = NULL; - free1 = NULL; + free0 = nullptr; + free1 = nullptr; cmp.file[0].name = name0; cmp.file[1].name = name1; } else { cmp.file[0].name = free0 - = file_name_concat (parent->file[0].name, name0, NULL); + = file_name_concat (parent->file[0].name, name0, nullptr); cmp.file[1].name = free1 - = file_name_concat (parent->file[1].name, name1, NULL); + = file_name_concat (parent->file[1].name, name1, nullptr); } /* Stat the files. */ @@ -1175,14 +1246,14 @@ compare_files (struct comparison const *parent, if (binary && ! isatty (STDIN_FILENO)) set_binary_mode (STDIN_FILENO, O_BINARY); if (fstat (STDIN_FILENO, &cmp.file[f].stat) != 0) - cmp.file[f].desc = ERRNO_ENCODE (errno); + cmp.file[f].desc = errno_encode (errno); else { if (S_ISREG (cmp.file[f].stat.st_mode)) { off_t pos = lseek (STDIN_FILENO, 0, SEEK_CUR); if (pos < 0) - cmp.file[f].desc = ERRNO_ENCODE (errno); + cmp.file[f].desc = errno_encode (errno); else cmp.file[f].stat.st_size = MAX (0, cmp.file[f].stat.st_size - pos); @@ -1197,7 +1268,7 @@ compare_files (struct comparison const *parent, ? lstat (cmp.file[f].name, &cmp.file[f].stat) : stat (cmp.file[f].name, &cmp.file[f].stat)) != 0) - cmp.file[f].desc = ERRNO_ENCODE (errno); + cmp.file[f].desc = errno_encode (errno); } } @@ -1212,8 +1283,8 @@ compare_files (struct comparison const *parent, ? (S_ISREG (cmp.file[f].stat.st_mode) && ! (cmp.file[f].stat.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO)) && cmp.file[f].stat.st_size == 0) - : ((cmp.file[f].desc == ERRNO_ENCODE (ENOENT) - || cmp.file[f].desc == ERRNO_ENCODE (EBADF)) + : ((cmp.file[f].desc == errno_encode (ENOENT) + || cmp.file[f].desc == errno_encode (EBADF)) && ! parent && (cmp.file[1 - f].desc == UNOPENED || cmp.file[1 - f].desc == STDIN_FILENO)))) @@ -1228,7 +1299,7 @@ compare_files (struct comparison const *parent, for (f = 0; f < 2; f++) { - int e = ERRNO_DECODE (cmp.file[f].desc); + int e = errno_decode (cmp.file[f].desc); if (0 <= e) { errno = e; @@ -1237,7 +1308,8 @@ compare_files (struct comparison const *parent, } } - if (status == EXIT_SUCCESS && ! parent && DIR_P (0) != DIR_P (1)) + if (status == EXIT_SUCCESS && ! parent && !no_directory + && DIR_P (0) != DIR_P (1)) { /* If one is a directory, and it was specified in the command line, use the file in that dir with the other file's basename. */ @@ -1321,7 +1393,7 @@ compare_files (struct comparison const *parent, { char const *dir; - /* PARENT must be non-NULL here. */ + /* PARENT must be non-null here. */ assert (parent); dir = parent->file[cmp.file[0].desc == NONEXISTENT].name; @@ -1336,11 +1408,11 @@ compare_files (struct comparison const *parent, /* We have two files that are not to be compared. */ /* See POSIX 1003.1-2001 for this format. */ - message5 ("File %s is a %s while file %s is a %s\n", - file_label[0] ? file_label[0] : cmp.file[0].name, - file_type (&cmp.file[0].stat), - file_label[1] ? file_label[1] : cmp.file[1].name, - file_type (&cmp.file[1].stat)); + message ("File %s is a %s while file %s is a %s\n", + file_label[0] ? file_label[0] : cmp.file[0].name, + file_type (&cmp.file[0].stat), + file_label[1] ? file_label[1] : cmp.file[1].name, + file_type (&cmp.file[1].stat)); /* This is a difference. */ status = EXIT_FAILURE; @@ -1356,12 +1428,12 @@ compare_files (struct comparison const *parent, && S_ISLNK (cmp.file[1].stat.st_mode)) { /* Compare the values of the symbolic links. */ - char *link_value[2] = { NULL, NULL }; + char *link_value[2] = { nullptr, nullptr }; for (f = 0; f < 2; f++) { link_value[f] = xreadlink (cmp.file[f].name); - if (link_value[f] == NULL) + if (link_value[f] == nullptr) { perror_with_name (cmp.file[f].name); status = EXIT_TROUBLE; @@ -1386,11 +1458,11 @@ compare_files (struct comparison const *parent, /* We have two files that are not to be compared, because one of them is a symbolic link and the other one is not. */ - message5 ("File %s is a %s while file %s is a %s\n", - file_label[0] ? file_label[0] : cmp.file[0].name, - file_type (&cmp.file[0].stat), - file_label[1] ? file_label[1] : cmp.file[1].name, - file_type (&cmp.file[1].stat)); + message ("File %s is a %s while file %s is a %s\n", + file_label[0] ? file_label[0] : cmp.file[0].name, + file_type (&cmp.file[0].stat), + file_label[1] ? file_label[1] : cmp.file[1].name, + file_type (&cmp.file[1].stat)); /* This is a difference. */ status = EXIT_FAILURE; @@ -1,7 +1,7 @@ /* Shared definitions for GNU DIFF Copyright (C) 1988-1989, 1991-1995, 1998, 2001-2002, 2004, 2009-2013, - 2015-2021 Free Software Foundation, Inc. + 2015-2023 Free Software Foundation, Inc. This file is part of GNU DIFF. @@ -23,6 +23,16 @@ #include <stdio.h> #include <unlocked-io.h> +_GL_INLINE_HEADER_BEGIN + +#ifdef GDIFF_MAIN +# define DIFF_INLINE _GL_EXTERN_INLINE +# define XTERN +#else +# define DIFF_INLINE _GL_INLINE +# define XTERN extern +#endif + /* What kind of changes a hunk contains. */ enum changes { @@ -54,12 +64,6 @@ enum colors_style /* Variables for command line options */ -#ifndef GDIFF_MAIN -# define XTERN extern -#else -# define XTERN -#endif - enum output_style { /* No output style specified. */ @@ -92,7 +96,10 @@ enum output_style /* True for output styles that are robust, i.e. can handle a file that ends in a non-newline. */ -#define ROBUST_OUTPUT_STYLE(S) ((S) != OUTPUT_ED && (S) != OUTPUT_FORWARD_ED) +DIFF_INLINE bool robust_output_style (enum output_style s) +{ + return s != OUTPUT_ED && s != OUTPUT_FORWARD_ED; +} XTERN enum output_style output_style; @@ -155,6 +162,13 @@ XTERN bool ignore_file_name_case; (--no-dereference). */ XTERN bool no_dereference_symlinks; +/* Local timezone for 'c' output headers, if needed. */ +#if HAVE_TM_GMTOFF +# define localtz 0 /* Placeholder since localtz is never needed. */ +#else +XTERN timezone_t localtz; +#endif + /* File labels for '-c' output headers (--label). */ XTERN char *file_label[2]; @@ -322,10 +336,6 @@ struct file_data { lin equiv_max; }; -/* The file buffer, considered as an array of bytes rather than - as an array of words. */ -#define FILE_BUFFER(f) ((char *) (f)->buffer) - /* Data on two input files being compared. */ struct comparison @@ -355,7 +365,9 @@ extern void print_context_script (struct change *, bool); extern int diff_dirs (struct comparison const *, int (*) (struct comparison const *, char const *, char const *)); -extern char *find_dir_file_pathname (char const *, char const *); +extern char *find_dir_file_pathname (char const *, char const *) + ATTRIBUTE_MALLOC ATTRIBUTE_DEALLOC_FREE + ATTRIBUTE_RETURNS_NONNULL; /* ed.c */ extern void print_ed_script (struct change *); @@ -380,24 +392,21 @@ extern void print_sdiff_script (struct change *); /* util.c */ extern char const change_letter[4]; extern char const pr_program[]; -extern char *concat (char const *, char const *, char const *); -extern bool lines_differ (char const *, char const *) _GL_ATTRIBUTE_PURE; +extern bool lines_differ (char const *, char const *) ATTRIBUTE_PURE; extern lin translate_line_number (struct file_data const *, lin); extern struct change *find_change (struct change *); extern struct change *find_reverse_change (struct change *); -extern void *zalloc (size_t); extern enum changes analyze_hunk (struct change *, lin *, lin *, lin *, lin *); extern void begin_output (void); +extern void cleanup_signal_handlers (void); extern void debug_script (struct change *); -extern void fatal (char const *) __attribute__((noreturn)); +extern _Noreturn void fatal (char const *); extern void finish_output (void); -extern void message (char const *, char const *, char const *); -extern void message5 (char const *, char const *, char const *, - char const *, char const *); +extern void message (char const *, ...) ATTRIBUTE_FORMAT ((printf, 1, 2)); extern void output_1_line (char const *, char const *, char const *, char const *); extern void perror_with_name (char const *); -extern void pfatal_with_name (char const *) __attribute__((noreturn)); +extern _Noreturn void pfatal_with_name (char const *); extern void print_1_line (char const *, char const * const *); extern void print_1_line_nl (char const *, char const * const *, bool); extern void print_message_queue (void); @@ -405,8 +414,7 @@ extern void print_number_range (char, struct file_data *, lin, lin); extern void print_script (struct change *, struct change * (*) (struct change *), void (*) (struct change *)); extern void setup_output (char const *, char const *, bool); -extern void translate_range (struct file_data const *, lin, lin, - printint *, printint *); +extern void translate_range (struct file_data const *, lin, lin, lin *, lin *); enum color_context { @@ -421,3 +429,5 @@ XTERN bool presume_output_tty; extern void set_color_context (enum color_context color_context); extern void set_color_palette (char const *palette); + +_GL_INLINE_HEADER_END diff --git a/src/diff3.c b/src/diff3.c index 6be7e3c..f8a48eb 100644 --- a/src/diff3.c +++ b/src/diff3.c @@ -1,7 +1,7 @@ /* GNU diff3 - compare three files line by line Copyright (C) 1988-1989, 1992-1996, 1998, 2001-2002, 2004, 2006, 2009-2013, - 2015-2021 Free Software Foundation, Inc. + 2015-2023 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,6 +16,14 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* As of GCC 11.2.1, gcc -Wanalyzer-too-complex reports that this + program's code is too complicated for gcc -fanalyzer. + FIXME: Compile with -DANALYZER_NULL_DEFERENCE and see whether the + resulting diagnostics are false alarms. */ +#if 10 <= __GNUC__ && !ANALYZER_NULL_DEREFERENCE +# pragma GCC diagnostic ignored "-Wanalyzer-null-dereference" +#endif + #include "system.h" #include "paths.h" @@ -37,7 +45,7 @@ #include <xstdopen.h> /* The official name of this program (e.g., no 'g' prefix). */ -#define PROGRAM_NAME "diff3" +static char const PROGRAM_NAME[] = "diff3"; #define AUTHORS \ proper_name ("Randy Smith") @@ -46,28 +54,24 @@ data structures for both diff3 diffs and normal diffs. */ /* Different files within a three way diff. */ -#define FILE0 0 -#define FILE1 1 -#define FILE2 2 +enum { FILE0, FILE1, FILE2 }; /* A three way diff is built from two two-way diffs; the file which the two two-way diffs share is: */ -#define FILEC FILE2 +enum { FILEC = FILE2 }; /* Different files within a two way diff. FC is the common file, FO the other file. */ -#define FO 0 -#define FC 1 +enum { FO, FC }; /* The ranges are indexed by */ -#define RANGE_START 0 -#define RANGE_END 1 +enum { RANGE_START, RANGE_END }; enum diff_type { - ERROR, /* Should not be used */ - ADD, /* Two way diff add */ - CHANGE, /* Two way diff change */ - DELETE, /* Two way diff delete */ + DIFF_ERROR, /* Should not be used */ + DIFF_ADD, /* Two way diff add */ + DIFF_CHANGE, /* Two way diff change */ + DIFF_DELETE, /* Two way diff delete */ DIFF_ALL, /* All three are different */ DIFF_1ST, /* Only the first is different */ DIFF_2ND, /* Only the second */ @@ -80,7 +84,7 @@ struct diff_block { char **lines[2]; /* The actual lines (may contain nulls) */ size_t *lengths[2]; /* Line lengths (including newlines, if any) */ struct diff_block *next; -#ifdef lint +#ifdef GCC_LINT struct diff_block *n2; /* Used only when freeing. */ #endif }; @@ -95,7 +99,11 @@ struct diff3_block { struct diff3_block *next; }; -/* Access the ranges on a diff block. */ +/* The following are macros, not functions, as they may be used as + lvalues, or they may be polymorphic in that they work with either + diff or diff3 blocks. */ + +/* Access the ranges on a diff or diff3 block. */ #define D_LOWLINE(diff, filenum) \ ((diff)->ranges[filenum][RANGE_START]) #define D_HIGHLINE(diff, filenum) \ @@ -103,7 +111,7 @@ struct diff3_block { #define D_NUMLINES(diff, filenum) \ (D_HIGHLINE (diff, filenum) - D_LOWLINE (diff, filenum) + 1) -/* Access the line numbers in a file in a diff by relative line +/* Access the line numbers in a file in a diff or diff3 block by relative line numbers (i.e. line number within the diff itself). Note that these are lvalues and can be used for assignment. */ #define D_RELNUM(diff, filenum, linenum) \ @@ -117,23 +125,23 @@ struct diff3_block { #define D_LENARRAY(diff, filenum) \ ((diff)->lengths[filenum]) -/* Next block. */ +/* Next diff or diff3 block. */ #define D_NEXT(diff) ((diff)->next) /* Access the type of a diff3 block. */ #define D3_TYPE(diff) ((diff)->correspond) -/* Line mappings based on diffs. The first maps off the top of the - diff, the second off of the bottom. */ +/* Line mappings based on diff or diff3 blocks. The first maps off + the top of the diff, the second off of the bottom. */ #define D_HIGH_MAPLINE(diff, fromfile, tofile, linenum) \ ((linenum) \ - - D_HIGHLINE ((diff), (fromfile)) \ - + D_HIGHLINE ((diff), (tofile))) + - D_HIGHLINE (diff, fromfile) \ + + D_HIGHLINE (diff, tofile)) #define D_LOW_MAPLINE(diff, fromfile, tofile, linenum) \ ((linenum) \ - - D_LOWLINE ((diff), (fromfile)) \ - + D_LOWLINE ((diff), (tofile))) + - D_LOWLINE (diff, fromfile) \ + + D_LOWLINE (diff, tofile)) /* Options variables for flags set on command line. */ @@ -181,12 +189,12 @@ static struct diff3_block *create_diff3_block (lin, lin, lin, lin, lin, lin); static struct diff3_block *make_3way_diff (struct diff_block *, struct diff_block *); static struct diff3_block *reverse_diff3_blocklist (struct diff3_block *); static struct diff3_block *using_to_diff3_block (struct diff_block *[2], struct diff_block *[2], int, int, struct diff3_block const *); -static struct diff_block *process_diff (char const *, char const *, struct diff_block **, char **); +static struct diff_block *process_diff (char const *, char const *, char **); static void check_stdout (void); -static void fatal (char const *) __attribute__((noreturn)); +static _Noreturn void fatal (char const *); static void output_diff3 (FILE *, struct diff3_block *, int const[3], int const[3]); -static void perror_with_exit (char const *) __attribute__((noreturn)); -static void try_help (char const *, char const *) __attribute__((noreturn)); +static _Noreturn void perror_with_exit (char const *); +static _Noreturn void try_help (char const *, char const *); static void usage (void); static char const *diff_program = DEFAULT_DIFF_PROGRAM; @@ -220,7 +228,7 @@ static struct option const longopts[] = static void free_diff_block (struct diff_block *p) { -#ifndef lint +#ifndef GCC_LINT (void)p; #else while (p) @@ -241,7 +249,7 @@ free_diff_block (struct diff_block *p) static void next_to_n2 (struct diff_block *p) { -#ifndef lint +#ifndef GCC_LINT (void)p; #else while (p) @@ -259,13 +267,12 @@ main (int argc, char **argv) int incompat = 0; enum { OPTION_3, OPTION_A, OPTION_E, OPTION_X, OPTION_e, OPTION_x }; bool conflicts_found; - struct diff_block *thread0, *thread1, *last_block; + struct diff_block *thread0, *thread1; struct diff3_block *diff3; int tag_count = 0; char *tag_strings[3]; char *commonname; char **file; - struct stat statb; exit_failure = EXIT_TROUBLE; initialize_main (&argc, &argv); @@ -321,7 +328,7 @@ main (int argc, char **argv) break; case 'v': version_etc (stdout, PROGRAM_NAME, PACKAGE_NAME, Version, - AUTHORS, (char *) NULL); + AUTHORS, nullptr); check_stdout (); return EXIT_SUCCESS; case DIFF_PROGRAM_OPTION: @@ -403,15 +410,6 @@ main (int argc, char **argv) for (i = 0; i < 3; i++) rev_mapping[mapping[i]] = i; - for (i = 0; i < 3; i++) - if (! STREQ (file[i], "-")) - { - if (stat (file[i], &statb) < 0) - perror_with_exit (file[i]); - else if (S_ISDIR (statb.st_mode)) - die (EXIT_TROUBLE, EISDIR, "%s", file[i]); - } - #ifdef SIGCHLD /* System V fork+wait does not work if SIGCHLD is ignored. */ signal (SIGCHLD, SIG_DFL); @@ -422,8 +420,8 @@ main (int argc, char **argv) char *b0, *b1; commonname = file[rev_mapping[FILEC]]; - thread1 = process_diff (file[rev_mapping[FILE1]], commonname, &last_block, &b1); - thread0 = process_diff (file[rev_mapping[FILE0]], commonname, &last_block, &b0); + thread1 = process_diff (file[rev_mapping[FILE1]], commonname, &b1); + thread0 = process_diff (file[rev_mapping[FILE0]], commonname, &b0); next_to_n2 (thread0); next_to_n2 (thread1); @@ -914,7 +912,7 @@ create_diff3_block (lin low0, lin high0, struct diff3_block *result = xmalloc (sizeof *result); lin numlines; - D3_TYPE (result) = ERROR; + D3_TYPE (result) = DIFF_ERROR; D_NEXT (result) = 0; /* Assign ranges */ @@ -991,7 +989,6 @@ compare_line_list (char * const list1[], size_t const lengths1[], static struct diff_block * process_diff (char const *filea, char const *fileb, - struct diff_block **last_block, char **buf_to_free) { char *diff_contents; @@ -1001,10 +998,6 @@ process_diff (char const *filea, lin i; struct diff_block *block_list; struct diff_block **block_list_end = &block_list; - struct diff_block *bptr IF_LINT (= NULL); - size_t too_many_lines = (PTRDIFF_MAX - / MIN (sizeof *bptr->lines[1], - sizeof *bptr->lengths[1])); diff_limit = read_diff (filea, fileb, &diff_contents); *buf_to_free = diff_contents; @@ -1012,12 +1005,12 @@ process_diff (char const *filea, while (scan_diff < diff_limit) { - bptr = xmalloc (sizeof *bptr); + struct diff_block *bptr = xmalloc (sizeof *bptr); bptr->lines[0] = bptr->lines[1] = 0; bptr->lengths[0] = bptr->lengths[1] = 0; dt = process_diff_control (&scan_diff, bptr); - if (dt == ERROR || *scan_diff != '\n') + if (dt == DIFF_ERROR || *scan_diff != '\n') { fprintf (stderr, _("%s: diff failed: "), program_name); do @@ -1032,13 +1025,13 @@ process_diff (char const *filea, /* Force appropriate ranges to be null, if necessary */ switch (dt) { - case ADD: + case DIFF_ADD: bptr->ranges[0][0]++; break; - case DELETE: + case DIFF_DELETE: bptr->ranges[1][0]++; break; - case CHANGE: + case DIFF_CHANGE: break; default: fatal ("internal error: invalid diff type in process_diff"); @@ -1047,13 +1040,11 @@ process_diff (char const *filea, /* Allocate space for the pointers for the lines from filea, and parcel them out among these pointers */ - if (dt != ADD) + if (dt != DIFF_ADD) { lin numlines = D_NUMLINES (bptr, 0); - if (too_many_lines <= numlines) - xalloc_die (); - bptr->lines[0] = xmalloc (numlines * sizeof *bptr->lines[0]); - bptr->lengths[0] = xmalloc (numlines * sizeof *bptr->lengths[0]); + bptr->lines[0] = xnmalloc (numlines, sizeof *bptr->lines[0]); + bptr->lengths[0] = xnmalloc (numlines, sizeof *bptr->lengths[0]); for (i = 0; i < numlines; i++) scan_diff = scan_diff_line (scan_diff, &(bptr->lines[0][i]), @@ -1063,7 +1054,7 @@ process_diff (char const *filea, } /* Get past the separator for changes */ - if (dt == CHANGE) + if (dt == DIFF_CHANGE) { if (strncmp (scan_diff, "---\n", 4)) fatal ("invalid diff format; invalid change separator"); @@ -1072,13 +1063,11 @@ process_diff (char const *filea, /* Allocate space for the pointers for the lines from fileb, and parcel them out among these pointers */ - if (dt != DELETE) + if (dt != DIFF_DELETE) { lin numlines = D_NUMLINES (bptr, 1); - if (too_many_lines <= numlines) - xalloc_die (); - bptr->lines[1] = xmalloc (numlines * sizeof *bptr->lines[1]); - bptr->lengths[1] = xmalloc (numlines * sizeof *bptr->lengths[1]); + bptr->lines[1] = xnmalloc (numlines, sizeof *bptr->lines[1]); + bptr->lengths[1] = xnmalloc (numlines, sizeof *bptr->lengths[1]); for (i = 0; i < numlines; i++) scan_diff = scan_diff_line (scan_diff, &(bptr->lines[1][i]), @@ -1092,14 +1081,13 @@ process_diff (char const *filea, block_list_end = &bptr->next; } - *block_list_end = NULL; - *last_block = bptr; + *block_list_end = nullptr; return block_list; } /* Skip tabs and spaces, and return the first character after them. */ -static char * _GL_ATTRIBUTE_PURE +static char * ATTRIBUTE_PURE skipwhite (char *s) { while (*s == ' ' || *s == '\t') @@ -1132,7 +1120,7 @@ readnum (char *s, lin *pnum) } /* Parse a normal format diff control string. Return the type of the - diff (ERROR if the format is bad). All of the other important + diff (DIFF_ERROR if the format is bad). All of the other important information is filled into to the structure pointed to by db, and the string pointer (whose location is passed to this routine) is updated to point beyond the end of the string parsed. Note that @@ -1141,8 +1129,8 @@ readnum (char *s, lin *pnum) If some specific pair of numbers has been reduced to a single number, then both corresponding numbers in the diff block are set to that number. In general these numbers are interpreted as ranges - inclusive, unless being used by the ADD or DELETE commands. It is - assumed that these will be special cased in a superior routine. */ + inclusive, unless being used by the DIFF_ADD or DIFF_DELETE commands. + It is assumed that these will be special cased in a superior routine. */ static enum diff_type process_diff_control (char **string, struct diff_block *db) @@ -1153,7 +1141,7 @@ process_diff_control (char **string, struct diff_block *db) /* Read first set of digits */ s = readnum (skipwhite (s), &db->ranges[0][RANGE_START]); if (! s) - return ERROR; + return DIFF_ERROR; /* Was that the only digit? */ s = skipwhite (s); @@ -1161,7 +1149,7 @@ process_diff_control (char **string, struct diff_block *db) { s = readnum (s + 1, &db->ranges[0][RANGE_END]); if (! s) - return ERROR; + return DIFF_ERROR; } else db->ranges[0][RANGE_END] = db->ranges[0][RANGE_START]; @@ -1171,23 +1159,23 @@ process_diff_control (char **string, struct diff_block *db) switch (*s) { case 'a': - type = ADD; + type = DIFF_ADD; break; case 'c': - type = CHANGE; + type = DIFF_CHANGE; break; case 'd': - type = DELETE; + type = DIFF_DELETE; break; default: - return ERROR; /* Bad format */ + return DIFF_ERROR; /* Bad format */ } s++; /* Past letter */ /* Read second set of digits */ s = readnum (skipwhite (s), &db->ranges[1][RANGE_START]); if (! s) - return ERROR; + return DIFF_ERROR; /* Was that the only digit? */ s = skipwhite (s); @@ -1195,7 +1183,7 @@ process_diff_control (char **string, struct diff_block *db) { s = readnum (s + 1, &db->ranges[1][RANGE_END]); if (! s) - return ERROR; + return DIFF_ERROR; s = skipwhite (s); /* To move to end */ } else @@ -1215,7 +1203,7 @@ read_diff (char const *filea, int fd, wstatus, status; int werrno = 0; struct stat pipestat; - char const *argv[9]; + char const *argv[10]; char const **ap; #if HAVE_WORKING_FORK int fds[2]; @@ -1232,6 +1220,7 @@ read_diff (char const *filea, if (strip_trailing_cr) *ap++ = "--strip-trailing-cr"; *ap++ = "--horizon-lines=100"; + *ap++ = "---no-directory"; *ap++ = "--"; *ap++ = filea; *ap++ = fileb; @@ -1278,9 +1267,9 @@ read_diff (char const *filea, #endif - if (fstat (fd, &pipestat) != 0) - perror_with_exit ("fstat"); - current_chunk_size = MAX (1, STAT_BLOCKSIZE (pipestat)); + current_chunk_size = (fstat (fd, &pipestat) == 0 + ? MAX (1, STAT_BLOCKSIZE (pipestat)) + : 8 * 1024); diff_result = xmalloc (current_chunk_size); total = 0; @@ -1435,20 +1424,18 @@ output_diff3 (FILE *outputfile, struct diff3_block *diff, int realfile = mapping[i]; lin lowt = D_LOWLINE (ptr, realfile); lin hight = D_HIGHLINE (ptr, realfile); - printint llowt = lowt; - printint lhight = hight; fprintf (outputfile, "%d:", i + 1); switch (lowt - hight) { case 1: - fprintf (outputfile, "%"pI"da\n", llowt - 1); + fprintf (outputfile, "%"pI"da\n", lowt - 1); break; case 0: - fprintf (outputfile, "%"pI"dc\n", llowt); + fprintf (outputfile, "%"pI"dc\n", lowt); break; default: - fprintf (outputfile, "%"pI"d,%"pI"dc\n", llowt, lhight); + fprintf (outputfile, "%"pI"d,%"pI"dc\n", lowt, hight); break; } @@ -1505,7 +1492,7 @@ dotlines (FILE *outputfile, struct diff3_block *b, int filenum) and continuing for NUM lines. */ static void -undotlines (FILE *outputfile, bool leading_dot, printint start, printint num) +undotlines (FILE *outputfile, bool leading_dot, lin start, lin num) { fputs (".\n", outputfile); if (leading_dot) @@ -1554,8 +1541,6 @@ output_diff3_edscript (FILE *outputfile, struct diff3_block *diff, ? DIFF_ALL : DIFF_1ST + rev_mapping[b->correspond - DIFF_1ST]); - printint low0, high0; - /* If we aren't supposed to do this output block, skip it. */ switch (type) { @@ -1565,8 +1550,8 @@ output_diff3_edscript (FILE *outputfile, struct diff3_block *diff, case DIFF_ALL: if (simple_only) continue; conflict = flagging; break; } - low0 = D_LOWLINE (b, mapping[FILE0]); - high0 = D_HIGHLINE (b, mapping[FILE0]); + lin low0 = D_LOWLINE (b, mapping[FILE0]); + lin high0 = D_HIGHLINE (b, mapping[FILE0]); if (conflict) { @@ -1,7 +1,7 @@ /* Read, sort and compare two directories. Used for GNU DIFF. Copyright (C) 1988-1989, 1992-1995, 1998, 2001-2002, 2004, 2006-2007, - 2009-2013, 2015-2021 Free Software Foundation, Inc. + 2009-2013, 2015-2023 Free Software Foundation, Inc. This file is part of GNU DIFF. @@ -126,9 +126,7 @@ dir_read (struct file_data const *dir, struct dirdata *dirdata) } /* Create the 'names' table from the 'data' table. */ - if (PTRDIFF_MAX / sizeof *names - 1 <= nnames) - xalloc_die (); - dirdata->names = names = xmalloc ((nnames + 1) * sizeof *names); + dirdata->names = names = xnmalloc (nnames + 1, sizeof *names); dirdata->nnames = nnames; for (i = 0; i < nnames; i++) { @@ -324,7 +322,7 @@ diff_dirs (struct comparison const *cmp, /* Return nonzero if CMP is looping recursively in argument I. */ -static bool _GL_ATTRIBUTE_PURE +static bool ATTRIBUTE_PURE dir_loop (struct comparison const *cmp, int i) { struct comparison const *p = cmp; @@ -339,16 +337,13 @@ dir_loop (struct comparison const *cmp, int i) char * find_dir_file_pathname (char const *dir, char const *file) { - /* The 'IF_LINT (volatile)' works around what appears to be a bug in - gcc 4.8.0 20120825; see - <http://lists.gnu.org/archive/html/bug-diffutils/2012-08/msg00007.html>. - */ + /* IF_LINT due to GCC bug 21161. */ char const * IF_LINT (volatile) match = file; char *val; struct dirdata dirdata; - dirdata.names = NULL; - dirdata.data = NULL; + dirdata.names = nullptr; + dirdata.data = nullptr; if (ignore_file_name_case) { @@ -378,7 +373,7 @@ find_dir_file_pathname (char const *dir, char const *file) } } - val = file_name_concat (dir, match, NULL); + val = file_name_concat (dir, match, nullptr); free (dirdata.names); free (dirdata.data); return val; @@ -1,7 +1,7 @@ /* Output routines for ed-script format. Copyright (C) 1988-1989, 1991-1993, 1995, 1998, 2001, 2004, 2006, 2009-2013, - 2015-2021 Free Software Foundation, Inc. + 2015-2023 Free Software Foundation, Inc. This file is part of GNU DIFF. @@ -144,7 +144,7 @@ static void print_rcs_hunk (struct change *hunk) { lin i, f0, l0, f1, l1; - printint tf0, tl0, tf1, tl1; + lin tf0, tl0, tf1, tl1; /* Determine range of line numbers involved in each file. */ enum changes changes = analyze_hunk (hunk, &f0, &l0, &f1, &l1); diff --git a/src/ifdef.c b/src/ifdef.c index d40a88e..d83a387 100644 --- a/src/ifdef.c +++ b/src/ifdef.c @@ -1,6 +1,6 @@ /* #ifdef-format output routines for GNU DIFF. - Copyright (C) 1989, 1991-1994, 2001-2002, 2004, 2006, 2009-2013, 2015-2021 + Copyright (C) 1989, 1991-1994, 2001-2002, 2004, 2006, 2009-2013, 2015-2023 Free Software Foundation, Inc. This file is part of GNU DIFF. @@ -329,7 +329,7 @@ do_printf_spec (FILE *out, char const *spec, return 0; else { - char value IF_LINT (= 0); + char value; f = scan_char_literal (f, &value); if (!f) return 0; @@ -359,16 +359,14 @@ do_printf_spec (FILE *out, char const *spec, { /* For example, if the spec is "%3xn" and pI is "l", use the printf format spec "%3lx". Here the spec prefix is "%3". */ - printint print_value = value; size_t spec_prefix_len = f - spec - 2; size_t pI_len = sizeof pI - 1; char *format = xmalloca (spec_prefix_len + pI_len + 2); - char *p = format + spec_prefix_len + pI_len; - memcpy (format, spec, spec_prefix_len); - memcpy (format + spec_prefix_len, pI, pI_len); + char *p = mempcpy (format, spec, spec_prefix_len); + p = stpcpy (p, pI); *p++ = c; *p = '\0'; - fprintf (out, format, print_value); + fprintf (out, format, value); freea (format); } } @@ -397,7 +395,7 @@ scan_char_literal (char const *lit, char *valptr) { case 0: case '\'': - return NULL; + return nullptr; case '\\': value = 0; @@ -405,18 +403,18 @@ scan_char_literal (char const *lit, char *valptr) { unsigned int digit = c - '0'; if (8 <= digit) - return NULL; + return nullptr; value = 8 * value + digit; } digits = p - lit - 2; if (! (1 <= digits && digits <= 3)) - return NULL; + return nullptr; break; default: value = c; if (*p++ != '\'') - return NULL; + return nullptr; break; } @@ -1,7 +1,7 @@ /* File I/O for GNU DIFF. Copyright (C) 1988-1989, 1992-1995, 1998, 2001-2002, 2004, 2006, 2009-2013, - 2015-2021 Free Software Foundation, Inc. + 2015-2023 Free Software Foundation, Inc. This file is part of GNU DIFF. @@ -64,6 +64,15 @@ static lin equivs_index; /* Number of elements allocated in the array 'equivs'. */ static lin equivs_alloc; +/* The file buffer, considered as an array of bytes rather than + as an array of words. */ + +static char * +file_buffer (struct file_data const *f) +{ + return (char *) f->buffer; +} + /* Read a block of data into a file buffer, checking for EOF and error. */ void @@ -72,7 +81,7 @@ file_block_read (struct file_data *current, size_t size) if (size && ! current->eof) { size_t s = block_read (current->desc, - FILE_BUFFER (current) + current->buffered, size); + file_buffer (current) + current->buffered, size); if (s == SIZE_MAX) pfatal_with_name (current->name); current->buffered += s; @@ -165,10 +174,9 @@ slurp (struct file_data *current) /* Get the size out of the stat block. Allocate just enough room for appended newline plus word sentinel, plus word-alignment since we want the buffer word-aligned. */ - size_t file_size = current->stat.st_size; - cc = file_size + 2 * sizeof (word) - file_size % sizeof (word); - if (file_size != current->stat.st_size || cc < file_size - || PTRDIFF_MAX <= cc) + off_t file_size = current->stat.st_size; + if (INT_ADD_WRAPV (2 * sizeof (word) - file_size % sizeof (word), + file_size, &cc)) xalloc_die (); if (current->bufsize < cc) @@ -233,7 +241,7 @@ find_and_hash_each_line (struct file_data *current) lin eqs_index = equivs_index; lin eqs_alloc = equivs_alloc; char const *suffix_begin = current->suffix_begin; - char const *bufend = FILE_BUFFER (current) + current->buffered; + char const *bufend = file_buffer (current) + current->buffered; bool ig_case = ignore_case; enum DIFF_white_space ig_white_space = ignore_white_space; bool diff_length_compare_anyway = @@ -348,7 +356,7 @@ find_and_hash_each_line (struct file_data *current) if (p == bufend && current->missing_newline - && ROBUST_OUTPUT_STYLE (output_style)) + && robust_output_style (output_style)) { /* The last line is incomplete and we do not silently complete lines. If the line cannot compare equal to any @@ -447,7 +455,7 @@ find_and_hash_each_line (struct file_data *current) { /* If the last line is incomplete and we do not silently complete lines, don't count its appended newline. */ - if (current->missing_newline && ROBUST_OUTPUT_STYLE (output_style)) + if (current->missing_newline && robust_output_style (output_style)) linbuf[line]--; break; } @@ -480,7 +488,7 @@ static void prepare_text (struct file_data *current) { size_t buffered = current->buffered; - char *p = FILE_BUFFER (current); + char *p = file_buffer (current); if (!p) return; @@ -590,7 +598,7 @@ find_identical_ends (struct file_data filevec[]) p0++, p1++; /* Don't mistakenly count missing newline as part of prefix. */ - if (ROBUST_OUTPUT_STYLE (output_style) + if (robust_output_style (output_style) && ((buffer0 + n0 - filevec[0].missing_newline < p0) != (buffer1 + n1 - filevec[1].missing_newline < p1))) @@ -615,7 +623,7 @@ find_identical_ends (struct file_data filevec[]) p0 = buffer0 + n0; p1 = buffer1 + n1; - if (! ROBUST_OUTPUT_STYLE (output_style) + if (! robust_output_style (output_style) || filevec[0].missing_newline == filevec[1].missing_newline) { end0 = p0; /* Addr of last char in file 0. */ @@ -716,11 +724,11 @@ find_identical_ends (struct file_data filevec[]) middle_guess = guess_lines (lines, p0 - buffer0, p1 - filevec[1].prefix_end); suffix_guess = guess_lines (lines, p0 - buffer0, buffer1 + n1 - p1); - alloc_lines1 = buffered_prefix + middle_guess + MIN (context, suffix_guess); - if (alloc_lines1 < buffered_prefix - || PTRDIFF_MAX / sizeof *linbuf1 <= alloc_lines1) + if (INT_ADD_WRAPV (buffered_prefix, + middle_guess + MIN (context, suffix_guess), + &alloc_lines1)) xalloc_die (); - linbuf1 = xmalloc (alloc_lines1 * sizeof *linbuf1); + linbuf1 = xnmalloc (alloc_lines1, sizeof *linbuf1); if (buffered_prefix != lines) { @@ -791,9 +799,7 @@ read_files (struct file_data filevec[], bool pretend_binary) find_identical_ends (filevec); equivs_alloc = filevec[0].alloc_lines + filevec[1].alloc_lines + 1; - if (PTRDIFF_MAX / sizeof *equivs <= equivs_alloc) - xalloc_die (); - equivs = xmalloc (equivs_alloc * sizeof *equivs); + equivs = xnmalloc (equivs_alloc, sizeof *equivs); /* Equivalence class 0 is permanently safe for lines that were not hashed. Real equivalence classes start at 1. */ equivs_index = 1; @@ -804,9 +810,7 @@ read_files (struct file_data filevec[], bool pretend_binary) for (i = 9; (size_t) 1 << i < equivs_alloc / 3; i++) continue; nbuckets = ((size_t) 1 << i) - prime_offset[i]; - if (PTRDIFF_MAX / sizeof *buckets <= nbuckets) - xalloc_die (); - buckets = zalloc ((nbuckets + 1) * sizeof *buckets); + buckets = xcalloc (nbuckets + 1, sizeof *buckets); buckets++; for (i = 0; i < 2; i++) diff --git a/src/normal.c b/src/normal.c index f76c1ac..fef4bf3 100644 --- a/src/normal.c +++ b/src/normal.c @@ -1,6 +1,6 @@ /* Normal-format output routines for GNU DIFF. - Copyright (C) 1988-1989, 1993, 1995, 1998, 2001, 2006, 2009-2013, 2015-2021 + Copyright (C) 1988-1989, 1993, 1995, 1998, 2001, 2006, 2009-2013, 2015-2023 Free Software Foundation, Inc. This file is part of GNU DIFF. diff --git a/src/sdiff.c b/src/sdiff.c index 232ebcd..0b638d4 100644 --- a/src/sdiff.c +++ b/src/sdiff.c @@ -1,7 +1,7 @@ /* GNU sdiff - side-by-side merge of file differences Copyright (C) 1992-1996, 1998, 2001-2002, 2004, 2006-2007, 2009-2013, - 2015-2021 Free Software Foundation, Inc. + 2015-2023 Free Software Foundation, Inc. This file is part of GNU DIFF. @@ -38,13 +38,13 @@ #include <xstdopen.h> /* The official name of this program (e.g., no 'g' prefix). */ -#define PROGRAM_NAME "sdiff" +static char const PROGRAM_NAME[] = "sdiff"; #define AUTHORS \ proper_name ("Thomas Lord") /* Size of chunks read from files which must be parsed into lines. */ -#define SDIFF_BUFSIZE ((size_t) 65536) +enum { SDIFF_BUFSIZE = 65536 }; static char const *editor_program = DEFAULT_EDITOR_PROGRAM; static char const **diffargv; @@ -63,8 +63,8 @@ static bool edit (struct line_filter *, char const *, lin, lin, struct line_filt static bool interact (struct line_filter *, struct line_filter *, char const *, struct line_filter *, char const *, FILE *); static void checksigs (void); static void diffarg (char const *); -static void fatal (char const *) __attribute__((noreturn)); -static void perror_fatal (char const *) __attribute__((noreturn)); +static _Noreturn void fatal (char const *); +static _Noreturn void perror_fatal (char const *); static void trapsigs (void); static void untrapsig (int); @@ -151,8 +151,7 @@ static struct option const longopts[] = {0, 0, 0, 0} }; -static void try_help (char const *, char const *) __attribute__((noreturn)); -static void +static _Noreturn void try_help (char const *reason_msgid, char const *operand) { if (reason_msgid) @@ -225,7 +224,7 @@ Mandatory arguments to long options are mandatory for short options too.\n\ /* Clean up after a signal or other failure. This function is async-signal-safe. */ static void -cleanup (int signo __attribute__((unused))) +cleanup (_GL_UNUSED int signo) { #if HAVE_WORKING_FORK if (0 < diffpid) @@ -235,8 +234,7 @@ cleanup (int signo __attribute__((unused))) unlink (tmpname); } -static void exiterr (void) __attribute__((noreturn)); -static void +static _Noreturn void exiterr (void) { cleanup (0); @@ -337,10 +335,10 @@ expand_name (char *name, bool is_dir, char const *other_name) size_t namelen = strlen (name), baselen = base_len (base); bool insert_slash = *last_component (name) && name[namelen - 1] != '/'; char *r = xmalloc (namelen + insert_slash + baselen + 1); - memcpy (r, name, namelen); - r[namelen] = '/'; - memcpy (r + namelen + insert_slash, base, baselen); - r[namelen + insert_slash + baselen] = '\0'; + char *p = stpcpy (r, name); + *p = '/'; + p = mempcpy (p + insert_slash, base, baselen); + *p = '\0'; return r; } } @@ -429,17 +427,16 @@ lf_snarf (struct line_filter *lf, char *buffer, size_t bufsize) size_t s = next - start; if (bufsize <= s) return 0; - memcpy (buffer, start, s); + buffer = mempcpy (buffer, start, s); + bufsize -= s; if (next < lf->buflim) { - buffer[s] = 0; + *buffer = 0; lf->bufpos = next + 1; return 1; } if (! lf_refill (lf)) return s ? 0 : EOF; - buffer += s; - bufsize -= s; } } @@ -521,7 +518,7 @@ main (int argc, char *argv[]) case 'v': version_etc (stdout, PROGRAM_NAME, PACKAGE_NAME, Version, - AUTHORS, (char *) NULL); + AUTHORS, nullptr); check_stdout (); return EXIT_SUCCESS; @@ -866,8 +863,8 @@ edit (struct line_filter *left, char const *lname, lin lline, lin llen, { for (;;) { - int cmd0 IF_LINT (= 0); - int cmd1 IF_LINT (= 0); + int cmd0; + int cmd1 IF_LINT (= 0); /* IF_LINT due to GCC bug 101770. */ bool gotcmd = false; while (! gotcmd) @@ -968,14 +965,13 @@ edit (struct line_filter *left, char const *lname, lin lline, lin llen, { case 'd': if (llen) - { - printint l1 = lline; - printint l2 = lline + llen - 1; - if (llen == 1) - fprintf (tmp, "--- %s %"pI"d\n", lname, l1); - else - fprintf (tmp, "--- %s %"pI"d,%"pI"d\n", lname, l1, l2); - } + { + if (llen == 1) + fprintf (tmp, "--- %s %"pI"d\n", lname, lline); + else + fprintf (tmp, "--- %s %"pI"d,%"pI"d\n", lname, lline, + lline + llen - 1); + } FALLTHROUGH; case '1': case 'b': case 'l': lf_copy (left, llen, tmp); @@ -990,14 +986,13 @@ edit (struct line_filter *left, char const *lname, lin lline, lin llen, { case 'd': if (rlen) - { - printint l1 = rline; - printint l2 = rline + rlen - 1; - if (rlen == 1) - fprintf (tmp, "+++ %s %"pI"d\n", rname, l1); - else - fprintf (tmp, "+++ %s %"pI"d,%"pI"d\n", rname, l1, l2); - } + { + if (rlen == 1) + fprintf (tmp, "+++ %s %"pI"d\n", rname, rline); + else + fprintf (tmp, "+++ %s %"pI"d,%"pI"d\n", rname, rline, + rline + rlen - 1); + } FALLTHROUGH; case '2': case 'b': case 'r': lf_copy (right, rlen, tmp); @@ -1166,10 +1161,11 @@ temporary_file (void) char const *tmpdir = getenv (TMPDIR_ENV); char const *dir = tmpdir ? tmpdir : P_tmpdir; char *buf = xmalloc (strlen (dir) + 1 + 5 + 6 + 1); - int fd; - sprintf (buf, "%s/sdiffXXXXXX", dir); - fd = mkstemp (buf); - if (0 <= fd) + strcpy (stpcpy (buf, dir), "/sdiffXXXXXX"); + int fd = mkstemp (buf); + if (fd < 0) + free (buf); + else tmpname = buf; return fd; } @@ -1,6 +1,6 @@ /* sdiff-format output routines for GNU DIFF. - Copyright (C) 1991-1993, 1998, 2001-2002, 2004, 2009-2013, 2015-2021 Free + Copyright (C) 1991-1993, 1998, 2001-2002, 2004, 2009-2013, 2015-2023 Free Software Foundation, Inc. This file is part of GNU DIFF. @@ -259,11 +259,7 @@ print_sdiff_common_lines (lin limit0, lin limit1) if (!suppress_common_lines && (i0 != limit0 || i1 != limit1)) { if (sdiff_merge_assist) - { - printint len0 = limit0 - i0; - printint len1 = limit1 - i1; - fprintf (outfile, "i%"pI"d,%"pI"d\n", len0, len1); - } + fprintf (outfile, "i%"pI"d,%"pI"d\n", limit0 - i0, limit1 - i1); if (!left_column) { @@ -301,11 +297,9 @@ print_sdiff_hunk (struct change *hunk) print_sdiff_common_lines (first0, first1); if (sdiff_merge_assist) - { - printint len0 = last0 - first0 + 1; - printint len1 = last1 - first1 + 1; - fprintf (outfile, "c%"pI"d,%"pI"d\n", len0, len1); - } + fprintf (outfile, "c%"pI"d,%"pI"d\n", + last0 - first0 + 1, + last1 - first1 + 1); /* Print "xxx | xxx " lines. */ if (changes == CHANGED) diff --git a/src/system.h b/src/system.h index f921a50..b37893f 100644 --- a/src/system.h +++ b/src/system.h @@ -1,7 +1,7 @@ /* System dependent declarations. Copyright (C) 1988-1989, 1992-1995, 1998, 2001-2002, 2004, 2006, 2009-2013, - 2015-2021 Free Software Foundation, Inc. + 2015-2023 Free Software Foundation, Inc. This file is part of GNU DIFF. @@ -21,24 +21,18 @@ #include <config.h> /* Use this to suppress gcc's "...may be used before initialized" warnings. */ -#ifdef lint +#ifdef GCC_LINT # define IF_LINT(Code) Code #else # define IF_LINT(Code) /* empty */ #endif -/* Define '__attribute__' and 'volatile' first - so that they're used consistently in all system includes. */ -#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 6) || __STRICT_ANSI__ -# define __attribute__(x) -#endif - #include <verify.h> #include <sys/types.h> #include <sys/stat.h> -#include "stat-macros.h" +#include <stat-macros.h> #ifndef STAT_BLOCKSIZE # if HAVE_STRUCT_STAT_ST_BLKSIZE @@ -114,9 +108,10 @@ int strcasecmp (char const *, char const *); #define MIN(a, b) ((a) <= (b) ? (a) : (b)) #define MAX(a, b) ((a) >= (b) ? (a) : (b)) -#include <stdbool.h> +#include <attribute.h> #include <intprops.h> -#include "propername.h" +#include <propername.h> + #include "version.h" /* Type used for fast comparison of several bytes at a time. @@ -128,31 +123,12 @@ int strcasecmp (char const *, char const *); #endif /* The signed integer type of a line number. Since files are read - into main memory, ptrdiff_t should be wide enough. */ + into main memory, ptrdiff_t should be wide enough. pI is for + printing line numbers. */ typedef ptrdiff_t lin; #define LIN_MAX PTRDIFF_MAX - -/* The signed integer type for printing line numbers, and its printf - length modifier. This is not simply ptrdiff_t, to cater to older - and/or nonstandard C libraries where "l" works but "ll" and "t" do - not, or where 'long' is too narrow and "ll" works but "t" does not. */ - -#if LIN_MAX <= LONG_MAX -typedef long int printint; -# define pI "l" -#elif LIN_MAX <= LLONG_MAX -typedef long long int printint; -# define pI "ll" -#else -typedef ptrdiff_t printint; -# define pI "t" -#endif - -verify (TYPE_SIGNED (lin)); -verify (TYPE_SIGNED (printint)); -verify (LIN_MAX == TYPE_MAXIMUM (lin)); -verify (LIN_MAX <= TYPE_MAXIMUM (printint)); +#define pI "t" /* Limit so that 2 * CONTEXT + 1 does not overflow. */ @@ -230,11 +206,3 @@ verify (LIN_MAX <= TYPE_MAXIMUM (printint)); #endif #define STREQ(a, b) (strcmp (a, b) == 0) - -#ifndef FALLTHROUGH -# if __GNUC__ < 7 -# define FALLTHROUGH ((void) 0) -# else -# define FALLTHROUGH __attribute__ ((__fallthrough__)) -# endif -#endif @@ -1,7 +1,7 @@ /* Support routines for GNU DIFF. Copyright (C) 1988-1989, 1992-1995, 1998, 2001-2002, 2004, 2006, 2009-2013, - 2015-2021 Free Software Foundation, Inc. + 2015-2023 Free Software Foundation, Inc. This file is part of GNU DIFF. @@ -19,23 +19,25 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "diff.h" -#include "argmatch.h" -#include "die.h" + +#include <argmatch.h> +#include <die.h> #include <dirname.h> #include <error.h> +#include <flexmember.h> #include <system-quote.h> #include <xalloc.h> -#include "xvasprintf.h" + +#include <stdarg.h> #include <signal.h> /* Use SA_NOCLDSTOP as a proxy for whether the sigaction machinery is present. */ #ifndef SA_NOCLDSTOP # define SA_NOCLDSTOP 0 -# define sigprocmask(How, Set, Oset) /* empty */ -# define sigset_t int +# define sigprocmask(How, Set, Oset) 0 # if ! HAVE_SIGINTERRUPT -# define siginterrupt(sig, flag) /* empty */ +# define siginterrupt(sig, flag) 0 # endif #endif @@ -51,7 +53,15 @@ char const pr_program[] = PR_PROGRAM; struct msg { struct msg *next; - char args[1]; /* Format + 4 args, each '\0' terminated, concatenated. */ + + /* Msgid of printf-style format. */ + char const *msgid; + + /* Number of bytes in ARGS. */ + size_t argbytes; + + /* Arg strings, each '\0' terminated, concatenated. */ + char args[FLEXIBLE_ARRAY_MEMBER]; }; /* Head of the chain of queues messages. */ @@ -91,40 +101,43 @@ fatal (char const *msgid) } /* Like printf, except if -l in effect then save the message and print later. + Also, all arguments must be char * or char const *. This is used for things like "Only in ...". */ void -message (char const *format_msgid, char const *arg1, char const *arg2) +message (char const *format_msgid, ...) { - message5 (format_msgid, arg1, arg2, 0, 0); -} + va_list ap; + va_start (ap, format_msgid); -void -message5 (char const *format_msgid, char const *arg1, char const *arg2, - char const *arg3, char const *arg4) -{ if (paginate) { - char *p; - char const *arg[5]; - int i; - size_t size[5]; - size_t total_size = offsetof (struct msg, args); - struct msg *new; - - arg[0] = format_msgid; - arg[1] = arg1; - arg[2] = arg2; - arg[3] = arg3 ? arg3 : ""; - arg[4] = arg4 ? arg4 : ""; - - for (i = 0; i < 5; i++) - total_size += size[i] = strlen (arg[i]) + 1; - - new = xmalloc (total_size); - - for (i = 0, p = new->args; i < 5; p += size[i++]) - memcpy (p, arg[i], size[i]); + size_t argbytes = 0; + + for (char const *m = format_msgid; *m; m++) + if (*m == '%') + { + if (m[1] == '%') + m++; + else + argbytes += strlen (va_arg (ap, char const *)) + 1; + } + va_end (ap); + + struct msg *new = xmalloc (FLEXSIZEOF (struct msg, args, argbytes)); + new->msgid = format_msgid; + new->argbytes = argbytes; + + va_start (ap, format_msgid); + char *p = new->args; + for (char const *m = format_msgid; *m; m++) + if (*m == '%') + { + if (m[1] == '%') + m++; + else + p = stpcpy (p, va_arg (ap, char const *)) + 1; + } *msg_chain_end = new; new->next = 0; @@ -134,8 +147,10 @@ message5 (char const *format_msgid, char const *arg1, char const *arg2, { if (sdiff_merge_assist) putchar (' '); - printf (_(format_msgid), arg1, arg2, arg3, arg4); + vprintf (_(format_msgid), ap); } + + va_end (ap); } /* Output all the messages that were saved up by calls to 'message'. */ @@ -143,32 +158,74 @@ message5 (char const *format_msgid, char const *arg1, char const *arg2, void print_message_queue (void) { - char const *arg[5]; - int i; - struct msg *m = msg_chain; - - while (m) + for (struct msg *m = msg_chain; m; ) { + /* Change this if diff ever has messages with more than 4 args. */ + char const *p = m->args; + char const *plim = p + m->argbytes; + /* Unroll the loop to work around GCC 12 bug with + -Wanalyzer-use-of-uninitialized-value. */ + char const *arg0 = p; p += p < plim ? strlen (p) + 1 : 0; + char const *arg1 = p; p += p < plim ? strlen (p) + 1 : 0; + char const *arg2 = p; p += p < plim ? strlen (p) + 1 : 0; + char const *arg3 = p; p += p < plim ? strlen (p) + 1 : 0; + printf (_(m->msgid), arg0, arg1, arg2, arg3); + if (p < plim) + abort (); struct msg *next = m->next; - arg[0] = m->args; - for (i = 0; i < 4; i++) - arg[i + 1] = arg[i] + strlen (arg[i]) + 1; - printf (_(arg[0]), arg[1], arg[2], arg[3], arg[4]); free (m); m = next; } } - -/* The set of signals that are caught. */ +/* Signal handling, needed for restoring default colors. */ + +static void +xsigaddset (sigset_t *set, int sig) +{ + if (sigaddset (set, sig) != 0) + pfatal_with_name ("sigaddset"); +} + +static bool +xsigismember (sigset_t const *set, int sig) +{ + int mem = sigismember (set, sig); + if (mem < 0) + pfatal_with_name ("sigismember"); + assume (mem <= 1); + return mem; +} + +typedef void (*signal_handler) (int); +static signal_handler +xsignal (int sig, signal_handler func) +{ + signal_handler h = signal (sig, func); + if (h == SIG_ERR) + pfatal_with_name ("signal"); + return h; +} + +static void +xsigprocmask (int how, sigset_t const *restrict set, sigset_t *restrict oset) +{ + if (sigprocmask (how, set, oset) != 0) + pfatal_with_name ("sigprocmask"); +} + +/* If true, some signals are caught. This is separate from + 'caught_signals' because POSIX doesn't require an all-zero sigset_t + to be valid. */ +static bool some_signals_caught; + +/* The set of signals that are caught. */ static sigset_t caught_signals; /* If nonzero, the value of the pending fatal signal. */ - static sig_atomic_t volatile interrupt_signal; /* A count of the number of pending stop signals that have been received. */ - static sig_atomic_t volatile stop_signal_count; /* An ordinary signal was received; arrange for the program to exit. */ @@ -201,21 +258,17 @@ stophandler (int sig) static void process_signals (void) { - while (interrupt_signal || stop_signal_count) + while (interrupt_signal | stop_signal_count) { - int sig; - int stops; - sigset_t oldset; - set_color_context (RESET_CONTEXT); fflush (stdout); - sigprocmask (SIG_BLOCK, &caught_signals, &oldset); + sigset_t oldset; + xsigprocmask (SIG_BLOCK, &caught_signals, &oldset); - /* Reload interrupt_signal and stop_signal_count, in case a new - signal was handled before sigprocmask took effect. */ - sig = interrupt_signal; - stops = stop_signal_count; + /* Reload stop_signal_count and (if needed) interrupt_signal, in + case a new signal was handled before sigprocmask took effect. */ + int stops = stop_signal_count, sig; /* SIGTSTP is special, since the application can receive that signal more than once. In this case, don't set the signal handler to the @@ -226,82 +279,122 @@ process_signals (void) sig = SIGSTOP; } else - signal (sig, SIG_DFL); + { + sig = interrupt_signal; + xsignal (sig, SIG_DFL); + } /* Exit or suspend the program. */ - raise (sig); - sigprocmask (SIG_SETMASK, &oldset, NULL); + if (raise (sig) != 0) + pfatal_with_name ("raise"); + xsigprocmask (SIG_SETMASK, &oldset, nullptr); /* If execution reaches here, then the program has been continued (after being suspended). */ } } -static void -install_signal_handlers (void) -{ - /* The signals that are trapped, and the number of such signals. */ - static int const sig[] = - { - /* This one is handled specially. */ - SIGTSTP, +/* The signals that can be caught, the number of such signals, + and which of them are actually caught. */ +static int const sig[] = + { +#ifdef SIGTSTP + /* This one is handled specially; see is_tstp_index. */ + SIGTSTP, +#endif - /* The usual suspects. */ - SIGALRM, SIGHUP, SIGINT, SIGPIPE, SIGQUIT, SIGTERM, + /* The usual suspects. */ +#ifdef SIGALRM + SIGALRM, +#endif + SIGHUP, SIGINT, SIGPIPE, +#ifdef SIGQUIT + SIGQUIT, +#endif + SIGTERM, #ifdef SIGPOLL - SIGPOLL, + SIGPOLL, #endif #ifdef SIGPROF - SIGPROF, + SIGPROF, #endif #ifdef SIGVTALRM - SIGVTALRM, + SIGVTALRM, #endif #ifdef SIGXCPU - SIGXCPU, + SIGXCPU, #endif #ifdef SIGXFSZ - SIGXFSZ, + SIGXFSZ, #endif - }; - enum { nsigs = sizeof (sig) / sizeof *(sig) }; + }; +enum { nsigs = sizeof (sig) / sizeof *(sig) }; -#if ! SA_NOCLDSTOP - bool caught_sig[nsigs]; +/* True if sig[j] == SIGTSTP. */ +static bool +is_tstp_index (int j) +{ +#ifdef SIGTSTP + return j == 0; +#else + return false; #endif - { - int j; -#if SA_NOCLDSTOP - struct sigaction act; +} - sigemptyset (&caught_signals); - for (j = 0; j < nsigs; j++) - { - sigaction (sig[j], NULL, &act); - if (act.sa_handler != SIG_IGN) - sigaddset (&caught_signals, sig[j]); - } +static void +install_signal_handlers (void) +{ + if (sigemptyset (&caught_signals) != 0) + pfatal_with_name ("sigemptyset"); - act.sa_mask = caught_signals; - act.sa_flags = SA_RESTART; +#if SA_NOCLDSTOP + for (int j = 0; j < nsigs; j++) + { + struct sigaction actj; + if (sigaction (sig[j], nullptr, &actj) == 0 && actj.sa_handler != SIG_IGN) + xsigaddset (&caught_signals, sig[j]); + } - for (j = 0; j < nsigs; j++) - if (sigismember (&caught_signals, sig[j])) - { - act.sa_handler = sig[j] == SIGTSTP ? stophandler : sighandler; - sigaction (sig[j], &act, NULL); - } -#else - for (j = 0; j < nsigs; j++) + struct sigaction act; + act.sa_mask = caught_signals; + act.sa_flags = SA_RESTART; + + for (int j = 0; j < nsigs; j++) + if (xsigismember (&caught_signals, sig[j])) { - caught_sig[j] = (signal (sig[j], SIG_IGN) != SIG_IGN); - if (caught_sig[j]) - { - signal (sig[j], sig[j] == SIGTSTP ? stophandler : sighandler); - siginterrupt (sig[j], 0); - } + act.sa_handler = is_tstp_index (j) ? stophandler : sighandler; + if (sigaction (sig[j], &act, nullptr) != 0) + pfatal_with_name ("sigaction"); + some_signals_caught = true; } +#else + for (int j = 0; j < nsigs; j++) + { + signal_handler h = signal (sig[j], SIG_IGN); + if (h != SIG_IGN && h != SIG_ERR) + { + xsigaddset (&caught_signals, sig[j]); + xsignal (sig[j], is_tstp_index (j) ? stophandler : sighandler); + some_signals_caught = true; + if (siginterrupt (sig[j], 0) != 0) + pfatal_with_name ("siginterrupt"); + } + } #endif +} + +/* Clean up signal handlers just before exiting the program. Do this + by resetting signal actions back to default, and then processing + any signals that arrived before resetting. */ +void +cleanup_signal_handlers (void) +{ + if (some_signals_caught) + { + for (int j = 0; j < nsigs; j++) + if (xsigismember (&caught_signals, sig[j])) + xsignal (sig[j], SIG_DFL); + process_signals (); } } @@ -310,7 +403,7 @@ static char const *current_name1; static bool currently_recursive; static bool colors_enabled; -static struct color_ext_type *color_ext_list = NULL; +static struct color_ext_type *color_ext_list = nullptr; struct bin_str { @@ -549,7 +642,7 @@ static struct bin_str color_indicator[] = { { LEN_STR_PAIR ("\033[") }, /* lc: Left of color sequence */ { LEN_STR_PAIR ("m") }, /* rc: Right of color sequence */ - { 0, NULL }, /* ec: End color (replaces lc+rs+rc) */ + { 0, nullptr }, /* ec: End color (replaces lc+rs+rc) */ { LEN_STR_PAIR ("0") }, /* rs: Reset to ordinary colors */ { LEN_STR_PAIR ("1") }, /* hd: Header */ { LEN_STR_PAIR ("32") }, /* ad: Add line */ @@ -559,7 +652,7 @@ static struct bin_str color_indicator[] = static const char *const indicator_name[] = { - "lc", "rc", "ec", "rs", "hd", "ad", "de", "ln", NULL + "lc", "rc", "ec", "rs", "hd", "ad", "de", "ln", nullptr }; ARGMATCH_VERIFY (indicator_name, color_indicator); @@ -578,14 +671,14 @@ parse_diff_color (void) const char *p; /* Pointer to character being parsed */ char *buf; /* color_buf buffer pointer */ int ind_no; /* Indicator number */ - char label[3]; /* Indicator label */ + char label[] = "??"; /* Indicator label */ struct color_ext_type *ext; /* Extension we are working on */ - if ((p = color_palette) == NULL || *p == '\0') + p = color_palette; + if (p == nullptr || *p == '\0') return; - ext = NULL; - strcpy (label, "??"); + ext = nullptr; /* This is an overly conservative estimate, but any possible --palette string will *not* generate a color_buf longer than @@ -647,7 +740,7 @@ parse_diff_color (void) state = PS_FAIL; /* Assume failure... */ if (*(p++) == '=')/* It *should* be... */ { - for (ind_no = 0; indicator_name[ind_no] != NULL; ++ind_no) + for (ind_no = 0; indicator_name[ind_no] != nullptr; ++ind_no) { if (STREQ (label, indicator_name[ind_no])) { @@ -691,7 +784,7 @@ parse_diff_color (void) error (0, 0, _("unparsable value for --palette")); free (color_buf); - for (e = color_ext_list; e != NULL; /* empty */) + for (e = color_ext_list; e != nullptr; /* empty */) { e2 = e; e = e->next; @@ -842,7 +935,14 @@ begin_output (void) of the pathnames, and it requires two spaces after "diff" if there are no options. These requirements are silly and do not match historical practice. */ - name = xasprintf ("diff%s %s %s", switch_string, names[0], names[1]); + name = xmalloc (sizeof "diff" + strlen (switch_string) + + 1 + strlen (names[0]) + 1 + strlen (names[1])); + char *p = stpcpy (name, "diff"); + p = stpcpy (p, switch_string); + *p++ = ' '; + p = stpcpy (p, names[0]); + *p++ = ' '; + strcpy (p, names[1]); if (paginate) { @@ -1145,13 +1245,13 @@ lines_differ (char const *s1, char const *s2) /* Find the consecutive changes at the start of the script START. Return the last link before the first gap. */ -struct change * _GL_ATTRIBUTE_CONST +struct change * ATTRIBUTE_CONST find_change (struct change *start) { return start; } -struct change * _GL_ATTRIBUTE_CONST +struct change * ATTRIBUTE_CONST find_reverse_change (struct change *start) { return start; @@ -1393,20 +1493,18 @@ char const change_letter[] = { 0, 'd', 'a', 'c' }; Internal line numbers count from 0 starting after the prefix. Actual line numbers count from 1 within the entire file. */ -lin _GL_ATTRIBUTE_PURE +lin ATTRIBUTE_PURE translate_line_number (struct file_data const *file, lin i) { return i + file->prefix_lines + 1; } -/* Translate a line number range. This is always done for printing, - so for convenience translate to printint rather than lin, so that the - caller can use printf with "%"pI"d" without casting. */ +/* Translate a line number range. */ void translate_range (struct file_data const *file, lin a, lin b, - printint *aptr, printint *bptr) + lin *aptr, lin *bptr) { *aptr = translate_line_number (file, a - 1) + 1; *bptr = translate_line_number (file, b + 1) - 1; @@ -1421,7 +1519,7 @@ translate_range (struct file_data const *file, void print_number_range (char sepchar, struct file_data *file, lin a, lin b) { - printint trans_a, trans_b; + lin trans_a, trans_b; translate_range (file, a, b, &trans_a, &trans_b); /* Note: we can have B < A in the case of a range of no lines. @@ -1537,40 +1635,16 @@ analyze_hunk (struct change *hunk, return (show_from ? OLD : UNCHANGED) | (show_to ? NEW : UNCHANGED); } -/* Concatenate three strings, returning a newly malloc'd string. */ - -char * -concat (char const *s1, char const *s2, char const *s3) -{ - char *new = xmalloc (strlen (s1) + strlen (s2) + strlen (s3) + 1); - sprintf (new, "%s%s%s", s1, s2, s3); - return new; -} - -/* Yield a new block of SIZE bytes, initialized to zero. */ - -void * -zalloc (size_t size) -{ - void *p = xmalloc (size); - memset (p, 0, size); - return p; -} - +#ifdef DEBUG void debug_script (struct change *sp) { fflush (stdout); for (; sp; sp = sp->link) - { - printint line0 = sp->line0; - printint line1 = sp->line1; - printint deleted = sp->deleted; - printint inserted = sp->inserted; - fprintf (stderr, "%3"pI"d %3"pI"d delete %"pI"d insert %"pI"d\n", - line0, line1, deleted, inserted); - } + fprintf (stderr, "%3"pI"d %3"pI"d delete %"pI"d insert %"pI"d\n", + sp->line0, sp->line1, sp->deleted, sp->inserted); fflush (stderr); } +#endif |