summaryrefslogtreecommitdiff
path: root/src/cmp.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.
* portability: use SET_BINARY rather than xfreopen (NULL, ...Claudio Bley2011-10-041-2/+2
| | | | | | | * src/diff.c: Include binary-io.h, not xfreopen.h. (main): Use SET_BINARY (...) rather than xfreopen (NULL, X, ...), because the latter doesn't work on MinGW and crashes using MSVC. * src/cmp.c (main): 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-12/+18
| | | | | | | | * 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: 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-1/+2
| | | | | | | | | * 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: define/use PROGRAM_NAME and AUTHORS; use propername moduleJim Meyering2009-11-161-5/+9
| | | | | | | | | | * 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-4/+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.
* * bootstrap: Sync from gnulib.Paul Eggert2007-04-041-2/+1
| | | | | | | | | | * src/cmp.c: Don't include exit.h; no longer needed. * src/diff.c: Likewise. * src/sdiff.c: Likewise. * src/dir.c: Don't include strcase.h; no longer needed. * README-alpha: Remove, replacing with: * README-hacking: New file, taken from coreutils with some changes. The rename is required by the change to 'bootstrap'.
* * src/cmp.c (cmp): The previous fix wasn't quite right either, asPaul Eggert2006-05-091-6/+7
| | | | | | it mishandled 'cmp A B >/dev/null' when A is shorter than B and differs before A's end-of-file, by outputting a bogus EOF message. Also, it was inefficient if A and B were large.
* * src/cmp.c (cmp): Fix bug introduced in 2006-03-09 change.Paul Eggert2006-05-081-2/+2
| | | | | For example, "cmp <(echo b) <(echo a) > /dev/null" incorrectly succeeded. Problem reported by Jim Meyering.
* * src/system.h (PARAMS, PROTOTYPES): Remove; no longer needed.Paul Eggert2006-03-131-1/+1
| | | | | | | | | (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 code comment to match previous patch.Paul Eggert2006-03-091-1/+2
|
* (main): Avoid an unnecessary system call introduced in previous patch.Paul Eggert2006-03-091-6/+1
|
* * src/cmp.c (type_no_stdout): New constant.Paul Eggert2006-03-091-2/+11
| | | | | (main): Use it to avoid bug when the "EOF on foo" message is generated and stdout is /dev/null.
* Update FSF address.Paul Eggert2006-01-051-1/+1
|
* * src/cmp.c: Don't include <setmode.h>.Paul Eggert2006-01-051-11/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (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.
* Sort includes. Include <exit.h>, <unlocked-io.h>.Paul Eggert2004-04-121-30/+37
| | | | | | | | (specify_comparison_type): Don't report an error if the comparison type has already been specified the same way as this one. (usage): Mention exit status. (main): Adjust to latest gnulib c_stack_action calling conventions. (main): Adjust to latest version_etc calling conventions.
* Include version-etc.h, not freesoft.h.Paul Eggert2002-06-171-12/+7
| | | | | | (copyright_notice): Remove. (main): Use version_etc to print version. (version_string): Remove decl.
* Include <file-type.h>.Paul Eggert2002-06-111-8/+9
| | | | | | | Include paths.h. (copyright_notice): Renamed from copyright_string. Now a msgid, so that copyright symbol can be translated. All uses changed.
* (cmp): Use block_read instead of read, to work around Tru64 5.1 bug.Paul Eggert2002-04-051-12/+6
|
* (cmp): Fix typos in previous change.Paul Eggert2002-03-121-5/+5
|
* Use "byte" rather than "char" if a translation for "byte" is available.Paul Eggert2002-03-121-6/+20
|
* (specify_comparison_type): New function.Paul Eggert2002-03-121-15/+21
| | | | | (check_stdout): "indices and codes" -> "byte numbers and values" (main): Use specify_comparison_type to detect option clashes.
* (usage): Reword for help2man.Paul Eggert2002-03-111-4/+5
|
* Include c-stack.h, exitfail.h.Paul Eggert2002-02-281-31/+43
| | | | | | | | | | | (hard_locale_LC_MESSAGES): Depend on ENABLE_NLS. (try_help, check_stdout, main, cmp): 2 -> EXIT_TROUBLE. (main): Check for stack overflow. 0 -> EXIT_SUCCESS. 1 -> EXIT_FAILURE. (cmp): Likewise. Accommodate ancient AIX hosts that set errno to EINTR after uncaught SIGCONT.
* (copyright_string): Update to 2002.Paul Eggert2002-01-241-17/+15
| | | | | | (bytes, parse_ignore_initial, cmp): Use UINTMAX_MAX instead of (uintmax_t) -1, to avoid warnings on some compilers. (usage): Reformat messages to ease translation.
* (valid_suffixes): Add '0', to support suffixes like "MB" and "MiB".Paul Eggert2001-12-241-3/+4
| | | | | | (check_stdout): Don't assume that the translations of "write failed" and of "standard output" lack '%'. (main): Check stdout after printing version.
* Include <hard-locale.h>, <setmode.h>.Paul Eggert2001-12-111-40/+77
| | | | | | | | | | | | | | (hard_locale_LC_MESSAGES): New macro. (sprintc): Remove int width arg; it's now the caller's responsibility to pad. All callers changed. (stat_buf): New static var; was formerly a local var in 'main'. (valid_suffixes): Add 'K', for 'KiB'. (option_help_msgid): Don't confuse bytes with characters. (main): Set xalloc_exit_failure before invoking anything that might allocate memory. Fix bug: -n was incorrectly ignored when optimizing the case of regular files with different lengths. (cmp): Use an index column wide enough to store this comparison's indexes. In locales other than the POSIX locale, say "byte" rather than "char".
* (usage): Clarify.Paul Eggert2001-12-031-2/+8
|
* <xstrtol.h>: Include.Paul Eggert2001-12-031-27/+84
| | | | | | | | | | | | | | | (ignore_initial): Now an array with 2 elements. All uses changed. (bytes): New var. (HELP_OPTION): New constant. (long_options, main): Use it. (long_options, option_help_msgid, main, cmp): Add support for -n or --bytes. (parse_ignore_initial): New function. (option_help_msgid, main): Add -i M:N. (usage, main): Add two optional trailing operands, a la BSD. (main): setmode -> set_binary_mode. (cmp): Report byte number of what we've seen, not of the entire file. This is to be consistent with the line number, which is always relative with what we've seen.
* (option_help_msgid): offsets -> indicesPaul Eggert2001-11-251-4/+4
|
* Assume C89 or better.Paul Eggert2001-11-241-176/+150
| | | | | | | | | | | | | | | | | | | | | | | | int -> bool for booleans. long -> off_t for line numbers. Use angle-brackets when including cmpbuf.h, getopt.h. Include error.h, freesoft.h, inttostr.h, xalloc.h. (copyright_string): Use only most recent year. (authorship_msgid): Wrap in N_(). (buffer): Now word*, not char*. All uses changed. (word): Remove macro; now in system.h. (long_options, option_help_msgid, main): -c --print-chars -> -b --print-bytes (check_stdout): "write failed" -> "standard output" (option_help_msgid): Wrap in N_(). (main): Invoke bindtextdomain and textdomain after setlocale. Use strtoumax instead of doing the work ourselves. Check for same_file_attributes as well as same_file. (cmp): Use ssize_t for read returns, not size_t. Do not assume that size_t is not narrower than int. Do not assume that line numbers fit in 'long'. (block_compare_and_count, block_compare): Compiler now checks that buffers are word-aligned. (block_compare_and_count): Count sizes with size_t, not long. (sprintc): byte arg is unsigned char, not unsigned.
* Include <config.h> before using "const".Paul Eggert1998-09-141-1/+2
|
* (authorship_msgid): New var.Paul Eggert1998-09-141-2/+2
| | | | | | | | | | | | | | | (free_software_msgid): New decl. (error): Now has printf attribute. (try_help): Likewise. (long_options): Don't assume ASCII. (try_help): Now accepts operand arg. (main): Check for -1, not EOF, when calling getopt_long. Report --ignore-initial value when complaining about it. Output copyright and free software info with -v. Don't assume ASCII. Report last operand when one is missing. Report text of extra operand. Move block_read into cmpbuf.c.
* (authorship_msgid): New var.Paul Eggert1998-09-131-67/+52
| | | | | | | | | | | | | | | (free_software_msgid): New decl. (error): Now has printf attribute. (try_help): Likewise. (long_options): Don't assume ASCII. (try_help): Now accepts operand arg. (main): Check for -1, not EOF, when calling getopt_long. Report --ignore-initial value when complaining about it. Output copyright and free software info with -v. Don't assume ASCII. Report last operand when one is missing. Report text of extra operand. Move block_read into cmpbuf.c.
* (main): Invoke setlocale first thing, to tell library we're internationalized.Paul Eggert1994-11-141-45/+60
| | | | | | | (option_help_msgid): New constant. (usage): Use it, so message is translated one option at a time. (sprintc): Renamed from `printc'. Now outputs to a buffer instead of stdout. (cmp): Use new sprintc semantics.
* Fix comment.Paul Eggert1994-10-311-1/+1
|
* (main): Align buffer size to word size, in case malloc cares.Paul Eggert1994-10-151-4/+7
|
* (main): Set xmalloc_exit_failure.David MacKenzie1994-10-121-0/+2
|
* (word): Don't define if already defined.Paul Eggert1994-09-221-6/+11
| | | | | | (main): Use setmode, not open(..., O_BINARY); this hits stdin too. Use NULL_DEVICE instead of "/dev/null". (cmp): Use %lu instead of %ld when it is more likely to give correct output.
* (printc): Don't quote C if isprint(C).Paul Eggert1994-09-151-18/+21
|
* Fix copyright notice.Paul Eggert1994-09-121-1/+1
|
* (try_help, check_stdout): New functions.Paul Eggert1994-09-081-26/+40
| | | | (usage): Just print usage; let caller worry about exiting.