summaryrefslogtreecommitdiff
path: root/src/diff3.c
Commit message (Collapse)AuthorAgeFilesLines
* maint: update all copyright year number rangesJim Meyering2012-01-011-1/+1
| | | | Run "make update-copyright".
* build: update to latest gnulib and adaptJim Meyering2011-12-141-1/+1
| | | | | | | | | | | | | | | | | * tests/binary: Reverse arguments to compare to avoid failure of new syntax-check rule. * configure.ac: Use -Wno-format-nonliteral. Mark functions as pure of const, per recommendations enabled by new gcc -W options. Use _GL_ATTRIBUTE_PURE and _GL_ATTRIBUTE_CONST. * lib/cmpbuf.h (buffer_lcm, block_compare): Apply pure and/or const attributes. * src/cmp.c (block_compare): Likewise. * src/context.c (find_hunk): Likewise. * src/diff.h (lines_differ): Likewise. * src/diff3.c (skipwhite): Likewise. * src/dir.c (dir_loop): Likewise. * src/util.c (find_change, find_reverse_change): Likewise. (translate_line_number): Likewise.
* maint: remove inclusion of unused header, for "make syntax-check"Jim Meyering2011-07-031-1/+0
| | | | | * src/diff3.c: Don't include <inttostr.h>. Not used. * src/context.c: Likewise.
* build: ccache works better without embedded version stringsJim Meyering2011-06-131-1/+1
| | | | | | | | | | | | | * src/Makefile.am: Generate version.c and version.h and put the new symbol in a tiny library to be used by each program. (LDADD): Add the new library. * src/cmp.c (main): Use Version, not PACKAGE_VERSION, so the .o file does not change with each commit-derived version increment. * src/diff.c (main): Likewise. * src/diff3.c (main): Likewise. * src/sdiff.c (main): Likewise. * src/system.h: Include "version.h". * .gitignore: Add version.[ch]
* cmp, diff, diff3, sdiff: edit and align --help text.Karl Berry2011-06-081-15/+34
| | | | | | | | * cmp.c (option_help_msgid, usage), * diff.c (option_help_msgid, usage), * diff3.c (option_help_msgid, usage), * sdiff.c (option_help_msgid, usage): align descriptions in the --help output and slightly edit content.
* maint: remove all uses of vfork: use fork insteadJim Meyering2011-01-241-3/+3
| | | | | | | | | | | | | Our use of vfork now provokes warnings from gcc-4.6.0. Also, vfork is no longer even specified by POSIX.1-2008. * src/diff3.c (read_diff): Change each use of vfork to "fork". Remove #ifdef'd code. * src/util.c (begin_output, finish_output): Likewise. * src/sdiff.c (cleanup, main, edit): Likewise. (handler_index_of_SIGPIPE): Remove now-unused definition. * src/system.h: Don't include <vfork.h>. (vfork): Remove definition. * ms/config.site: Remove reference to vfork cache variable.
* maint: avoid new syntax-check failureJim Meyering2011-01-231-1/+1
| | | | | * src/diff.c (specify_value): Use !STREQ(...), not strcmp(...) != 0. * src/diff3.c (main): Likewise.
* maint: update copyright year ranges to include 2011Jim Meyering2011-01-031-1/+1
| | | | Run "make update-copyright", so "make syntax-check" works in 2011.
* maint: update all FSF copyright year lists to include 2010Jim Meyering2010-01-011-1/+1
| | | | | | Use this command: git ls-files |grep -vE '^(\..*|COPYING|gnulib)$' |xargs \ env UPDATE_COPYRIGHT_USE_INTERVALS=1 build-aux/update-copyright
* use xfreopen rather than freopenJim Meyering2009-11-201-3/+3
| | | | | | | | | * src/cmp.c: Include "xfreopen.h". Use xfreopen in place of freopen. * src/diff.c Likewise, and... (main): Set exit_failure to EXIT_TROUBLE, rather than to 2. * src/diff3.c: Likewise. * bootstrap.conf (gnulib_modules): Add xfreopen.
* maint: remove dead assignment from diff3.cJim Meyering2009-11-201-1/+0
| | | | * src/diff3.c (make_3way_diff): Remove dead assignment.
* maint: define/use PROGRAM_NAME and AUTHORS; use propername moduleJim Meyering2009-11-161-2/+8
| | | | | | | | | | * bootstrap.conf (gnulib_modules): Add propername. * src/cmp.c (PROGRAM_NAME, AUTHORS): Define. (main): Use them in use of version_etc. * src/diff.c (PROGRAM_NAME, AUTHORS, main): Likewise. * src/diff3.c (PROGRAM_NAME, AUTHORS, main): Likewise. * src/sdiff.c (PROGRAM_NAME, AUTHORS, main): Likewise. * src/system.h: Include "propername.h".
* maint: bug-diffutils@gnu.org is the new bug-reporting addressJim Meyering2009-11-161-3/+3
| | | | | | | | | | | * configure.ac (AC_INIT): Use bug-diffutils@..., not bug-gnu-utils as the bug-reporting address. * NEWS (Administrivia): Mention this. * src/cmp.c (usage): Remove hard-coded address. Instead, use gnulib's emit_bug_reporting_address function. * src/diff.c (usage, option_help_msgid): Likewise. * src/diff3.c (usage): Likewise. * src/sdiff.c (usage): Likewise.
* admin: update all copyright notices to include the year 2009Jim Meyering2009-11-111-2/+2
|
* build: rely on gnulib's progname moduleJim Meyering2009-11-111-3/+2
| | | | | | | | | | | | * bootstrap.conf (gnulib_modules): Add progname. * cfg.mk (local-checks-to-skip): Add sc_program_name. * src/cmp.c: Include progname.h. (program_name): Remove declaration. (main): Call set_program_name. * src/diff.c (main): Likewise. * src/diff3.c (main): Likewise. * src/sdiff.c (main): Likewise. * src/diff.h (program_name): Remove extern declaration.
* maint/sc: use STREQ, not strcmp(a,b) == 0Jim Meyering2009-11-111-2/+2
| | | | | | | | | | | | | Run this command: git grep -l 'strcmp *([^=]*== *0'|xargs \ perl -pi -e 's/\bstrcmp( *\(.*?\)) *== *0/STREQ$1/g' and then add the new definition. * src/system.h (STREQ): Define. * src/cmp.c (main): Use STREQ, not strcmp. * src/diff.c (main, compare_files): Likewise. * src/diff3.c (main): Likewise. * src/sdiff.c (expand_name): Likewise. * cfg.mk (local-checks-to-skip): Add sc_prohibit_strcmp.
* * COPYING: New file.Paul Eggert2007-07-191-8/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * AUTHORS: Update from GPLv2 to GPLv3. * Makefile.am: Likewise. * NEWS: Likewise. * README: Likewise. * README-hacking: Likewise. * bootstrap: Likewise. * bootstrap.conf: Likewise. * configure.ac: Likewise. * exgettext: Likewise. * doc/Makefile.am: Likewise. * lib/Makefile.am: Likewise. * lib/cmpbuf.c: Likewise. * lib/cmpbuf.h: Likewise. * lib/prepargs.c: Likewise. * m4/vararrays.m4: Likewise. * man/Makefile.am: Likewise. * ms/Makefile.am: Likewise. * ms/README: Likewise. * ms/config.bat: Likewise. * ms/config.sed: Likewise. * ms/config.site: Likewise. * po/POTFILES.in: Likewise. * src/Makefile.am: Likewise. * src/analyze.c: Likewise. * src/cmp.c: Likewise. * src/context.c: Likewise. * src/diff.c: Likewise. * src/diff.h: Likewise. * src/diff3.c: Likewise. * src/dir.c: Likewise. * src/ed.c: Likewise. * src/io.c: Likewise. * src/normal.c: Likewise. * src/sdiff.c: Likewise. * src/system.h: Likewise. * src/util.c: Likewise.
* * src/context.c (pr_context_hunk, pr_unidiff_hunk):Paul Eggert2006-05-071-7/+8
| | | | | | | | | | | | | Prefer fputs or fputc to fprintf, since it's a tad more efficient with unlocked-IO on glibc. Long ago we avoided fputs to work around an ancient SunOS bug, but that's no longer relevant. * src/diff3.c (output_diff3, dotlines, undotlines): (output_diff3_edscript, output_diff3_merge): Likewise. This also avoids a gcc -Wformat-security warning reported by Jim Meyering. * src/ed.c (print_ed_hunk, print_forward_ed_hunk, print_rcs_hunk): Likewise. * src/normal.c (print_normal_hunk): Likewise.
* * src/system.h (PARAMS, PROTOTYPES): Remove; no longer needed.Paul Eggert2006-03-131-4/+4
| | | | | | | | | (IF_LINT): New macro, to pacify GCC. * src/analyze.c (diag, compareseq): Use IF_LINT. * src/cmp.c (cmp): Likewise. * src/diff3.c (process_diff): Likewise. Also, prefer NULL to 0. * src/ifdef.c (do_printf_spec, scan_char_literal): Likewise. * src/sdiff.c (edit): Likewise.
* Update FSF address.Paul Eggert2006-01-051-1/+1
|
* * src/cmp.c: Don't include <setmode.h>.Paul Eggert2006-01-051-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (specify_ignore_initial): Reword to avoid gcc -W warnings. (main): Use freopen instead of setmode, since freopen is in POSIX. * src/context.c: Revert most 2004-09-01 changes. Then: (TIMESPEC_NS): Remove. All uses replaced by get_stat_mtime_ns. Include stat-time.h, strftime.h. (nstrtime): Remove decl. * src/diff.c: Revert most 2004-09-01 changes. Then: Don't include <posixver.h>, <quotesys.h>, <setmode.h>. Include <sh-quote.h>, <stat-time.h>, <timespec.h>. All uses of quotesys replaced by sh-quote. (main, compare_files): Use freopen instead of setmode, since freopen is in POSIX. (main): Don't complain about "diff -NUM'. (main, set_mtime_to_now): Adjust to stat-time.h macros when accessing nanoseconds. * src/diff3.c: Include sh-quote.h rather than quotesys. All uses changed. * src/dir.c (dir_read): excluded_filename renamed to excluded_file_name. * src/io.c: Don't include <setmode.h>. (sip, read_files): Remove binary file stuff, leaving a FIXME behind. A DOS expert needs to look at this. * src/diff.c: Include sh-quote.h rather than quotesys.h. All uses changed. * src/system.h: Include verify.h. (verify): Remove. All uses changed to verify.h version. Include <intprops.h>. (TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM): Remove. Now uses intprops.h versions. (O_BINARY): New defns, taken from coreutils. * src/util.c: Include sh-quote.h rather than quotesys.h. All uses changed.
* (usage): Mention exit status.Paul Eggert2004-04-121-59/+92
| | | | | | | | | | | | (main): Adjust to latest gnulib c_stack_action calling conventions. Adjust to latest version_etc calling conventions. Include unlocked-io.h. (strip_trailing_cr): New var. (STRIP_TRAILING_CR_OPTION): New enum. (longopts, main, option_help_msgid, read_diff): Add --strip-trailing-cr support. (read_diff): Exit with status 126 (not 127) if errno != ENOENT after failed execvp in child. Report this in parent.
* Include version-etc.h, not freesoft.h.Paul Eggert2002-06-171-10/+2
| | | | | | (copyright_notice): Remove. (main): Use version_etc to print version. (version_string): Remove decl.
* (readnum): Fix autoincrement typo.Paul Eggert2002-06-111-2/+2
|
* Trim trailing white space.Paul Eggert2002-06-111-3/+3
|
* Include <file-type.h>.Paul Eggert2002-06-111-295/+269
| | | | | | | | | | | Include paths.h. (copyright_notice): Renamed from copyright_string. Now a msgid, so that copyright symbol can be translated. All uses changed. (skipwhite, readnum): New functions. (process_diff_control): Use them. (SKIPWHITE, READNUM): Remove. (read_diff): Don't worry about errno == ENOEXEC.
* Include cmpbuf.h.Paul Eggert2002-04-051-18/+12
| | | | (read_diff): Use block_read instead of read, to work around Tru64 5.1 bug.
* (option_help_msgid, usage): Reword for help2man.Paul Eggert2002-03-111-5/+5
|
* Include c-stack.h, exitfail.h.Paul Eggert2002-02-281-51/+63
| | | | | | | | | | | | | | | | | (ALLOCATE): Remove. All uses changed to xmalloc, or to xmalloc plus an overflow check. (myread): Remove. (main): Check for stack overflow. 0 -> EXIT_SUCCESS, 1 -> EXIT_FAIULRE, 2 -> EXIT_TROUBLE. (try_help): Likewise. (process_diff): Check for integer overflow, to avoid core dumps. 2 -> EXIT_TROUBLE. (read_diff): Exit with status 126 if the file is not executable, for compatibility with POSIX 1003.1-2001. Accommodate ancient AIX hosts that set errno to EINTR after uncaught SIGCONT. Check for integer overflow to avoid core dumps. (fatal, perror_with_exit): 2 -> EXIT_TROUBLE.
* (copyright_string): Update to 2002.Paul Eggert2002-01-241-6/+5
| | | | | (usage): Reformat messages to ease translation. (main): Remove unused variable.
* (DIFF_PROGRAM_OPTION, HELP_OPTION): New constants.Paul Eggert2001-12-241-13/+27
| | | | | | | | | | | (longopts, main): Use them. (longopts, main, option_help_msgid): New option --diff-option=PROGRAM. (main): Remove DIFF_PROGRAM support. Check stdout after printing version. (check_stdout): Report errno info if fclose fails. (read_diff): Have child exit with status 127 when program is not found, rather than trying to have the child report failure. CHeck for pclose returning -1.
* (main): Initialize xalloc_exit_failure before possibly invoking any memoryPaul Eggert2001-12-111-1/+1
| | | | allocator.
* (read_diff): HAVE_FORK -> HAVE_WORKING_FORK || HAVE_WORKING_VFORK.Paul Eggert2001-12-031-6/+6
|
* Assume C89 or better.Paul Eggert2001-11-241-308/+245
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | int -> bool for booleans. int -> lin for line numbers. Use angle-brackets when including getopt.h, quotesys.h. Include error.h, freesoft.h, inttostr.h, xalloc.h. (copyright_string): Use only most recent year. (authorship_msgid, option_help_msgid): Wrap in N_(). Rename the following variables for consistency with user-visible option spellings. All uses changed. (text): Renamed from always_text. (initial_tab): Renamed from tab_align_flag. (horizon_lines): Remove. Remove all uses. (main): Invoke bindtextdomain and textdomain after setlocale. Rename "DIFF" to "DIFF_PROGRAM". Try to compare file0 to file1, because this is where changes are expected to come from. Diffing between these pairs of files is more likely to avoid phantom changes from file0 to file1. However, use file2 as the common file if this is a 3-way diff, for backward compatibility. (create_diff3_block): Use xcalloc instead of malloc + bzero. (INT_STRLEN_BOUND): Remove; now in system.h. (read_diff): Always use --horizon-lines=100 rather than trying to guess it. Do not pass --inhibit-hunk-merge. Minimum chunk size is 1, not 8KiB. Use xalloc_die to report memory exhaustion. (undotlines): Use long for start, not int.
* Include <config.h> before using "const".Paul Eggert1998-09-141-1/+2
|
* (quotesys.h): Include.Paul Eggert1998-09-141-3/+3
| | | | | | | | | | | | | | | | | | | | | | | (free_software_msgid): New decl. (RANGE_START, RANGE_END): Renamed from START and END. (fatal, perror_with_exit, try_help): Add noreturn attribute. (error): Add printf attribute. (diff_program): Now a ptr, not an array. Initialize to DEFAULT_DIFF_PROGRAM instead of DIFF_PROGRAM. (longopts, main): Don't assume ASCII. (main): Use DIFF environment var to specify name of diff program. Compare getopt_long result to -1, not EOF. -v now reports version according to new GNU standard. Report spelling of extra operand, or last operand before missing one. (try_help): Now takes operand arg. (option_help_ms): Fix typo: missing comma. (usage): Update as per current GNU standards. (environ): Remove decl. (read_diff): Invoke diff with --inhibit-hunk-merge. Translate `not found' message before forking. Quote name of diff program. Pass horizon lines. `memory exhausted' -> `Memory exhausted'
* (quotearg.h): Include.Paul Eggert1998-09-131-79/+105
| | | | | | | | | | | | | | | | | | | | | | | (free_software_msgid): New decl. (RANGE_START, RANGE_END): Renamed from START and END. (fatal, perror_with_exit, try_help): Add noreturn attribute. (error): Add printf attribute. (diff_program): Now a ptr, not an array. Initialize to DEFAULT_DIFF_PROGRAM instead of DIFF_PROGRAM. (longopts, main): Don't assume ASCII. (main): Use DIFF environment var to specify name of diff program. Compare getopt_long result to -1, not EOF. -v now reports version according to new GNU standard. Report spelling of extra operand, or last operand before missing one. (try_help): Now takes operand arg. (option_help_ms): Fix typo: missing comma. (usage): Update as per current GNU standards. (environ): Remove decl. (read_diff): Invoke diff with --inhibit-hunk-merge. Translate `not found' message before forking. Quote name of diff program. Pass horizon lines. `memory exhausted' -> `Memory exhausted'
* (main): Invoke setlocale first thing, to tell library we're internationalized.Paul Eggert1994-11-141-44/+55
| | | | | (option_help_msgid): New constant. (usage): Use it, so message is translated one option at a time.
* (read_diff): Quote arguments with system_quote_arg.Paul Eggert1994-10-311-6/+8
|
* (main): Use strerror (EISDIR) instead of "Is a directory".Paul Eggert1994-10-151-44/+15
| | | | | (xmalloc, xrealloc): Remove. (fatal, perror_with_exit): Use `error'.
* (read_diff): If STAT_BLOCKSIZE yields zero, adjust it to a more reasonablePaul Eggert1994-10-011-2/+3
| | | | value.
* <ctype.h> now included by system.h.Paul Eggert1994-09-221-23/+6
| | | | | (main): Give proper diagnostic if too many labels were given. (read_diff): Use SYSTEM_QUOTE_ARG.
* (program_name): Renamed from `program', for consistency.Paul Eggert1994-09-151-10/+12
|
* Fix copyright notice.Paul Eggert1994-09-121-1/+1
|
* (try_help, check_stdout): New functions.Paul Eggert1994-09-081-32/+52
| | | | | (usage): Just print usage; let caller worry about exiting. (read_diff): Use new waitpid substitute.
* (main): Call initialize_main first.Paul Eggert1994-09-021-15/+80
| | | | | | | If we'll have children, make sure SIGCHLD isn't ignored. (read_diff): Use popen+pclose if !HAVE_FORK. (DIFF_CHUNK_SIZE): Removed. We now get initial chunk size from STAT_BLOCKSIZE. (INT_STRLEN_BOUND): New macro.
* (scan_diff_line): Don't rely on promotion to make the old-style parameterPaul Eggert1994-04-151-2/+2
| | | | | type agree with the prototype parameter type; this doesn't work on Apollos running bsd4.3.
* (usage): Send usage to stdout, not stderr.Paul Eggert1993-11-101-15/+27
| | | | | (long_options, main, usage): Add `--help'. (read_diff): Detect integer overflow in buffer size calculations.
* (xmalloc, xrealloc): Cast malloc, reallocPaul Eggert1993-09-271-2/+2
| | | | to (VOID *) to suppress bogus warnings on some nonstandard hosts.
* Include "system.h" first.Paul Eggert1993-09-181-8/+8
| | | | | | (xmalloc): Now static. (xmalloc, realloc): Remove needless casts. (READNUM): Ensure isdigit argument isn't negative.