summaryrefslogtreecommitdiff
path: root/src/sdiff.c
Commit message (Collapse)AuthorAgeFilesLines
* maint: update all copyright year number rangesJim Meyering2012-01-011-1/+1
| | | | Run "make update-copyright".
* diff, sdiff: new option --ignore-trailing-space (-Z)Roland McGrath2011-08-141-1/+7
| | | | | | | | | | | | | | Derived from Roland McGrath's patch (dated June 2004!) in: http://lists.gnu.org/archive/html/bug-gnu-utils/2004-07/msg00000.html * NEWS: * doc/diffutils.texi (White Space, Blank Lines) (sdiff Option Summary, diff Options, sdiff Options): Document -Z. * src/diff.h (IGNORE_TRAILING_SPACE) (IGNORE_TAB_EXPANSION_AND_TRAILING_SPACE): New constants, for -Z. * src/diff.c (shortopts, longopts, main, option_help_msgid): * src/sdiff.c (longopts, option_help_msgid, main): * src/io.c (find_and_hash_each_line): * src/util.c (lines_differ, analyze_hunk): Support -Z.
* 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-20/+25
| | | | | | | | * 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-36/+7
| | | | | | | | | | | | | 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: update copyright year ranges to include 2011Jim Meyering2011-01-031-1/+1
| | | | Run "make update-copyright", so "make syntax-check" works in 2011.
* build: rely on gnulib's sigprocmask moduleJim Meyering2010-05-091-23/+0
| | | | | * src/sdiff.c: Remove #if-!HAVE_SIGPROCMASK-guarded code. * bootstrap.conf (gnulib_modules): Add sigprocmask.
* avoid compilation failure on systems lacking both fork and vforkJuan Manuel Guerrero2010-02-141-1/+1
| | | | | | | * src/sdiff.c [!HAVE_WORKING_FORK && !HAVE_WORKING_VFORK] (main): Pass the right number of arguments to shell_quote_copy. * src/util.c [!HAVE_WORKING_FORK && !HAVE_WORKING_VFORK] (begin_output): Likewise.
* 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
* 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-1/+1
| | | | | | | | | | | | | 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.
* * src/diff.c (compare_files): Use last_component rather than base_name,Paul Eggert2009-11-111-4/+5
| | | | | | adjusting to gnulib API change. This avoids a memory leak. * src/sdiff.c (expand_name): Likewise. * src/util.c (dir_file_pathname): Likewise.
* * COPYING: New file.Paul Eggert2007-07-191-9/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* * NEWS: Mention new sdiff aliases 1 and 2 for l and r.Paul Eggert2007-06-061-11/+12
| | | | | | * doc/diff.texi (Merge Commands): Likewise. * src/sdiff.c (give_help): Give help for them. (edit): Support them.
* * 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/sdiff.c (sigprocmask): Don't dump core if O is null.Paul Eggert2006-11-141-1/+1
|
* Don't assume SIGPIPE exists, and that sigblock and sigsetmaskPaul Eggert2006-11-141-4/+10
| | | | | | | | | | | exist if sigprocmask does not. Problem reported by Paul Edwards for MVS 3.8. * configure.ac (sigblock): Check whether this function is available, if sigprocmask is not. * src/sdiff.c (sigs): Omit SIGPIPE if it's not defined. Put SIGINT last; all uses changed. (handler_index_of_SIGPIPE): Omit if SIGPIPE is not defined. (sigblock, sigsetmask) [!HAVE_SIGBLOCK]: New macros.
* * src/sdiff.c (sigprocmask) [! HAVE_SIGPROCMASK]: Cast 2nd arg toPaul Eggert2006-11-051-1/+3
| | | | | sigset_t *, since it might be a literal 0. Problem reported by Paul Edwards for MVS 3.8.
* * src/system.h (PARAMS, PROTOTYPES): Remove; no longer needed.Paul Eggert2006-03-131-3/+2
| | | | | | | | | (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-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (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-41/+56
| | | | | | | | | | | (main): Adjust to latest gnulib c_stack_action calling conventions. Adjust to latest version_etc calling conventions. Include <unlocked-io.h>, <exit.h>. (check_child_status): Renamed from ck_editor_status, and accept a new arg MAX_OK_STATUS. All callers changed. Handle status 126/127 as per POSIX. (edit): Likewise. (main): Likewise. Fix getopt typo: -E wasn't supported.
* 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.
* Include <file-type.h>.Paul Eggert2002-06-111-39/+37
| | | | | | | | | | | | | Include paths.h. (copyright_notice): Renamed from copyright_string. Now a msgid, so that copyright symbol can be translated. All uses changed. (catchsig, signal_handler, initial_action): Signal handlers return void, not RETSIGTYPE, since we no longer support K&R. (TABSIZE_OPTION): New constant. (longopts, usage, main): New option --tabsize=COLUMNS. (cleanup): New arg signo. All uses changed. (ck_editor_status, main, edit): Don't worry about ENOEXEC.
* (option_help_msgid, usage): Reword for help2man.Paul Eggert2002-03-111-5/+5
|
* Include c-stack.h, exitfail.h. Do not include signal.h.Paul Eggert2002-02-281-34/+43
| | | | | | | | | | | 0 -> EXIT_SUCCESS, 1 -> EXIT_FAILURE, 2 -> EXIT_TROUBLE. (ck_editor_status): New function. (main): Check for stack overflow. Adopt POSIX convention for subsidiary programs not found. (diffarg): Check for integer overflow to avoid core dumps. (trapsigs): Remove SA_INTERRUPT special case; now done by header. (SIGCHLD): Likewise. (edit): Adopt POSIX convention for subsidiary programs not found.
* (copyright_string): Update to 2002.Paul Eggert2002-01-241-11/+15
| | | | | | | | | | (usage): Reformat messages to ease translation. (handler_index_of_SIGINT, handler_index_of_SIGPIPE): New macros. (main): Do not confuse signal numbers with their indices. Bug reported by Bruno Haible. (edit): Cat lin to long before printing with %ld, since lin might be narrow than long.
* (interact): After extracting rlen from the editor command, test for aPaul Eggert2001-12-311-1/+1
| | | | terminating null character, not for a newline.
* (not_found, execdiff): Remove.Paul Eggert2001-12-241-58/+76
| | | | | | | | | | | | | | | (DIFF_PROGRAM_OPTION): New constant. (longopts, option_help_msgid, main): Add --diff-program=PROGRAM. (check_stdout): New function. (main): Remove DIFF_PROGRAM support. Check stdout after printing version. Use check_stdout after printing help. Use execvp/perror_fatail rather than execdiff. Set errno to 0 before invoking popen. Check for pclose failure properly. (main, edit): If child exec fails, exit with 127 rather than trying to print diagnostic. Distinguish between subsidiary program failing and not being found. (edit): Handle signals the same way, regardless of whether we're using system or fork+exec. Check for system returning -1.
* Include <dirname.h>.Paul Eggert2001-12-111-5/+6
| | | | | | | (expand_name): Use base_name rather than file_name_lastdirchar, for portability to DOS. (main): Initialize xalloc_exit_failure before possibly invoking any memory allocator.
* (diffpid, cleanup, main, edit): HAVE_FORK -> HAVE_WORKING_FORK ||Paul Eggert2001-12-031-29/+27
| | | | | | | | HAVE_WORKING_VFORK. (main): HAVE_VFORK -> HAVE_WORKING_VFORK. (edit): Reopen the temporary file after the editor has run, in case the editor operates by unlinking the old file and linking a new one. (P_tmpdir): Rename from PVT_tmpdir; this fixes a typo. All uses changed.
* (STRIP_TRAILING_CR_OPTION): New constant.Paul Eggert2001-11-251-5/+15
| | | | | (longopts, option_help_msgid, main): Add -E, --ignore-tab-expansion, --strip-trailing-cr.
* Assume C89 or better.Paul Eggert2001-11-241-375/+261
| | | | | | | | | | | | | | | | | int -> bool for booleans. int -> lin for line numbers. Use angle-brackets when including getopt.h, quotesys.h. Include error.h, freesoft.h, stdio.h, xalloc.h. (copyright_string): Use only most recent year. (authorship_msgid, option_help_msgid): Wrap in N_(). (tmpname): Now volatile. (tmpmade): Remove. (tmp): New var. (private_tempnam, exists, letters): Remove. (temporary_file): New function. (edit): Use it. (interact): Use strtoumax, not atoi.
* (lf_snarf): Fix bug when help line wrapped around the input buffer.Paul Eggert1998-12-121-3/+1
|
* Include <config.h> before using "const".Paul Eggert1998-09-141-1/+2
|
* (quotesys.h): Include.Paul Eggert1998-09-141-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | (DIFF_PROGRAM, DEFAULT_EDITOR_PROGRAM): Remove. (free_software_msgid, editor_program, not_found): New vars. (diffbin, edbin): Remove. (editor_program): Renamed from edbin. (edit, interact): Now take extra string arg. (exiterr, fatal, perror_fatal, try_help): Add noreturn attribute. (sigset_t, sigemptyset, sigmask, sigaddset, SIG_BLOCK, SIG_SETMASK): (sigprocmask): New macros, if !HAVE_SIGPROCMASK. (error): Now has printf attribute. (longopts, main): Don't assume ASCII. (try_help): New operand arg. (usage): Conform to new GNU standards. (main): Set static vars for editor and diff program. Compare getopt_long result to -1, not EOF. -v conforms to new GNU standard. Complain better about extra and missing operands. If HAVE_VFORK, block SIGINT and SIGPIPE in the parent, since when the child munges its handlers it may somp on the parent. Pass rname to intract. Translate not-found message before forking. (give_help): Just output it all at once. (edit): New args lname, lline, rname, rline. (edit): New command 'd'. (interact): New args lname, rname.
* (quotearg.h): Include.Paul Eggert1998-09-131-167/+281
| | | | | | | | | | | | | | | | | | | | | | | | | | | (DIFF_PROGRAM, DEFAULT_EDITOR_PROGRAM): Remove. (free_software_msgid, editor_program, not_found): New vars. (diffbin, edbin): Remove. (editor_program): Renamed from edbin. (edit, interact): Now take extra string arg. (exiterr, fatal, perror_fatal, try_help): Add noreturn attribute. (sigset_t, sigemptyset, sigmask, sigaddset, SIG_BLOCK, SIG_SETMASK): (sigprocmask): New macros, if !HAVE_SIGPROCMASK. (error): Now has printf attribute. (longopts, main): Don't assume ASCII. (try_help): New operand arg. (usage): Conform to new GNU standards. (main): Set static vars for editor and diff program. Compare getopt_long result to -1, not EOF. -v conforms to new GNU standard. Complain better about extra and missing operands. If HAVE_VFORK, block SIGINT and SIGPIPE in the parent, since when the child munges its handlers it may somp on the parent. Pass rname to intract. Translate not-found message before forking. (give_help): Just output it all at once. (edit): New args lname, lline, rname, rline. (edit): New command 'd'. (interact): New args lname, rname.
* (version_string): Fix typo in declaration: `const' was missing.Paul Eggert1994-11-141-60/+79
| | | | | | | (option_help_msgid, help_msgid): New constant. (usage, give_help): Use them, so message is translated one option at a time. (main): Invoke setlocale first thing, to tell library we're internationalized. (trapsigs): Ignore sigaction failure, to be compatible with `signal'.
* (trapsigs): Don't check signal return value, since it's bogus under djgpp.Paul Eggert1994-11-091-3/+2
|
* (main): Use system_quote_arg to compute command.Paul Eggert1994-10-311-5/+5
|
* (xmalloc): Remove.Paul Eggert1994-10-151-38/+21
| | | | (diffarg): Take advantage of cleaner xrealloc semantics.
* (private_tempnam): Use tmpnam if HAVE_TMPNAM; this simplifies porting.Paul Eggert1994-10-011-4/+11
| | | | | (exists, letters): Omit if HAVE_TMPNAM. (expand_name): Use filename_lastdirchar instead of strrchr.
* (exists, private_tempname): Adopt latest GNU libc algorithm.Paul Eggert1994-09-241-100/+46
| | | | (private_tempnam): Specialize for sdiff to avoid portability problems.
* isspace -> ISSPACE, etc.Paul Eggert1994-09-221-25/+20
| | | | | | | | | | <ctype.h> now included by system.h. (DEFAULT_EDITOR_PROGRAM): Renamed from DEFAULT_EDITOR for consistency. (TMPDIR_ENV): New macro. (expand_name): Change `isdir' to `is_dir' to avoid theoretical ctype namespace contamination. (main): Use SYSTEM_QUOTE_ARG. (private_tempnam): Don't access "/tmp" directly; access it via PVT_tmpdir.
* (program_name): Renamed from `program', for consistency.Paul Eggert1994-09-151-7/+8
|
* Fix copyright notice.Paul Eggert1994-09-121-2/+2
|
* (try_help): New function.Paul Eggert1994-09-081-62/+43
| | | | | (usage): Just print usage; let caller worry about exiting. (memchr, waitpid): Remove; use new substitutes instead.