diff options
| author | tv <tv@NetBSD.org> | 1999-02-12 12:44:58 +0000 |
|---|---|---|
| committer | tv <tv@NetBSD.org> | 1999-02-12 12:44:58 +0000 |
| commit | 9b9c3c160ebd9f3171b7f6fbf078a92e6e40d150 (patch) | |
| tree | 95f76eb90fcdf87b985cfdf4061d12e26f8d523a /gnu/dist/diffutils | |
| parent | 41510f9a2bbe822b014265d52588682896c53441 (diff) | |
Add some patches, delete Infodoc, and delete files not used for a NetBSD
build.
Diffstat (limited to 'gnu/dist/diffutils')
| -rw-r--r-- | gnu/dist/diffutils/ChangeLog | 1766 | ||||
| -rw-r--r-- | gnu/dist/diffutils/NEWS | 126 | ||||
| -rw-r--r-- | gnu/dist/diffutils/README | 9 | ||||
| -rw-r--r-- | gnu/dist/diffutils/alloca.c | 492 | ||||
| -rw-r--r-- | gnu/dist/diffutils/cmp.c | 568 | ||||
| -rw-r--r-- | gnu/dist/diffutils/diff.info | 128 | ||||
| -rw-r--r-- | gnu/dist/diffutils/diff.info-1 | 1211 | ||||
| -rw-r--r-- | gnu/dist/diffutils/diff.info-2 | 1312 | ||||
| -rw-r--r-- | gnu/dist/diffutils/diff.info-3 | 1327 | ||||
| -rw-r--r-- | gnu/dist/diffutils/diff.info-4 | 152 | ||||
| -rw-r--r-- | gnu/dist/diffutils/error.c | 111 | ||||
| -rw-r--r-- | gnu/dist/diffutils/getopt.c | 2 | ||||
| -rw-r--r-- | gnu/dist/diffutils/install-sh | 238 | ||||
| -rw-r--r-- | gnu/dist/diffutils/memchr.c | 19 | ||||
| -rw-r--r-- | gnu/dist/diffutils/mkinstalldirs | 32 | ||||
| -rw-r--r-- | gnu/dist/diffutils/regex.c | 8 | ||||
| -rw-r--r-- | gnu/dist/diffutils/stamp-h.in | 1 |
17 files changed, 6 insertions, 7496 deletions
diff --git a/gnu/dist/diffutils/ChangeLog b/gnu/dist/diffutils/ChangeLog deleted file mode 100644 index 6cfc7791adb..00000000000 --- a/gnu/dist/diffutils/ChangeLog +++ /dev/null @@ -1,1766 +0,0 @@ -Sat Oct 1 05:24:19 1994 Paul Eggert <eggert@twinsun.com> - - * Version 2.7 released. - - * configure.in (AC_HEADER_SYS_WAIT): Add. - (AC_CHECK_HEADERS): Remove sys/wait.h. - (AC_CHECK_FUNCS): Add tmpnam. - * system.h (<sys/wait.h>, WEXITSTATUS): Use simpler scheme - now that HAVE_SYS_WAIT_H is not set on hosts - that are incompatible with Posix applications. - - * util.c (dir_file_pathname): Use filename_lastdirchar not strrchr. - * sdiff.c (expand_name): Likewise. - (private_tempnam): Use tmpnam if HAVE_TMPNAM; this simplifies porting. - (exists, letters): Omit if HAVE_TMPNAM. - - * diff3.c (read_diff): If STAT_BLOCKSIZE yields zero, - adjust it to a more reasonable value. - -Sat Sep 24 20:36:40 1994 Paul Eggert <eggert@twinsun.com> - - * sdiff.c (exists, private_tempname): Adopt latest GNU libc algorithm. - (private_tempnam): Specialize for sdiff to avoid portability problems. - -Thu Sep 22 16:47:00 1994 Paul Eggert <eggert@twinsun.com> - - * configure.in (AC_ARG_PROGRAM): Added. - (AC_OUTPUT): Add [date > stamp-h]. - - * Makefile.in (DEFAULT_EDITOR_PROGRAM, DIFF_PROGRAM, LIBOBJS, - NULL_DEVICE, PR_PROGRAM, PROGRAMS): New variables. - (check, stamp-h.in, cmp.o, util.o): New targets. - (edit_program_name): New variable; replaces old binprefix method. - (install, uninstall): Use it. - (binprefix): Removed. - (distfiles): Add stamp-h.in. - (clean): Clean stamp-h. - (config.hin, config.h): Use time stamp files. - (cmp_o): Add $(LIBOBJS). - (install): Install info files from srcdir if they're not in `.'. - - * cmp.c, io.c (word): Don't define if already defined. - - * comp.c (main): Use setmode, not open(..., O_BINARY); this gets stdin. - Use NULL_DEVICE instead of "/dev/null". - (cmp): Use %lu instead of %ld when it is more likely to be right. - - * diff.h (PR_FILE_NAME): Rename to PR_PROGRAM and move to Makefile.in, - util.c. - - * diff3.c (main): Give proper diagnostic if too many labels were given. - (read_diff): Use SYSTEM_QUOTE_ARG. - - * system.h: <string.h>: Include if HAVE_STRING_H, too. - <ctype.h>: Include here. All includers changed. - (CTYPE_DOMAIN, ISDIGIT, ISPRINT, ISSPACE, ISUPPER): New macros that - work around common <ctype.h> problems. - (O_BINARY): Remove. - (SYSTEM_QUOTE_ARG): New macros. - - * diff.c: Add comment. - - * util.c (PR_PROGRAM): Moved here from diff.h. - (begin_output): Use SYSTEM_QUOTE_ARG. - - * io.c (read_files): Set mode to binary before returning 1. - - * sdiff.c (TMPDIR_ENV): New macro. - (DEFAULT_EDITOR_PROGRAM): Renamed from DEFAULT_EDITOR for consistency. - (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; use PVT_tmpdir. - -Tue Sep 13 18:46:43 1994 Paul Eggert <eggert@twinsun.com> - - * configure.in (AC_FUNC_MEMCHR): Remove. Autoconf didn't adopt this, - since we need not worry about an old experimental library - where memchr didn't work. - (AC_FUNC_MEMCMP): Not needed, since we only test for equality. - (AC_REPLACE_FUNCS): Add test for memchr. - (AC_CHECK_FUNCS): Check for memchr, not memcpy, since it'll be cached. - (AC_CHECK_HEADERS): Add string.h; regex.c uses on some old hosts. - - * system.h (memcmp): Define in terms of bcmp. - Use HAVE_MEMCHR to test for all mem* routines. - - * Makefile.in (srcs): Remove memcmp.c. - We use bcmp if memcmp doesn't work, since we only test for equality. - -Mon Sep 12 15:52:22 1994 Paul Eggert <eggert@twinsun.com> - - * configure.in (AC_CONFIG_HEADER): Rename config.h.in to config.hin. - (AC_ISC_POSIX, AC_MINIX): Go back to these old names for Autoconf 2. - (AC_CHECK_HEADERS): Remove now-redundant check for <string.h>. - (AC_CHECK_FUNCS): Check for strchr. - (AC_FUNC_MEMCHR, AC_FUNC_MEMCMP, AC_CHECK_FUNCS): Use special-purpose - macros when suitable. - * memcmp.c: New file. - * Makefile.in (CPPFLAGS, DEFS, CFLAGS, LDFLAGS, prefix, exec_prefix): - Default to autoconf-specified strings. - (COMPILE): Use the defaults. - (srcs): Add memcmp.c. - (distfiles): Rename config.h.in->config.hin, install.sh->install-sh. - (Makefile, config.h, config.hin, config.status): Rework for - compatibility with Autoconf 2. - * io.c (binary_file_p): Assume non-broken memchr. - * memchr.c: Assume compiler understands void *; otherwise - we don't match GCC's internal declaration of memchr. - * system.h: Use more modern autoconf approach to standard C headers. - * version.c: Include <config.h>, not "config.h". - - * diff.c, diff.h (ignore_some_line_changes): - New variable; replaces `length_varies'. - (line_end_char): Replace with '\n'; it wasn't being used consistently. - - * io.c (find_and_hash_each_line): Fix inconsistencies with -b -w -i and - incomplete lines. Put incomplete lines into their own bucket. - This means line_cmp no longer needs line length arguments, - and equivalence classes' line lengths no longer need to include \n. - Invoke line_cmp only if ignore_some_line_changes. - (prepare_text_end): -B no longer ignores missing newlines. - (read_files): Allocate another bucket for incomplete lines. - - * util.c (line_cmp): Now takes just two arguments. No longer - optimizes for common case of exact equality; the caller does that - optimization now. The caller is changed accordingly. - Optimize for the common case of mostly equality. - Use isupper+tolower instead of islower+toupper, for consistency. - - * waitpid.c (waitpid): Fix typo with internal scoping. - -Thu Sep 8 08:23:15 1994 Paul Eggert <eggert@twinsun.com> - - * configure.in: Revamp for Autoconf 2. - * memchr.c, waitpid.c: New source files for substitute functions. - * Makefile.in (diff_o, diff3_o, sdiff_o): Add $(LIBOBJS). - (srcs): Add memchr.c, waitpid.c. - (distfiles): Add install.sh, memchr.c, waitpid.c, install.sh. - * system.h: Use Autoconf 2 style HAVE_DIRENT_H etc. macros for dirs. - * dir.c (dir_sort): Prefer NAMLEN (p) to strlen (p->d_name). - Change VOID_CLOSEDIR to CLOSEDIR_VOID for Autoconf 2. - * sdiff.c, util.c (memchr, waitpid): Remove; use new substitutes. - * diff3.c (read_diff): Use new waitpid substitute. - - * cmp.c, diff.c, diff3.c, sdiff.c (check_stdout, try_help): New fns. - (usage): Just print more detailed usage message; let caller exit. - * diff.c (option_help): New variable. - (filetype): Add Posix.1b file types. - -Fri Sep 2 16:01:49 1994 Paul Eggert <eggert@twinsun.com> - - * configure.in: Switch to new autoconf names. Add sys/file.h test. - * Makefile.in (distclean): Clean config.cache, config.log - (used by new autoconf). - - * diff.c, diff3.c, (main), sdiff.c (trapsigs): If we'll have children, - make sure SIGCHLD isn't ignored. - - * diff3.c (DIFF_CHUNK_SIZE): Removed. Get size from STAT_BLOCKSIZE. - (INT_STRLEN_BOUND): New macro. - - * ifdef.c (format_group, groups_letter_value): - Use * instead of [] in prototypes. - - * system.h: Include <sys/file.h> only if HAVE_SYS_FILE_H. - (S_IXGRP, S_IXOTH, S_IXUSR): Remove unused macros. - - * util.c (begin_output): Check fdopen result. - - The following changes simplify porting to non-Posix environments. - * cmp.c, diff.c, diff3.c, sdiff.c, (main): Call initialize_main first. - * diff.c (binary_I_O): New variable for --binary option. - (main, usage, compare_files): Support --binary option. - (compare_files): Use filename_lastdirchar to find last - directory char in a file name. - * cmp.c (main), diff.c (compare_files), dir.c (compare_names, - diff_dirs): Use filename_cmp to compare file names. - Use same_file to determine whether two files are the same. - * context.c (print_context_label): Check whether ctime yields 0. - * diff3.c (read_diff), sdiff.c (cleanup, main, waitpid), - util.c (begin_output): Use popen+pclose if !HAVE_FORK. - * io.c (sip): If HAVE_SETMODE, test for binary files in O_BINARY mode. - * sdiff.c (ck_fdopen): Function removed. - (edit): Use system if !HAVE_FORK. - (execdiff): Now assumes caller has pushed all args, plus trailing 0. - All callers changed. - (private_tempnam): Try TMP if TMPDIR isn't defined. - Fit temporary filenames into 8.3 limit. - * system.h (STAT_BLOCKSIZE): Don't define if already defined. - (min, max): Undef if already defined. - (filename_cmp, filename_lastdirchar, HAVE_FORK, HAVE_SETMODE, - initialize_main O_BINARY, same_file): New macros. - -Fri Jun 17 11:23:53 1994 David J. MacKenzie (djm@geech.gnu.ai.mit.edu) - - * Makefile.in (info, dvi, diff.dvi): New targets. - (clean): Remove TeX output files. - -Fri Jun 17 05:37:52 1994 Paul Eggert (eggert@twinsun.com) - - * cmp.c, io.c (word): Change from typedef to #define, to avoid - collision with Unicos 8.0 <sys/types.h>, which also typedefs `word'. - -Thu Apr 15 00:53:01 1994 Paul Eggert (eggert@twinsun.com) - - * diff3.c (scan_diff_line), util.c (print_number_range): Don't - rely on promotion to make the old-style parameter type agree - with the prototype parameter type; this doesn't work on - Apollos running bsd4.3. - -Mon Jan 3 02:05:51 1994 Paul Eggert (eggert@twinsun.com) - - * Makefile.in (LDFLAGS): Remove -g. Change all link commands - to use both $(CFLAGS) and $(LDFLAGS). - -Mon Dec 13 12:23:27 1993 Paul Eggert (eggert@twinsun.com) - - * system.h: Don't assume dirent.h exists just because - _POSIX_VERSION is defined. - -Fri Dec 3 18:39:39 1993 Paul Eggert (eggert@twinsun.com) - - * diff.c (main): allow -pu. - -Tue Nov 23 03:51:08 1993 Paul Eggert (eggert@twinsun.com) - - * Makefile.in (distclean): Remove config.h. - -Wed Nov 10 00:28:27 1993 Paul Eggert (eggert@twinsun.com) - - * Version 2.6 released. - - * analyze.c (too_expensive): New variable, for heuristic to - limit the worst-case cost to O(N**1.5 log N) at the price of - producing suboptimal output for large inputs with many differences. - (diff_2_files): Initialize it. - (struct partition): New type. - (SNAKE_LIMIT): New macro; merely documents already-used number 20. - (diag): New `minimal' arg; all callers changed. Put results into - struct partition. Apply `too_expensive' heuristic. Tune. - (compareseq): New `minimal' arg; all callers changed. Tune. - (shift_boundaries): Improve heuristic to also coalesce adjacent runs - of changes more often. - - * diff.c (long_options, main, usage): Add `--help'. - (main): Send version number to stdout, not stderr. - (usage): Send usage to stdout, not stderr. - (compare_files): Initialize `inf' properly. - - * io.c (word): Change to `int'; it makes a big difference on x86. - (sip, slurp): Put off allocating room to hold the whole file until we - have to read the whole file. This wins if the file turns out - to be binary. - - * util.c (xmalloc, xrealloc): "virtual memory" -> "memory" - (primes): Omit large primes if INT_MAX is small. - - * sdiff.c (usage): Send usage to stdout, not stderr. - (long_options, main, usage): Add `--help'. - (main): Send version number to stdout, not stderr. Exit afterwards. - - * diff3.c (usage): Send usage to stdout, not stderr. - (long_options, main, usage): Add `--help'. - (read_diff): Detect integer overflow in buffer size calculations. - - * cmp.c (word): New type. All uses of `long' for - word-at-a-time comparisons changed to `word'. - (long_options, main, usage): Add `--help'. - (usage): Send usage to stdout, not stderr. - (main): Add `-v'. Send version number to stdout, not stderr. - - * configure.in (AC_HAVE_HEADERS): Add unistd.h; remove AC_UNISTD_H. - -Mon Sep 27 07:20:24 1993 Paul Eggert (eggert@twinsun.com) - - * diff.c (add_exclude_file): Cast memchr to (char *) - to suppress bogus warnings on some nonstandard hosts. - - * Makefile.in (cmp): Add version.o. - - * analyze.c (diff_2_files): Work around memcmp bug with size=0. - - * cmp.c (main, usage, version_string): Add --version option. - - * system.h (malloc, realloc): Declare only if !HAVE_STDLIB_H. - (memchr): Declare only if !HAVE_MEMCHR. These changes are - needed to keep some nonstandard hosts happy. - - * util.c (memchr): Make first arg char const * - to match standard. - (xmalloc, xrealloc): Cast malloc, realloc - to (VOID *) to suppress bogus warnings on some nonstandard hosts. - - * diff3.c (xmalloc, xrealloc): Cast malloc, realloc - to (VOID *) to suppress bogus warnings on some nonstandard hosts. - - * sdiff.c (xmalloc, xrealloc): Cast malloc, realloc - to (VOID *) to suppress bogus warnings on some nonstandard hosts. - (lf_copy, lf_skip, lf_snarf): Cast memchr to (char *) - to suppress bogus warnings on some nonstandard hosts. - (memchr): Make first arg char const * - to match standard. - -Mon Sep 27 00:23:37 1993 Paul Eggert (eggert@twinsun.com) - - * Version 2.5 released. - - * analyze.c (diff_2_files): Work around memcmp bug with size=0. - - * cmp.c (main, usage, version_string): Add --version option. - * Makefile.in (cmp): Add version.o. - - * diff.c (add_exclude_file): Cast memchr to (char *) - to suppress bogus warnings on some nonstandard hosts. - * sdiff.c (lf_copy, lf_skip, lf_snarf): Likewise. - - * diff3.c, sdiff.c, util.c (xmalloc, xrealloc): Cast malloc, realloc - to (VOID *) to suppress bogus warnings on some nonstandard hosts. - - * sdiff.c, util.c (memchr): Make first arg char const * - to match standard. - - * system.h (malloc, realloc): Declare only if !HAVE_STDLIB_H. - (memchr): Declare only if !HAVE_MEMCHR. These changes are - needed to keep some nonstandard hosts happy. - - * xmalloc.c: Include <sys/types.h> always; some nonstandard hosts - need it for size_t even if STDC_HEADERS. - -Sat Sep 18 01:33:07 1993 Paul Eggert (eggert@twinsun.com) - - * configure.in (AC_STAT_MACROS_BROKEN): Add. - * system.h (S_IS{BLK,CHR,DIR,FIFO,REG,SOCK}): Fix defns if - STAT_MACROS_BROKEN. - - * Makefile.in (diff3, sdiff, cmp): Do not link $(ALLOCA). - - * analyze.c (discard_confusing_lines): Make defn static, like decl. - * sdiff.c (xmalloc): Likewise. - - * ifdef.c (format_group): Ensure isdigit argument isn't < 0. - - * side.c (print_half_line): Use isprint, since some hosts lack isgraph. - * util.c (output_1_line): Likewise. Ensure its argument isn't < 0. - (xmalloc, xrealloc): Remove needless casts. - - * system.h (volatile, const): - Define these before including any system headers, - so that they're used consistently in all system includes. - (getenv, malloc, realloc): Declare even if HAVE_STDLIB_H, since some - <stdlib.h>s don't declare them. - (memchr): Likewise for <string.h>. - - * cmp.c, diff3.c, diff.h, sdiff.c: Include "system.h" first. - * diff.c: Remove redundant "system.h" inclusion. - - * diff3.c (xmalloc): Now static. - (xmalloc, realloc): Remove needless casts. - (READNUM): Ensure isdigit argument isn't negative. - -Wed Sep 14 07:14:15 1993 Paul Eggert (eggert@twinsun.com) - - * Version 2.4 released. - - * ifdef.c (scan_char_literal): New function, for new %c'x' and - %c'\ooo' format specs. - (format_group, print_ifdef_lines): Use it. Remove %0 format spec. - - * cmp.c (cmp): Don't try to read past end of file; this doesn't - work on ttys. - - * system.h, version.c: #include <config.h>, not "config.h", to allow - configuring in a separate directory when the source directory has - already been configured. - * Makefile.in (COMPILE): New defn, with proper -I options so that - `#include <config.h>' works. - (.c.o, diff3.o, sdiff.o): Use it. - -Mon Sep 13 06:45:43 1993 Paul Eggert (eggert@twinsun.com) - - * diff.c (main, longopts): Add --line-format=FORMAT option. - (specify_format): Args no longer const pointers. All callers changed. - - * ifdef.c: Add support for %?c, %(A=B?T:E), PRINTF_SPECn formats. - (struct group): New struct. - (print_ifdef_lines): Use it to simplify argument passing. - Remove the convention that last arg -1 signifies that the lines - from file 2 are the same as the lines from file 1; this - convention no longer works, now that line numbers might be - printed out, since the line numbers may differ. - Add first FILE * argument to output to. All callers changed. - Use a faster test for the single-fwrite optimization. - (format_group, scan_printf_spec, groups_letter_value): New functions. - - * diff.h (group_format, line_format): No longer const pointers. - (format_ifdef): 1st arg is no longer const pointer. - - * configure.in: Configure HAVE_LIMITS_H, HAVE_STDLIB_H. - * system.h <limits.h>, <stdlib.h>, <string.h>: - Include only if HAVE_LIMITS_H etc. - - * system.h (memcmp, memcpy, strchr, strrchr, struct dirent): Prefer - these standard names to the traditional names (bcmp, bcpy, index, - rindex, struct direct). All callers changed. - - * system.h (PARAMS, VOID): - Define earlier so that malloc decl can use VOID. - (STAT_BLOCKSIZE): Simplify ersatz defn; just use 8K. - -Fri Sep 3 00:21:02 1993 Paul Eggert (eggert@twinsun.com) - - * diff.c (compare_files): Two files with the same name must be - the same file; avoid a needless `stat' in that case. - -Fri Aug 27 06:59:03 1993 Paul Eggert (eggert@twinsun.com) - - * Pervasive changes for portability to 64-bit hosts: - Add prototypes to function declarations. - Use size_t, not int, when needed. - - * Other pervasive changes: - Use `const' more often. - Use STD{IN,OUT,ERR}_FILENO instead of [012]. - Use 0, not NULL, for portability to broken hosts. - - * Makefile.in: (srcs, objs, distfiles, cmp): New files cmpbuf.[ch]. - (distfiles): New files config.h.in, mkinstalldirs. - (.c.o): Add -DHAVE_CONFIG_H. - - * analyze.c: (diag): Pacify `gcc -Wall' with a useless assignment. - (diff_2_files): Use l.c.m., not max, of files' buffer sizes. - - * cmp.c: Make globals static when possible. - - (file): Now a 2-element array; replaces `file1' and `file2'. - (file_desc, buffer): Likewise, for file[12]_desc and buf[12]. - (main): Likewise, for stat_buf[12]. Index these variables with `i'. - - (ignore_initial): New var. - (long_options): Now const. Add `--ignore-initial'. - (usage): Sort options and add `--ignore-initial'. - (main, cmp): Add `--ignore-initial' support. - - (main): `cmp - -' now succeeds. - When comparing standard input to a file, and using a shortcut (e.g. - looking at file sizes or inode numbers), take the lseek offset into - account before deciding whether the files are identical. - Avoid mentioning `dev_t', `ino_t' for portability to nonstandard hosts. - Use l.c.m. of files' buffer sizes, not 8 * 1024. - ferror (stdout) does not imply errno has a useful value. - If 2nd file is "-", treat it first, in case stdin is closed. - - (cmp): Always compute `char_number', `smaller' for speed and simplicity. - Say `cmp: EOF on input', not `/usr/gnu/bin/cmp: EOF on input', - as per Posix.2. - - (block_compare_and_count): Increment line_number argument. - Remove end_char argument; it's always '\n'. All callers changed. - Do not assume sizeof(long) == 4; this isn't true on some 64-bit hosts. - (block_compare): Minimize differences with block_compare_and_count. - - (block_read): Coalesce `bp += nread's. - - (printc): Remove `FILE *' arg; output to stdout. All callers changed. - - * configure.in: Configure HAVE_SIGACTION, RETSIGTYPE, HAVE_VPRINTF. - Configure into config.h. - - * context.c (print_context_label): - Standard input's st_mtime is no longer a special case - here, since `compare_files' now sets it to the current time. - - * diff.c (usage): Sort options. - (filetype): New function. - (compare_files): Set stdin's st_mtime to be the current time. - Leave its name "-" instead of changing it to "Standard Input"; - to test whether a file is stdin, we must compare its name to "-" instead - of its desc to 0, since if it's closed other file descs may be 0. - When comparing standard input to a file, and using a shortcut (e.g. - looking at file sizes or inode numbers), take the lseek offset into - account before deciding whether the files are identical. - Pretend that nonexistent files have the same filetype as existing files. - Rename `errorcount' to `failed', since it's boolean. - In directory comparisons, if a file is neither a regular file nor a - directory, just print its type and the other file's type. - - * diff.h (Is_space, textchar): Remove. - (struct msg, msg_chain, msg_chain_end): Move to util.c. - (VOID): Move to system.h. - (line_cmp, version_string, change_letter, print_number_range, - find_change): New decls. - - * diff.texi: - whitespace -> white space. It now stands for whatever isspace yields. - Add --ignore-initial. - - * diff3.c (VOID): Move to system.h. - (version_string): Now char[]. - (usage): Sort options. - (process_diff): Pacify `gcc -Wall' with a useless assignment. - (read_diff): pid is of type pid_t, not int. Use waitpid if available. - (output_diff3): Simplify test for `\ No newline at end of file' message. - - * dir.c (struct dirdata): Rename `files' to `names' to avoid confusion - with external struct file_data `files'. - - * io.c (line_cmp): Move declaration to diff.h. - (textchar): Remove. - (find_and_hash_each_line): Use locale's definition of white space - instead of using one hardwired defn for -b and another for -w. - - * normal.c (change_letter, print_number_range, find_change): - Move decls to diff.h. - (print_normal_hunk): Now static. - - * sdiff.c (SEEK_SET): Move to system.h. - (version_string): Now char[], not char*. - (private_tempnam): Remove hardcoded limit on temporary file names. - (exiterr, perror_fatal, main): When exiting because of a signal, - exit with that signal's status. - (lf_refill, main, skip_white, edit, interact): Check for signal. - (ignore_SIGINT): Renamed from `ignore_signals'. - (NUM_SIGS, initial_handler): New macros. - (initial_action, signal_received, sigs_trapped): New vars. - (catchsig, trapsigs): Use sigaction if possible, since this closes the - windows of vulnerability that `signal' has. Use RETSIGTYPE not void. - When a signal comes in, just set a global variable; this is safer. - (checksigs, untrapsig): New functions. - (edit): Pacify `gcc -Wall' with a useless assignment. - Respond to each empty line with help, not to every other empty line. - (private_tempnam): Remove hardcoded limit on temporary file name length. - Don't assume sizeof (pid_t) <= sizeof (int). - - * system.h: (S_IXOTH, S_IXGRP, S_IXUSR, - SEEK_SET, SEEK_CUR, - STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO): - New macros, if system doesn't define them. - (volatile): Don't define if already defined. - (PARAMS): New macro. - (VOID): Move here from diff.h. - - * util.c (struct msg, msg_chain, msg_chain_end): Moved here from diff.h. - (message5): New function. - (pr_pid): New var. - (begin_output): Allocate `name' more precisely. - Put child pid into pr_pid, so that we can wait for it later. - Don't check execl's return value, since any return must be an error. - (finish_output): Detect and report output errors. - Use waitpid if available. Check pr exit status. - (line_cmp): Use locale's definition of white space - instead of using one hardwired defn for -b and another for -w. - (analyze_cmp): Avoid double negation with `! nontrivial'. - Pacify `gcc -Wall' be rewriting for-loop into do-while-loop. - (dir_file_pathname): New function. - - * version.c (version_string): Now char[], not char*. - -Thu Jul 29 20:44:30 1993 David J. MacKenzie (djm@wookumz.gnu.ai.mit.edu) - - * Makefile.in (config.status): Run config.status --recheck, not - configure, to get the right args passed. - -Thu Jul 22 10:46:30 1993 Paul Eggert (eggert@twinsun.com) - - * Makefile.in (dist): Replace `if [ ! TEST ]; then ACTION; fi' - with `[ TEST ] || ACTION || exit' so that the containing for-loop exits - with proper status for `make'. - -Thu Jul 8 19:47:22 1993 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu) - - * Makefile.in (installdirs): New target. - (install): Use it. - (Makefile, config.status, configure): New targets. - -Sat Jun 5 23:10:40 1993 Paul Eggert (eggert@twinsun.com) - - * Makefile.in (dist): Switch from .z to .gz. - -Wed May 26 17:16:02 1993 Paul Eggert (eggert@twinsun.com) - - * diff.c (main): Cast args to compare_files, for traditional C. - * side.c (print_sdiff_common_lines_print_sdiff_hunk): Likewise. - * analyze.c, diff3.c, sdiff.c, util.c: Don't assume NULL is defined - properly. - -Tue May 25 14:54:05 1993 Paul Eggert (eggert@twinsun.com) - - * analyze.c (diff_2_files): With -q, do not report that files differ - if all their differences are ignored. - (briefly_report): New function. - * diff.h (ignore_some_changes): New variable. - * diff.c (compare_files): Don't use the file size shortcut if - ignore_some_changes is nonzero, since the file size may differ - merely due to ignored changes. - (main): Set ignore_some_changes if we might ignore some changes. - Remove unsystematic assignment of 0 to static vars. - * io.c (read_files): New argument PRETEND_BINARY says whether to - pretend the files are binary. - - * diff3.c (tab_align_flag): New variable, for new -T option. - (main, usage, output_diff3): Add support for -T. - -Sun May 23 15:25:29 1993 Richard Stallman (rms@mole.gnu.ai.mit.edu) - - * dir.c (dir_sort): Always init `data' to avoid GCC warning. - -Sat May 22 15:35:02 1993 Paul Eggert (eggert@twinsun.com) - - * Makefile.in (dist): Change name of package from diff to diffutils. - Don't bother to build .Z dist; .z suffices. - -Fri May 21 16:35:22 1993 Paul Eggert (eggert@twinsun.com) - - * diff.c: Include "system.h" to get memchr declaration. - * system.h (memchr): Declare if !HAVE_MEMCHR, not if - !HAVE_MEMCHR && !STDC_HEADERS. - -Wed May 19 17:43:55 1993 Paul Eggert (eggert@twinsun.com) - - * Version 2.3 released. - -Fri Apr 23 17:18:44 1993 Paul Eggert (eggert@twinsun.com) - - * io.c (find_identical_ends): Do not discard the last HORIZON_LINES - lines of the prefix, or the first HORIZON_LINES lines of the suffix. - * diff.c (main, longopts, usage): Add --horizon-lines option. - * diff3.c (main, process_diff, read_diff): Invoke second diff - with --horizon-lines determined by the first diff. - * diff.h, diff3.c (horizon_lines): New variable. - -Mon Mar 22 16:16:00 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) - - * system.h [HAVE_STRING_H || STDC_HEADERS] (bcopy, bcmp, bzero): - Don't define if already defined. - -Fri Mar 5 00:20:16 1993 Richard Stallman (rms@mole.gnu.ai.mit.edu) - - * diff.c (main): Use NULL in arg to compare_files. - -Thu Feb 25 15:26:01 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) - - * system.h: Declare memchr #if !HAVE_MEMCHR && !STDC_HEADERS, - not #if !HAVE_MEMCHR || !STDC_HEADERS. - -Mon Feb 22 15:04:46 1993 Richard Stallman (rms@geech.gnu.ai.mit.edu) - - * io.c (find_identical_ends): Move complicated arg outside GUESS_LINES. - -Mon Feb 22 12:56:12 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) - - * Makefile.in (.c.o): Add -I$(srcdir); put $(CFLAGS) last before $<. - -Sat Feb 20 19:18:56 1993 Richard Stallman (rms@mole.gnu.ai.mit.edu) - - * io.c (binary_file_p): Return zero if file size is zero. - -Fri Feb 19 17:31:32 1993 Roland McGrath (roland@geech.gnu.ai.mit.edu) - - * Version 2.2 released. - - * system.h [HAVE_STRING_H || STDC_HEADERS] (index, rindex): Don't - define if already defined. - -Wed Feb 17 17:08:00 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) - - * Makefile.in (srcs): Remove limits.h. - -Thu Feb 11 03:36:00 1993 Richard Stallman (rms@mole.gnu.ai.mit.edu) - - * diff3.c (xmalloc): No longer static. - - * sdiff.c (edit): Allocate buf dynamically. - - * dir.c (dir_sort): Handle VOID_CLOSEDIR. - -Wed Feb 10 00:15:54 1993 Richard Stallman (rms@mole.gnu.ai.mit.edu) - - * limits.h: File deleted (should never have been there). - -Tue Feb 9 03:53:22 1993 Richard Stallman (rms@mole.gnu.ai.mit.edu) - - * Makefile.in (.c.o, diff3.o, sdiff.o): Put $(CFLAGS) last. - -Wed Feb 3 15:42:10 1993 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu) - - * system.h: Don't #define const; let configure do it. - -Mon Feb 1 02:13:23 1993 Paul Eggert (eggert@hal.gnu.ai.mit.edu) - - * Version 2.1 released. - - * Makefile.in (dist): Survive ln failures. Create .tar.z - (gzipped tar) file as well as .tar.Z (compressed tar) file. - -Fri Jan 8 22:31:41 1993 Paul Eggert (eggert@twinsun.com) - - * side.c (print_half_line): When the input position falls - outside the column, do not output a tab even if the output - position still falls within the column. - -Mon Dec 21 13:54:36 1992 David J. MacKenzie (djm@kropotkin.gnu.ai.mit.edu) - - * Makefile.in (.c.o): Add -I. - -Fri Dec 18 14:08:20 1992 Paul Eggert (eggert@twinsun.com) - - * configure.in: Add HAVE_FCNTL_H, since system.h uses it. - -Tue Nov 24 10:06:48 1992 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu) - - * Makefile.in: Note change from USG to HAVE_STRING_H. - -Mon Nov 23 18:44:00 1992 Paul Eggert (eggert@twinsun.com) - - * io.c (find_and_hash_each_line): When running out of lines, - double the number of allocated lines, instead of just doubling - that number minus the prefix lines. This is more likely to - avoid the need for further memory allocation. - -Wed Nov 18 20:40:28 1992 Paul Eggert (eggert@twinsun.com) - - * dir.c (dir_sort): Plug memory leak: space holding directory - contents was not being reclaimed. Get directory size from - struct file_data for initial guess at memory needed. - Detect errors when reading and closing directory. - (diff_dirs): Pass struct file_data to dir_sort. Finish plugging leak. - * diff.c (compare_files): Pass struct file_data to diff_dirs. - - * io.c (find_and_hash_each_line): Don't assume alloc_lines is - nonzero when allocating more lines. - -Thu Nov 12 16:02:18 1992 Paul Eggert (eggert@twinsun.com) - - * diff.c (main): Add `-U lines' as an alias for `--unified=lines'. - - * diff3.c (usage): Add third --label option in example. - - * util.c (analyze_hunk): Fix test for ignoring blank lines. - - * configure.in, system.h: Avoid USG; use HAVE_TIME_H etc. instead. - -Mon Nov 9 05:13:25 1992 Paul Eggert (eggert@twinsun.com) - - * diff3.c (main, usage): Add -A or --show-all. - -m now defaults to -A, not -E. Allow up to three -L options. - (output_diff3_edscript, output_diff3_merge): - Remove spurious differences between these two functions. - Output ||||||| for -A. Distinguish between conflicts and overlaps. - (dotlines, undotlines): New functions that output `Ns', not `N,Ns'. - (output_diff3_edscript, output_diff3_merge): Use them. - - * io.c (find_identical_ends): shift_boundaries needs an extra - identical line at the end, not at the beginning. - - * sdiff.c (edit): execvp wants char **, not const char **. - -Mon Oct 19 04:39:32 1992 Paul Eggert (eggert@twinsun.com) - - * context.c (print_context_script, find_function): Context - line numbers start with - file->prefix_lines, not 0. - - * io.c (binary_file_p): Undo last change; it was a library bug. - -Sun Oct 18 00:17:29 1992 Richard Stallman (rms@mole.gnu.ai.mit.edu) - - * io.c (binary_file_p): Consider empty file as non-binary. - -Mon Oct 5 05:18:46 1992 Paul Eggert (eggert@twinsun.com) - - * diff3.c (main, make_3way_diff, using_to_diff3_block): Don't - report bogus differences (for one of -mexEX3) just because the - file0-file1 diffs don't line up with the file0-file2 diffs. - (This is entirely possible since we don't use diff's -n - option.) Always compare file1 to file2, so that diff3 sees - those changes directly. Typically, file2 is now the common - file, not file0. - (output_diff3_merge): The input file is file 0, not the common file. - - (FC, FO): New macros; they replace FILE1, FILE0 for two-way diffs, - to distinguish them from three-way diffs. - - * diff3.c (using_to_diff3_block): Fold repeated code into loops. - - * diff3.c (make_3way_diff, process_diff): Have the *_end - variable point to the next field to be changed, not to the last - object allocated; this saves an if-then-else. - - * diff3.c (process_diff): Use D_NUMLINES instead of its definiens. - - * diff3.c: Make fns and vars static unless they must be external. - -Wed Sep 30 09:21:59 1992 Paul Eggert (eggert@twinsun.com) - - * analyze.c (diff_2_files): OUTPUT_IFDEF is now robust. - * diff.h (ROBUST_OUTPUT_STYLE): Likewise. - (default_line_format): Remove. All refs removed. - - * ifdef.c (print_ifdef_lines): Add %L. Optimize %l\n even if user - specified it, as opposed to its being the default. - -Tue Sep 29 19:01:28 1992 Paul Eggert (eggert@twinsun.com) - - * diff.c (longopts, main): --{old,new,unchanged,changed}--group-format - are new options, so that -D is no longer overloaded. Set - no_diff_means_no_output if --unchanged-{line,group}-format allows it. - * diff.h (enum line_class): New type. - (group_format, line_format): Use it to regularize option flags. - All refs changed. - - * ifdef.c (format_ifdef, print_ifdef_lines): %n is no longer a format. - -Mon Sep 28 04:51:42 1992 Paul Eggert (eggert@twinsun.com) - - * diff.c (main, usage): Replace --line-prefix with the more general - --{old,new,unchanged}-line-format options. - * ifdef.c (format_ifdef, print_ifdef_lines): Likewise. - * diff.h (line_format): Renamed from line_prefix. All refs changed. - * diff.h, ifdef.c (default_line_format): New variable. - * util.c (output_1_line): New function. - (print_1_line): Use it. - - * ifdef.c: (format_ifdef, print_ifdef_lines): Add %0 format. - -Sun Sep 27 05:38:13 1992 Paul Eggert (eggert@twinsun.com) - - * diff.c (main): Add -E or --line-prefix option. Add -D'=xxx' - for common lines. Change default -D< format from copy of -D> - format to to -D<%<; similarly for default -D> format. - * diff.h (common_format, line_prefix): New variables. - * ifdef.c (format_ifdef): New function. - (print_ifdef_script, print_ifdef_hunk, print_ifdef_lines): - Use it for -D'=xxx', -E. - - * context.c (find_hunk): Glue together two non-ignorable changes that - are exactly CONTEXT * 2 lines apart. This shortens output, removes - a behavioral discontinuity at CONTEXT = 0, and is more compatible - with traditional diff. - - * io.c (find_identical_ends): Slurp stdin at most once. - - * util.c (print_line_line): line_flag is const char *. - -Thu Sep 24 15:18:07 1992 Paul Eggert (eggert@twinsun.com) - - * ifdef.c (print_ifdef_lines): New function, which fwrites a sequence - of lines all at once for speed. - (print_ifdef_script, print_ifdef_hunk): Use it. - -Thu Sep 24 05:54:14 1992 Paul Eggert (eggert@twinsun.com) - - * diff.c (main): Support new -D options for if-then-else formats. - (specify_format): New function. - * diff.h (ifndef_format, ifdef_format, ifnelse_format): New variables. - * ifdef.c (print_ifdef_hunk): Use the new variables instead of - a hardwired format. - - * side.c (print_1sdiff_line): Represent incomplete lines on output. - (print_sdiff_script): Likewise. Don't print 'q' at end, - since that doesn't work with incomplete lines. - * sdiff.c (interact): Don't assume diff output ends with 'q' line. - * diff.h (ROBUST_OUTPUT_STYLE): OUTPUT_SDIFF is now robust. - - * sdiff.c (lf_copy, lf_snarf): Use memchr instead of index, - to avoid dumping core when files contain null characters. - (memchr): New function (if memchr is missing). - - * io.c (sip): New arg SKIP_TEST to skip test for binary file. - (read_files): Don't bother testing second file if first is binary. - -Thu Sep 17 21:17:49 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) - - * system.h [!USG && !_POSIX_VERSION]: Protect from conflicting - prototype for wait in sys/wait.h. - -Wed Sep 16 12:32:18 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) - - * Makefile.in: Include binprefix in -DDIFF_PROGRAM. - -Tue Sep 15 14:27:25 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) - - * Version 2.0. - -Sat Sep 12 01:31:19 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) - - * util.c, diff.h, system.h [!HAVE_MEMCHR]: Don't use void * - and const when declaring memchr replacement. Declare memchr - if !STDC_HEADERS && !USG. - -Thu Sep 10 15:17:32 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) - - * Makefile.in (uninstall): New target. - - * diff.c (excluded_filename): Use fnmatch, not wildmat. - (usage): Document -x, -X, --exclude, --exclude-from. - Makefile.in: Use fnmatch.c, not wildmat.c. - -Sun Sep 6 23:46:25 1992 Paul Eggert (eggert@twinsun.com) - - * configure.in: Add HAVE_MEMCHR. - * diff.h, util.c: Use it instead of MEMCHR_MISSING. - -Sun Sep 6 07:25:49 1992 Paul Eggert (eggert@twinsun.com) - - * diff.h: (struct line_def): Replace this 3-word struct with char *. - This uses less memory, particularly for large files with short lines. - (struct file_data): New member linbuf_base counts number of lines - in common prefix that are not recorded in linbuf; - this uses less memory if files are identical or differ only at end. - New member buffered_lines counts possibly differing lines. - New member valid_lines counts valid data. - New member alloc_lines - linbuf_base replaces old linbufsize. - linbuf[0] now always points at first differing line. - Remove unused members ltran, suffix_lines. - Add const where appropriate. - (Is_space): New macro, for consistent definition of `white space'. - (excluded_filename, memchr, sip, slurp): New declarations. - * ed.c (print_ed_hunk): Adjust to diff.h's struct changes. - * context.c (pr_context_hunk): Likewise. - * ifdef.c (print_ifdef_script): Likewise. - * side.c (print_sdiff_script, print_half_line): Likewise. - * util.c (analyze_hunk, line_cmp, print_1_line): Likewise. - - * analyze.c (shift_boundaries): Remove unneeded variable `end' and - unnecessary comparisons of `preceding' and `other_preceding' against 0. - (diff_2_files): When comparing files byte-by-byte for equality, - don't slurp them all in at once; just compare them a buffer at a time. - This can win big if they differ early on. - Move some code to compare_files to enable this change. - Use only one buffer for stdin with `diff - -'. - (discard_confusing_lines, diff_2_files): Coalesce malloc/free calls. - (build_script): Remove obsolete OUTPUT_RCS code. - - * diff.c (add_exclude, add_exclude_file, excluded_filename): New fns. - (main): Use them for the new --exclude and --exclude-from options. - (compare_files): Don't open a file unless it must be read. - Treat `diff file file' and `diff file dir' similarly. - Move some code here from diff_2_files to enable this. - Simplify file vs dir warning. - - * dir.c (dir_sort): Support new --exclude* options. - - * io.c (struct equivclass): Put hash code and line length here instead - of struct line_def, so that they can be shared. - (find_and_hash_each_line): Compute equivalence class as we go, - instead of doing it in a separate pass; this thrashes memory less. - Make buckets realloc-able, since we can't preallocate them. - Record one more line start than there are lines, so that we can compute - any line's length by subtracting its start from the next line's, - instead of storing the length explicitly. This saves memory. - Move prefix-handling code to find_identical_ends; - this wins with large prefixes. - Use Is_space, not is_space, for consistent treatment of white space. - (prepare_text_end): New function. - (find_identical_ends): Move slurping here, so it's only done when - needed. Work even if the buffers are the same (because of `diff - -'). - Compare prefixes a word at a time for speed. - (find_equiv_class): Delete; now done by find_and_hash_each_line. - (read_files): Don't slurp unless needed. - find_equiv_class's work is now folded into find_and_hash_each_line. - Don't copy stdin buffer if `diff - -'. - Check for running out of primes. - (sip, slurp): Split first part of `slurp' into another function `sip'. - `sip' sets things up and perhaps reads the first ST_BLKSIZE buffer to - see whether the file is binary; `slurp' now just finishes the job. - This lets diff_2_files compare binary files lazily. - Allocate a one-word sentinel to allow word-at-a-time prefix comparison. - Count prefix lines only if needed, only count the first file's prefix. - Don't bother to count suffix lines; it's never needed. - Set up linbuf[0] to point at first differing line. - (binary_file_p): Change test for binary files: - if it has a null byte in its first buffer, it's binary. - (primes): Add more primes. - - * util.c (line_cmp): Use bcmp for speed. - Use Is_space, not is_space, for consistent treatment of white space. - (translate_line_number): Internal line numbers now count from 0 - starting after the prefix. - (memchr): New function (if memchr is missing). - - * Makefile.in: Document HAVE_ST_BLKSIZE. Link with wildmat.o. - * system.h (STAT_BLOCKSIZE): New macro based on HAVE_ST_BLKSIZE. - * configure.in: Add AC_ST_BLKSIZE. - * wildmat.c: New file. - -Fri Sep 4 01:28:51 1992 Richard Stallman (rms@mole.gnu.ai.mit.edu) - - * sdiff.c (xmalloc): Renamed from ck_malloc. Callers changed. - -Thu Sep 3 15:28:59 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) - - * diff.h: Don't declare free, index, rindex. - -Tue Aug 11 22:18:06 1992 John Gilmore (gnu at cygnus.com) - - * io.c (binary_file_p): Use heuristic to avoid declaring info - files as binary files. Allow about 1.5% non-printing - characters (in info's case, ^_). - -Tue Jul 7 01:09:26 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) - - * diff.h: Replace function_regexp and ignore_regexp with lists - of compiled regexps. - * analyze.c, context.c, util.c: Test whether the lists, not - the old variables, are empty. - * util.c (analyze_hunk), context.c (find_function): Compare - lines with the lists of regexps. - * diff.c (add_regexp): New function. - (main): Use it. - - * diff3: Add -v --version option. - * Makefile.in: Link with version.o. - - * system.h: New file. - * diff.h, cmp.c, diff3.c, sdiff.c: Use it. - - * diff.h, diff3.c: Include string.h or strings.h, as appropriate. - Declare malloc and realloc. - - * diff3.c (perror_with_exit): Include program name in message. - - * diff3.c: Lowercase error messages for GNU standards. - - * sdiff.c [USG || STDC_HEADERS]: Define bcopy in terms of memcpy. - - * sdiff.c: Use the version number from version.c. - * Makefile.in: Link with version.o. - - * cmp.c error.c xmalloc.c: New files from textutils. - * Makefile.in: Add rules for them. - - * diff.c (longopts): --unidirectional-new-file is like -P, not -N. - Rename --file-label to --label (leave old name, but undocumented). - - * sdiff.c, diff.c (usage): Condense messages and fix some errors. - - * diff3.c (main, usage): Add long-named options. - -Fri Jul 3 14:31:18 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) - - * diff.h, diff3.c, sdiff.c: Change FOO_MISSING macros to HAVE_FOO. - -Thu Jun 25 16:59:47 1992 David J. MacKenzie (djm@apple-gunkies.gnu.ai.mit.edu) - - * diff.c: --reversed-ed -> --forward-ed. - -Wed Feb 26 12:17:32 1992 Paul Eggert (eggert@yata.uucp) - - * analyze.c, diff.c, diff.h, io.c: For -y, compare even if same file. - -Fri Feb 14 22:46:38 1992 Richard Stallman (rms@mole.gnu.ai.mit.edu) - - * io.c, diff3.c, analyze.c: Add extra parentheses. - -Sun Feb 9 00:22:42 1992 Richard Stallman (rms@mole.gnu.ai.mit.edu) - - * diff.h (unidirectional_new_file_flag): New variable. - * diff.c (main): Set that for -P. - (compare_files): Support -P, somewhat like -N. - (longopts): Support long name for -P. - -Sat Jan 4 20:10:34 1992 Paul Eggert (eggert at yata.uucp) - - * Makefile.in: Distribute diff.info-* too. - - * README, sdiff.c: version number now matches version.c. - - * configure: Fix and document vfork test. - - * ifdef.c: Don't dump core if `diff -Dx f f'. - -Mon Dec 23 23:36:08 1991 David J. MacKenzie (djm at wookumz.gnu.ai.mit.edu) - - * diff.h, diff3.c, sdiff.c: Change POSIX ifdefs to - HAVE_UNISTD_H and _POSIX_VERSION. - -Wed Dec 18 17:00:31 1991 David J. MacKenzie (djm at wookumz.gnu.ai.mit.edu) - - * Makefile.in (srcs): Add sdiff.c. - (tapefiles): Add diff.texi and diff.info. - - * diff.h, diff3.c, sdiff.c: Use HAVE_VFORK_H instead of - VFORK_HEADER and VFORK_WORKS. - -Tue Dec 17 00:02:59 1991 Paul Eggert (eggert at yata.uucp) - - * Makefile.in (all): Add diff.info, sdiff. - - * configure, diff.c, sdiff.c: - Prefix long options with `--', not `+'. - * diff.c: Regularize option names. - - * configure: Fix check for vfork. - * configure, diff.c, diff.h, diff3.c, sdiff.c: - Use Posix definitions when possible. - - * context.c: Align context with tab if -T is given. Tune. - * diff.c, diff.h, side.c: Calculate column widths so that tabs line up. - * io.c: Add distinction between white space and printing chars. - * side.c: Don't expand tabs unless -t is given. - * side.c, util.c: Tab expansion now knows about '\b', '\f', '\r', '\v'. - * util.c: -w skips all white space. Remove lint. Tune. - - * sdiff.c: Support many more diff options, e.g. `-', `sdiff file dir'. - Ignore interrupts while the subsidiary editor is in control. - Clean up temporary file and kill subsidiary diff if interrupted. - Ensure subsidiary diff doesn't ignore SIGPIPE. - Don't get confused while waiting for two subprocesses. - Don't let buffers overflow. Check for I/O errors. - Convert to GNU style. Tune. - - * sdiff.c, util.c: Don't lose errno. - Don't confuse sdiff with messages like `Binary files differ'. - * sdiff.c, side.c: Don't assume that common lines are identical. - Simplify --sdiff-merge-assist format. - -Mon Sep 16 16:42:01 1991 Tom Lord (lord at churchy.gnu.ai.mit.edu) - - * Makefile.in, sdiff.c: introduced sdiff front end to diff. - - * Makefile.in, analyze.c, diff.c, diff.h, io.c, side.c: Added - sdiff-style output format to diff. - -Mon Aug 26 16:44:55 1991 David J. MacKenzie (djm at pogo.gnu.ai.mit.edu) - - * Makefile.in, configure: Only put $< in Makefile if using VPATH, - because older makes don't understand it. - -Fri Aug 2 12:22:30 1991 David J. MacKenzie (djm at apple-gunkies) - - * configure: Create config.status. Remove it and Makefile if - interrupted while creating them. - -Thu Aug 1 22:24:31 1991 David J. MacKenzie (djm at apple-gunkies) - - * configure: Check for +srcdir etc. arg and look for - Makefile.in in that directory. Set VPATH if srcdir is not `.'. - * Makefile.in: Get rid of $(archpfx). - -Tue Jul 30 21:28:44 1991 Richard Stallman (rms at mole.gnu.ai.mit.edu) - - * Makefile.in (prefix): Renamed from DESTDIR. - -Wed Jul 24 23:08:56 1991 David J. MacKenzie (djm at wookumz.gnu.ai.mit.edu) - - * diff.h, diff3.c: Rearrange ifdefs to use POSIX, - STDC_HEADERS, VFORK_MISSING, DIRENT. This way it works on - more systems that aren't pure USG or BSD. - Don't not define const if __GNUC__ is defined -- that would - break with -traditional. - * configure: Check for those features. - -Wed Jul 10 01:39:23 1991 David J. MacKenzie (djm at wookumz.gnu.ai.mit.edu) - - * configure, Makefile.in: $(INSTALLPROG) -> $(INSTALL). - -Sat Jul 6 16:39:04 1991 David J. MacKenzie (djm at geech.gnu.ai.mit.edu) - - * Replace Makefile with configure and Makefile.in. - Update README with current compilation instructions. - -Sat Jul 6 14:03:29 1991 Richard Stallman (rms at mole.gnu.ai.mit.edu) - - * util.c (setup_output): Just save the args for later use. - (begin_output): Do the real work, with the values that were saved. - It's safe to call begin_output more than once. - Print the special headers for context format here. - * analyze.c (diff_2_files): Don't print special headers here. - * context.c (pr_context_hunk, pr_unidiff_hunk): Call begin_output. - * ed.c (print_ed_hunk, print_forward_ed_hunk, print_rcs_hunk): - * normal.c (print_normal_hunk): Likewise. - * ifdef.c (print_ifdef_hunk): Likewise. - * util.c (finish_output): Don't die if begin_output was not called. - -Thu Jun 20 23:10:01 1991 David J. MacKenzie (djm at geech.gnu.ai.mit.edu) - - * Makefile: Add TAGS, distclean, and realclean targets. - Set SHELL. - -Tue Apr 30 13:54:36 1991 Richard Stallman (rms at mole.gnu.ai.mit.edu) - - * diff.h (TRUE, FALSE): Undefine these before defining. - -Thu Mar 14 18:27:27 1991 Richard Stallman (rms@mole.ai.mit.edu) - - * Makefile (objs): Include $(ALLOCA). - -Sat Mar 9 22:34:03 1991 Richard Stallman (rms at mole.ai.mit.edu) - - * diff.h: Include regex.h. - -Thu Feb 28 18:59:53 1991 Richard Stallman (rms at mole.ai.mit.edu) - - * Makefile (diff3): Link with GNU getopt. - -Sat Feb 23 12:49:43 1991 Richard Stallman (rms at mole.ai.mit.edu) - - * io.c (find_equiv_class): Make hash code unsigned before mod. - - * diff.h (files): Add EXTERN. - -Sun Jan 13 21:33:01 1991 Richard Stallman (rms at mole.ai.mit.edu) - - * diff.c: +print option renamed +paginate. Remove +all-text. - -Mon Jan 7 06:18:01 1991 David J. MacKenzie (djm at geech.ai.mit.edu) - - * Makefile (dist): New target, replacing diff.tar and - diff.tar.Z, to encode version number in distribution directory - and tar file names. - -Sun Jan 6 18:42:23 1991 Michael I Bushnell (mib at geech.ai.mit.edu) - - * Version 1.15 released. - - * version.c: Updated from 1.15 alpha to 1.15 - - * context.c (print_context_number_range, - print_unidiff_number_range): Don't print N,M when N=M, print - just N instead. - - * README: Updated for version 1.15. - Makefile: Updated for version 1.15. - - * diff3.c (main): Don't get confused if one of the arguments - is a directory. - - * diff.c (compare_files): Don't get confused if comparing - standard input to a directory; print error instead. - - * analyze.c (diff_2_files), context.c (print_context_header, - print_context_script), diff.c (main), diff.h (enum - output_style): Tread unidiff as an output style in its own - right. This also generates an error when both -u and -c are - given. - - * diff.c (main): Better error messages when regexps are bad. - - * diff.c (compare_files): Don't assume stdin is opened. - - * diff3.c (read_diff): Don't assume things about the order of - descriptor assignment and closes. - - * util.c (setup_output): Don't assume things about the order - of descriptor assignment and closes. - - * diff.c (compare_files): Set a flag so that closes don't - happen more than once. - - * diff.c (main): Don't just flush stdout, do a close. That - way on broken systems we can still get errors. - -Mon Dec 24 16:24:17 1990 Richard Stallman (rms at mole.ai.mit.edu) - - * diff.c (usage): Use = for args of long options. - -Mon Dec 17 18:19:20 1990 Michael I Bushnell (mib at geech.ai.mit.edu) - - * context.c (print_context_label): Labels were interchanged badly. - - * context.c (pr_unidiff_hunk): Changes to deal with files - ending in incomplete lines. - * util.c (print_1_line): Other half of the changes. - -Mon Dec 3 14:23:55 1990 Richard Stallman (rms at mole.ai.mit.edu) - - * diff.c (longopts, usage): unidiff => unified. - -Wed Nov 7 17:13:08 1990 Richard Stallman (rms at mole.ai.mit.edu) - - * analyze.c (diff_2_files): No warnings about newlines for -D. - - * diff.c (pr_unidiff_hunk): Remove ref to output_patch_flag. - -Tue Oct 23 23:19:18 1990 Richard Stallman (rms at mole.ai.mit.edu) - - * diff.c (compare_files): For -D, compare even args are same file. - * analyze.c (diff_2_files): Likewise. - Also, output even if files have no differences. - - * analyze.c (diff_2_files): Print missing newline messages last. - Return 2 if a newline is missing. - Print them even if files end with identical text. - -Mon Oct 22 19:40:09 1990 Richard Stallman (rms at mole.ai.mit.edu) - - * diff.c (usage): Return 2. - -Wed Oct 10 20:54:04 1990 Richard Stallman (rms at mole.ai.mit.edu) - - * diff.c (longopts): Add +new-files. - -Sun Sep 23 22:49:29 1990 Richard Stallman (rms at mole.ai.mit.edu) - - * context.c (print_context_script): Handle unidiff_flag. - (print_context_header): Likewise. - (print_unidiff_number_range, pr_unidiff_hunk): New functions. - * diff.c (longopts): Add element for +unidiff. - (main): Handle +unidiff and -u. - (usage): Mention them. - -Wed Sep 5 16:33:22 1990 Richard Stallman (rms at mole.ai.mit.edu) - - * io.c (find_and_hash_each_line): Deal with missing final newline - after buffering necessary context lines. - -Sat Sep 1 16:32:32 1990 Richard Stallman (rms at mole.ai.mit.edu) - - * io.c (find_identical_ends): ROBUST_OUTPUT_FORMAT test was backward. - -Thu Aug 23 17:17:20 1990 Richard Stallman (rms at mole.ai.mit.edu) - - * diff3.c (WIFEXITED): Undef it if WEXITSTATUS is not defined. - * context.c (find_function): Don't try to return values. - -Wed Aug 22 11:54:39 1990 Richard Stallman (rms at mole.ai.mit.edu) - - * diff.h (O_RDONLY): Define if not defined. - -Tue Aug 21 13:49:26 1990 Richard Stallman (rms at mole.ai.mit.edu) - - * Handle -L option. - * context.c (print_context_label): New function. - (print_context_header): Use that. - * diff.c (main): Recognize the option. - (usage): Updated. - * diff.h (file_label): New variable. - * diff3.c (main): Recognize -L instead of -t. - - * diff3.c (main): Support -m without other option. - - * diff3.c (WEXITSTATUS, WIFEXITED): Define whenever not defined. - - * diff3.c (bcopy, index, rindex): Delete definitions; not used. - (D_LINENUM, D_LINELEN): Likewise. - (struct diff_block): lengths includes newlines. - (struct diff3_block): Likewise. - (always_text, merge): New variables. - (read_diff): Return address of end, not size read. Calls changed. - Pass -a to diff if given to diff3. - current_chunk_size now an int. Detect error in `pipe'. - Check for incomplete line of output here. - (scan_diff_line): Don't make scan_ptr + 2 before knowing it is valid. - No need to check validity of diff output here. - Include newline in length of line. - (main): Compute rev_mapping here. Handle -a and -m. - Error message if excess -t operands. Error for incompatible options. - Error if `-' given more than once. - Fix error storing in tag_strings. - (output_diff3): REV_MAPPING is now an arg. Call changed. - Change syntax of "missing newline" message. - Expect length of line to include newline. - (output_diff3_edscript): Return just 0 or 1. - REV_MAPPING is now an arg. Call changed. - (output_diff3_merge): New function. - (process_diff): Better error message for bad diff format. - (fatal, perror_with_exit): Return status 2. - - * analyze.c (diff_2_files): Report missing newline in either - or both files, if not robust output style. - - * util.c (setup_output): Detect error from pipe. - No need to close stdin. - - * util.c (print_1_line): Change format of missing-newline msg. - Change if statements to switch. - - * io.c (slurp): Don't mention differences in final newline if -B. - - * io.c (binary_file_p): Use ISO char set as criterion, not ASCII. - - * io.c (find_identical_ends): Increase value of BEG0 by 1. - Other changes in backwards scan to avoid decrementing pointers - before start of array, and set LINES properly. - - * diff.h (ROBUST_OUTPUT_STYLE): New macro. - * io.c (find_identical_ends, find_and_hash_each_line): Use that macro. - - * diff.h (dup2): Don't define if XENIX. - - * diff.c (main): Check for write error at end. - - * context.c (find_function): Don't return a value. - Use argument FILE rather than global files. - - * analyze.c: Add external function declarations. - * analyze.c (build_script): Turn off explicit check for final newline. - - * analyze.c (discard_confusing_lines): Make integers unsigned. - -Tue Jul 31 21:37:16 1990 Richard Stallman (rms at sugar-bombs.ai.mit.edu) - - * io.c (find_and_hash_each_line): Correct the criterion - for leaving out the newline from the end of the line. - -Tue May 29 21:28:16 1990 Richard Stallman (rms at sugar-bombs.ai.mit.edu) - - * dir.c (diff_dirs): Free things only if nonzero. - -Mon Apr 16 18:31:05 1990 Richard Stallman (rms at sugar-bombs.ai.mit.edu) - - * diff.h (NDIR_IN_SYS): New macro controls location of ndir.h. - - * diff3.c (xmalloc, xrealloc): Don't die if size == 0 returns 0. - -Sun Mar 25 15:58:42 1990 Richard Stallman (rms at sugar-bombs.ai.mit.edu) - - * analyze.c (discard_confusing_lines): - `many' wasn't being used; use it. - Cancelling provisionals near start of run must handle already - cancelled provisionals. - Cancelling subruns of provisionals was cancelling last nonprovisional. - -Sat Mar 24 14:02:51 1990 Richard Stallman (rms at sugar-bombs.ai.mit.edu) - - * analyze.c (discard_confusing_lines): - Threshold for line occurring many times scales by square root - of total lines. - Within each run, cancel any long subrun of provisionals. - Don't update `provisional' while cancelling provisionals. - In big outer loop, handle provisional and nonprovisional separately. - -Thu Mar 22 16:35:33 1990 Richard Stallman (rms at sugar-bombs.ai.mit.edu) - - * analyze.c (discard_confusing_lines): - The first loops to discard provisionals from ends failed to step. - In second such loops, keep discarding all consecutive provisionals. - Increase threshold for stopping discarding, and also check for - consecutive nondiscardables as separate threshold. - -Fri Mar 16 00:33:08 1990 Richard Stallman (rms at sugar-bombs.ai.mit.edu) - - * diff3.c (read_diff): Pass -- as first arg to diff. - - * diff3.c: Include wait.h or define equivalent macros. - (read_diff): Don't use stdio printing error in the inferior. - Remember the pid and wait for it. Report failing status. - Report failure of vfork. - -Sun Mar 11 17:10:32 1990 Richard Stallman (rms at sugar-bombs.ai.mit.edu) - - * diff3.c (main): Accept -t options and pass to output_diff3_edscript. - (usage): Mention -t. - (read_diff): Use vfork. - (vfork): Don't use it on Sparc. - - * diff.h (vfork): Don't use it on Sparc. - -Tue Mar 6 22:37:20 1990 Richard Stallman (rms at sugar-bombs.ai.mit.edu) - - * diff3.c (dup2): Don't define on Xenix. - - * Makefile: Comments for Xenix. - -Thu Mar 1 17:19:23 1990 Richard Stallman (rms at sugar-bombs.ai.mit.edu) - - * analyze.c (diff_2_files): `message' requires three args. - -Fri Feb 23 10:56:50 1990 David J. MacKenzie (djm at albert.ai.mit.edu) - - * diff.h, util.c, diff3.c: Change 'void *' to 'VOID *', with - VOID defined as void if __STDC__, char if not. - -Sun Feb 18 20:31:58 1990 David J. MacKenzie (djm at albert.ai.mit.edu) - - * Makefile: Add rules for getopt.c, getopt1.c, getopt.h. - - * getopt.c, getopt.h, getopt1.c: New files. - - * main.c (main, usage): Add long options. - - * analyze.c (shift_boundaries): Remove unused var 'j_end'. - -Thu Feb 8 02:43:16 1990 Jim Kingdon (kingdon at pogo.ai.mit.edu) - - * GNUmakefile: include ../Makerules before Makefile. - -Fri Feb 2 23:21:38 1990 Richard Stallman (rms at sugar-bombs.ai.mit.edu) - - * analyze.c (diif_2_files): If -B or -I, don't return 1 - if all changes were ignored. - -Wed Jan 24 20:43:57 1990 Richard Stallman (rms at albert.ai.mit.edu) - - * diff3.c (fatal): Output to stderr. - -Thu Jan 11 00:25:56 1990 David J. MacKenzie (djm at hobbes.ai.mit.edu) - - * diff.c (usage): Mention -v. - -Wed Jan 10 16:06:38 1990 Richard Stallman (rms at sugar-bombs.ai.mit.edu) - - * diff3.c (output_diff3_edscript): Return number of overlaps. - (main): If have overlaps, exit with status 1. - -Sun Dec 24 10:29:20 1989 Richard Stallman (rms at sugar-bombs.ai.mit.edu) - - * io.c (find_equiv_class): Fix typo that came from changing init of B - to an assigment. - - * version.c: New file. - * diff.c (main): -v prints version number. - - * io.c (binary_file_p): Null char implies binary file. - -Fri Nov 17 23:44:55 1989 Richard Stallman (rms at sugar-bombs.ai.mit.edu) - - * util.c (print_1_line): Fix off by 1 error. - -Thu Nov 16 13:51:10 1989 Richard Stallman (rms at sugar-bombs.ai.mit.edu) - - * util.c (xcalloc): Function deleted. - - * io.c (slurp): Null-terminate the buffer. - - * io.c (read_files): Delete unused vars. - - * io.c (find_equiv_class): Don't index by N if too low. - - * dir.c (dir_sort): Delete the extra declaration of compare_names. - - * diff.h: Don't declare xcalloc. Declare some other functions. - - * analyze.c (shift_boundaries): - Test for END at end of range before indexing by it. - Fix typo `preceeding' in var names. - -Sat Nov 11 14:04:16 1989 Richard Stallman (rms at sugar-bombs.ai.mit.edu) - - * diff3.c (using_to_diff3_block): Delete unused vars. - (make_3way_diff, process_diff_control, read_diff, output_diff3): Likewise. - -Mon Nov 6 18:15:50 EST 1989 Jay Fenlason (hack@ai.mit.edu) - - * README Fix typo. - -Fri Nov 3 15:27:47 1989 Richard Stallman (rms at sugar-bombs.ai.mit.edu) - - * diff.c (usage): Mention -D. - - * ifdef.c (print_ifdef_hunk): Write comments on #else and #endif. - -Sun Oct 29 16:41:07 1989 Richard Stallman (rms at sugar-bombs.ai.mit.edu) - - * diff.c (compare_files): Don't fflush for identical files. - -Wed Oct 25 17:57:12 1989 Randy Smith (randy at apple-gunkies.ai.mit.edu) - - * diff3.c (using_to_diff3_block): When defaulting lines from - FILE0, only copy up to just under the *lowest* line mentioned - in the next diff. - - * diff3.c (fatal): Add \n to error messages. - -Wed Oct 25 15:05:49 1989 Richard Stallman (rms at sugar-bombs.ai.mit.edu) - - * Makefile (tapefiles): Add ChangeLog. - -Tue Oct 3 00:51:17 1989 Richard Stallman (rms at sugar-bombs.ai.mit.edu) - - * diff3.c (process_diff, create_diff3_block): Init ->next field. - -Fri Sep 29 08:16:45 1989 Richard Stallman (rms at sugar-bombs.ai.mit.edu) - - * util.c (line_cmp): Alter end char of line 2, not line 1. - -Wed Sep 20 00:12:37 1989 Richard Stallman (rms at sugar-bombs.ai.mit.edu) - - * Makefile (diff.tar): Expect ln to fail on some files; - copy them with cp. - -Mon Sep 18 02:54:29 1989 Richard Stallman (rms at sugar-bombs.ai.mit.edu) - - * Handle -D option: - * io.c (find_and_hash_each_line): Keep all lines of 1st file. - * diff.c (main): Handle -D option. - (compare_files): Reject -D if files spec'd are directories. - * analyze.c (diff_2_files): Handle OUTPUT_IFDEF case. - -Fri Sep 1 20:15:50 1989 Richard Stallman (rms at sugar-bombs.ai.mit.edu) - - * diff.c (option_list): Rename arg VECTOR as OPTIONVEC. - -Mon Aug 28 17:58:27 1989 Richard Stallman (rms at sugar-bombs.ai.mit.edu) - - * diff.c (compare_files): Clear entire inf[i].stat. - -Wed Aug 23 17:48:47 1989 Richard Stallman (rms at apple-gunkies.ai.mit.edu) - - * io.c (find_identical_ends): Sign was backward - determining where to bound the scan for the suffix. - -Wed Aug 16 12:49:16 1989 Richard Stallman (rms at hobbes.ai.mit.edu) - - * analyze.c (diff_2_files): If -q, treat all files as binary. - * diff.c (main): Detect -q, record in no_details_flag. - -Sun Jul 30 23:12:00 1989 Richard Stallman (rms at sugar-bombs.ai.mit.edu) - - * diff.c (usage): New function. - (main): Call it. - -Wed Jul 26 02:02:19 1989 Richard Stallman (rms at sugar-bombs.ai.mit.edu) - - * diff.c (main): Make -C imply -c. - -Thu Jul 20 17:57:51 1989 Chris Hanson (cph at kleph) - - * io.c (find_and_hash_each_line): Bug fix in context handling, - introduced by last change. - -Fri Jul 14 17:39:20 1989 Chris Hanson (cph at kleph) - - * analyze.c: To make RCS work correctly on files that don't - necessarily end in newline, introduce some changes that cause - diffs to be sensitive to missing final newline. Because - non-RCS modes don't want to be affected by these changes, they - are conditional on `output_style == OUTPUT_RCS'. - (diff_2_files) [OUTPUT_RCS]: Suppress the "File X missing - newline" message. - (build_script) [OUTPUT_RCS]: Cause the last line to compare as - different if exactly one of the files is missing its final - newline. - - * io.c (find_and_hash_each_line): Bug fix in - ignore_space_change mode. Change line's length to include the - newline. For OUTPUT_RCS, decrement last line's length if - there is no final newline. - (find_identical_ends) [OUTPUT_RCS]: If one of the files is - missing a final newline, make sure it's not included in either - the prefix or suffix. - - * util.c (print_1_line): Change line output routine to account - for line length including the newline. - -Tue Jun 27 02:35:28 1989 Roland McGrath (roland at hobbes.ai.mit.edu) - - * Makefile: Inserted $(archpfx) where appropriate. - -Wed May 17 20:18:43 1989 Richard Stallman (rms at sugar-bombs.ai.mit.edu) - - * diff3.c [USG]: Include fcntl.h. - - * diff.h [USG]: New compilation flags HAVE_NDIR, HAVE_DIRECT. - -Wed Apr 26 15:35:57 1989 Richard Stallman (rms at sugar-bombs.ai.mit.edu) - - * dir.c (diff_dirs): Two new args, NONEX1 and NONEX2, say to pretend - nonex dirs are empty. - (dir_sort): New arg NONEX, likewise. - * diff.c (compare_files): Pass those args. - Sometimes call diff_dirs if subdir exists in just one place. - -Wed Apr 12 01:10:27 1989 Richard Stallman (rms at sugar-bombs.ai.mit.edu) - - * io.c (find_identical_ends): Set END0 *after* last char - during backward scan for suffix. - -Sat Apr 8 15:49:49 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu) - - * diff3.c (using_to_diff3_block): Now find high marks in files 1 - and 2 through mapping off of the last difference instead of the - first. - - * diff3.c: Many trivial changes to spelling inside comments. - -Fri Feb 24 12:38:03 1989 Randall Smith (randy at gluteus.ai.mit.edu) - - * util.c, normal.c, io.c, ed.c, dir.c, diff.h, diff.c, context.c, - analyze.c, Makefile: Changed copyright header to conform with new - GNU General Public license. - * diff3.c: Changed copyright header to conform with new GNU - General Public license. - * COPYING: Made a hard link to /gp/rms/COPYING. - -Fri Feb 24 10:01:58 1989 Richard Stallman (rms at sugar-bombs.ai.mit.edu) - - * io.c (slurp): Leave 2 chars space at end of buffer, not one. - (find_identical_ends): Special case if either file is empty; - don't try to make a sentinel since could crash. - -Wed Feb 15 14:24:48 1989 Jay Fenlason (hack at apple-gunkies.ai.mit.edu) - - * diff3.c (message) Re-wrote routine to avoid using alloca() - -Wed Feb 15 06:19:14 1989 Richard Stallman (rms at sugar-bombs.ai.mit.edu) - - * io.c (find_identical_ends): Delete the variable `bytes'. - -Sun Feb 12 11:50:36 1989 Richard Stallman (rms at sugar-bombs.ai.mit.edu) - - * io.c (slurp): ->bufsize is nominal amount we have room for; - add room for sentinel when calling xmalloc or xrealloc. - - * io.c (find_identical_ends): Do need overrun check in finding suffix. - -Fri Feb 10 01:28:15 1989 Richard Stallman (rms at sugar-bombs.ai.mit.edu) - - * diff.c (main): -C now takes arg to specify context length. - Now -p to show C function name--Damned IEEE! - Fatal error if context length spec'd twice. - - * ed.c (print_ed_hunk): Now special treatment only for lines containing - precisely a dot and nothing else. Output `..', end the insert, - substitute that one line, then resume the insert if nec. - - * io.c (find_and_hash_lines): When backing up over starting context, - don't move past buffer-beg. - - * io.c (find_identical_ends): Use sentinels to make the loops faster. - If files are identical, skip the 2nd loop and return quickly. - (slurp): Leave 1 char extra space after each buffer. - - * analyze.c (diff_2_files): Mention difference in final newlines. - -Wed Jan 25 22:44:44 1989 Richard Stallman (rms at sugar-bombs.ai.mit.edu) - - * dir.c (diff_dirs): Use * when calling fcn ptr variable. - -Sat Dec 17 14:12:06 1988 Richard Stallman (rms at sugar-bombs.ai.mit.edu) - - * Makefile: New vars INSTALL and LIBS used in some rules; - provide default defns plus commented-put defns for sysV. - -Thu Nov 17 16:42:53 1988 Richard Stallman (rms at sugar-bombs.ai.mit.edu) - - * dir.c (dir_sort): Open-trouble not fatal; just say # files is -1. - (diff_dirs): If dir_sort does that, give up and return 2. - - * diff.c (compare_files): Don't open directories. - Don't close them specially either. - Cross-propagate inf[i].dir_p sooner. - -Sun Nov 13 11:19:36 1988 Richard Stallman (rms at sugar-bombs.ai.mit.edu) - - * diff.h: Declare index, rindex. - - * diff.c (compare_files): If comparing foodir with b/f, - use foodir/f, not foodir/b/f. - - * diff.c (compare_files): Don't print "are identical" msg for 2 dirs. - Status now 1 if one file is a dir and the other isn't, etc. - -Thu Nov 3 16:30:24 1988 Randall Smith (randy at gluteus.ai.mit.edu) - - * Makefile: Added a define for diff3 to define DIFF_PROGRAM. - - * util.c: Added hack to make sure that perror was not called with - a null pointer. - - * diff.c: Changed S_IFDIR to S_IFMT in masking type of file bits - out. - - * diff3.c: Included USG compatibility defines. - - * diff.h: Moved sys/file.h into #else USG section (not needed or - wanted on System V). - - * ed.c, analyze.c, context.c: Shortened names to 12 characters for - the sake of System V (too simple not to do). - -Local Variables: -mode: indented-text -left-margin: 8 -version-control: never -End: diff --git a/gnu/dist/diffutils/NEWS b/gnu/dist/diffutils/NEWS deleted file mode 100644 index dcde1227d30..00000000000 --- a/gnu/dist/diffutils/NEWS +++ /dev/null @@ -1,126 +0,0 @@ -User-visible changes in version 2.7: - -* New diff option: --binary (useful only on non-Posix hosts) -* diff -b and -w now ignore line incompleteness; -B no longer does this. -* cmp -c now uses locale to decide which output characters to quote. -* Help and version messages are reorganized. - - -User-visible changes in version 2.6: - -* New cmp, diff, diff3, sdiff option: --help -* A new heuristic for diff greatly reduces the time needed to compare - large input files that contain many differences. -* Partly as a result, GNU diff's output is not exactly the same as before. - Usually it is a bit smaller, but sometimes it is a bit larger. - - -User-visible changes in version 2.5: - -* New cmp option: -v --version - - -User-visible changes in version 2.4: - -* New cmp option: --ignore-initial=BYTES -* New diff3 option: -T --initial-tab -* New diff option: --line-format=FORMAT -* New diff group format specifications: - <PRINTF_SPEC>[eflmnEFLMN] - A printf spec followed by one of the following letters - causes the integer corresponding to that letter to be - printed according to the printf specification. - E.g. `%5df' prints the number of the first line in the - group in the old file using the "%5d" format. - e: line number just before the group in old file; equals f - 1 - f: first line number in group in the old file - l: last line number in group in the old file - m: line number just after the group in old file; equals l + 1 - n: number of lines in group in the old file; equals l - f + 1 - E, F, L, M, N: likewise, for lines in the new file - %(A=B?T:E) - If A equals B then T else E. A and B are each either a decimal - constant or a single letter interpreted as above. T and E are - arbitrary format strings. This format spec is equivalent to T if - A's value equals B's; otherwise it is equivalent to E. For - example, `%(N=0?no:%dN) line%(N=1?:s)' is equivalent to `no lines' - if N (the number of lines in the group in the the new file) is 0, - to `1 line' if N is 1, and to `%dN lines' otherwise. - %c'C' - where C is a single character, stands for the character C. C may not - be a backslash or an apostrophe. E.g. %c':' stands for a colon. - %c'\O' - where O is a string of 1, 2, or 3 octal digits, stands for the - character with octal code O. E.g. %c'\0' stands for a null character. -* New diff line format specifications: - <PRINTF_SPEC>n - The line number, printed with <PRINTF_SPEC>. - E.g. `%5dn' prints the line number with a "%5d" format. - %c'C' - %c'\O' - The character C, or with octal code O, as above. -* Supported <PRINTF_SPEC>s have the same meaning as with printf, but must - match the extended regular expression %-*[0-9]*(\.[0-9]*)?[doxX]. -* The format spec %0 introduced in version 2.1 has been removed, since it - is incompatible with printf specs like %02d. To represent a null char, - use %c'\0' instead. -* cmp and diff now conform to Posix.2 (ISO/IEC 9945-2:1993) - if the underlying system conforms to Posix: - - Some messages' wordings are changed in minor ways. - - ``White space'' is now whatever C's `isspace' says it is. - - When comparing directories, if `diff' finds a file that is not a regular - file or a directory, it reports the file's type instead of diffing it. - (As usual, it follows symbolic links first.) - - When signaled, sdiff exits with the signal's status, not with status 2. -* Now portable to hosts where int, long, pointer, etc. are not all the same - size. -* `cmp - -' now works like `diff - -'. - - -User-visible changes in version 2.3: - -* New diff option: --horizon-lines=lines - - -User-visible changes in version 2.1: - -* New diff options: - --{old,new,unchanged}-line-format='format' - --{old,new,unchanged,changed}-group-format='format' - -U -* New diff3 option: - -A --show-all -* diff3 -m now defaults to -A, not -E. -* diff3 now takes up to three -L or --label options, not just two. - If just two options are given, they refer to the first two input files, - not the first and third input files. -* sdiff and diff -y handle incomplete lines. - - -User-visible changes in version 2.0: - -* Add sdiff and cmp programs. -* Add Texinfo documentation. -* Add configure script. -* Improve diff performance. -* New diff options: --x --exclude --X --exclude-from --P --unidirectional-new-file --W --width --y --side-by-side ---left-column ---sdiff-merge-assist ---suppress-common-lines -* diff options renamed: ---label renamed from --file-label ---forward-ed renamed from --reversed-ed ---paginate renamed from --print ---entire-new-file renamed from --entire-new-files ---new-file renamed from --new-files ---all-text removed -* New diff3 options: --v --version -* Add long-named equivalents for other diff3 options. -* diff options -F (--show-function-line) and -I (--ignore-matching-lines) - can now be given more than once. diff --git a/gnu/dist/diffutils/README b/gnu/dist/diffutils/README deleted file mode 100644 index bfb99656a1b..00000000000 --- a/gnu/dist/diffutils/README +++ /dev/null @@ -1,9 +0,0 @@ -This directory contains the GNU diff, diff3, sdiff, and cmp utilities. -Their features are a superset of the Unix features and they are -significantly faster. cmp has been moved here from the GNU textutils. - -See the file COPYING for copying conditions. -See the file diff.texi (or diff.info*) for documentation. -See the file INSTALL for compilation and installation instructions. - -Report bugs to bug-gnu-utils@prep.ai.mit.edu diff --git a/gnu/dist/diffutils/alloca.c b/gnu/dist/diffutils/alloca.c deleted file mode 100644 index 7020f32c882..00000000000 --- a/gnu/dist/diffutils/alloca.c +++ /dev/null @@ -1,492 +0,0 @@ -/* alloca.c -- allocate automatically reclaimed memory - (Mostly) portable public-domain implementation -- D A Gwyn - - This implementation of the PWB library alloca function, - which is used to allocate space off the run-time stack so - that it is automatically reclaimed upon procedure exit, - was inspired by discussions with J. Q. Johnson of Cornell. - J.Otto Tennant <jot@cray.com> contributed the Cray support. - - There are some preprocessor constants that can - be defined when compiling for your specific system, for - improved efficiency; however, the defaults should be okay. - - The general concept of this implementation is to keep - track of all alloca-allocated blocks, and reclaim any - that are found to be deeper in the stack than the current - invocation. This heuristic does not reclaim storage as - soon as it becomes invalid, but it will do so eventually. - - As a special case, alloca(0) reclaims storage without - allocating any. It is a good idea to use alloca(0) in - your main control loop, etc. to force garbage collection. */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#ifdef emacs -#include "blockinput.h" -#endif - -/* If compiling with GCC 2, this file's not needed. */ -#if !defined (__GNUC__) || __GNUC__ < 2 - -/* If someone has defined alloca as a macro, - there must be some other way alloca is supposed to work. */ -#ifndef alloca - -#ifdef emacs -#ifdef static -/* actually, only want this if static is defined as "" - -- this is for usg, in which emacs must undefine static - in order to make unexec workable - */ -#ifndef STACK_DIRECTION -you -lose --- must know STACK_DIRECTION at compile-time -#endif /* STACK_DIRECTION undefined */ -#endif /* static */ -#endif /* emacs */ - -/* If your stack is a linked list of frames, you have to - provide an "address metric" ADDRESS_FUNCTION macro. */ - -#if defined (CRAY) && defined (CRAY_STACKSEG_END) -long i00afunc (); -#define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg)) -#else -#define ADDRESS_FUNCTION(arg) &(arg) -#endif - -#if __STDC__ -typedef void *pointer; -#else -typedef char *pointer; -#endif - -#define NULL 0 - -/* Different portions of Emacs need to call different versions of - malloc. The Emacs executable needs alloca to call xmalloc, because - ordinary malloc isn't protected from input signals. On the other - hand, the utilities in lib-src need alloca to call malloc; some of - them are very simple, and don't have an xmalloc routine. - - Non-Emacs programs expect this to call use xmalloc. - - Callers below should use malloc. */ - -#ifndef emacs -#define malloc xmalloc -#endif -extern pointer malloc (); - -/* Define STACK_DIRECTION if you know the direction of stack - growth for your system; otherwise it will be automatically - deduced at run-time. - - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown */ - -#ifndef STACK_DIRECTION -#define STACK_DIRECTION 0 /* Direction unknown. */ -#endif - -#if STACK_DIRECTION != 0 - -#define STACK_DIR STACK_DIRECTION /* Known at compile-time. */ - -#else /* STACK_DIRECTION == 0; need run-time code. */ - -static int stack_dir; /* 1 or -1 once known. */ -#define STACK_DIR stack_dir - -static void -find_stack_direction () -{ - static char *addr = NULL; /* Address of first `dummy', once known. */ - auto char dummy; /* To get stack address. */ - - if (addr == NULL) - { /* Initial entry. */ - addr = ADDRESS_FUNCTION (dummy); - - find_stack_direction (); /* Recurse once. */ - } - else - { - /* Second entry. */ - if (ADDRESS_FUNCTION (dummy) > addr) - stack_dir = 1; /* Stack grew upward. */ - else - stack_dir = -1; /* Stack grew downward. */ - } -} - -#endif /* STACK_DIRECTION == 0 */ - -/* An "alloca header" is used to: - (a) chain together all alloca'ed blocks; - (b) keep track of stack depth. - - It is very important that sizeof(header) agree with malloc - alignment chunk size. The following default should work okay. */ - -#ifndef ALIGN_SIZE -#define ALIGN_SIZE sizeof(double) -#endif - -typedef union hdr -{ - char align[ALIGN_SIZE]; /* To force sizeof(header). */ - struct - { - union hdr *next; /* For chaining headers. */ - char *deep; /* For stack depth measure. */ - } h; -} header; - -static header *last_alloca_header = NULL; /* -> last alloca header. */ - -/* Return a pointer to at least SIZE bytes of storage, - which will be automatically reclaimed upon exit from - the procedure that called alloca. Originally, this space - was supposed to be taken from the current stack frame of the - caller, but that method cannot be made to work for some - implementations of C, for example under Gould's UTX/32. */ - -pointer -alloca (size) - unsigned size; -{ - auto char probe; /* Probes stack depth: */ - register char *depth = ADDRESS_FUNCTION (probe); - -#if STACK_DIRECTION == 0 - if (STACK_DIR == 0) /* Unknown growth direction. */ - find_stack_direction (); -#endif - - /* Reclaim garbage, defined as all alloca'd storage that - was allocated from deeper in the stack than currently. */ - - { - register header *hp; /* Traverses linked list. */ - -#ifdef emacs - BLOCK_INPUT; -#endif - - for (hp = last_alloca_header; hp != NULL;) - if ((STACK_DIR > 0 && hp->h.deep > depth) - || (STACK_DIR < 0 && hp->h.deep < depth)) - { - register header *np = hp->h.next; - - free ((pointer) hp); /* Collect garbage. */ - - hp = np; /* -> next header. */ - } - else - break; /* Rest are not deeper. */ - - last_alloca_header = hp; /* -> last valid storage. */ - -#ifdef emacs - UNBLOCK_INPUT; -#endif - } - - if (size == 0) - return NULL; /* No allocation required. */ - - /* Allocate combined header + user data storage. */ - - { - register pointer new = malloc (sizeof (header) + size); - /* Address of header. */ - - ((header *) new)->h.next = last_alloca_header; - ((header *) new)->h.deep = depth; - - last_alloca_header = (header *) new; - - /* User storage begins just after header. */ - - return (pointer) ((char *) new + sizeof (header)); - } -} - -#if defined (CRAY) && defined (CRAY_STACKSEG_END) - -#ifdef DEBUG_I00AFUNC -#include <stdio.h> -#endif - -#ifndef CRAY_STACK -#define CRAY_STACK -#ifndef CRAY2 -/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */ -struct stack_control_header - { - long shgrow:32; /* Number of times stack has grown. */ - long shaseg:32; /* Size of increments to stack. */ - long shhwm:32; /* High water mark of stack. */ - long shsize:32; /* Current size of stack (all segments). */ - }; - -/* The stack segment linkage control information occurs at - the high-address end of a stack segment. (The stack - grows from low addresses to high addresses.) The initial - part of the stack segment linkage control information is - 0200 (octal) words. This provides for register storage - for the routine which overflows the stack. */ - -struct stack_segment_linkage - { - long ss[0200]; /* 0200 overflow words. */ - long sssize:32; /* Number of words in this segment. */ - long ssbase:32; /* Offset to stack base. */ - long:32; - long sspseg:32; /* Offset to linkage control of previous - segment of stack. */ - long:32; - long sstcpt:32; /* Pointer to task common address block. */ - long sscsnm; /* Private control structure number for - microtasking. */ - long ssusr1; /* Reserved for user. */ - long ssusr2; /* Reserved for user. */ - long sstpid; /* Process ID for pid based multi-tasking. */ - long ssgvup; /* Pointer to multitasking thread giveup. */ - long sscray[7]; /* Reserved for Cray Research. */ - long ssa0; - long ssa1; - long ssa2; - long ssa3; - long ssa4; - long ssa5; - long ssa6; - long ssa7; - long sss0; - long sss1; - long sss2; - long sss3; - long sss4; - long sss5; - long sss6; - long sss7; - }; - -#else /* CRAY2 */ -/* The following structure defines the vector of words - returned by the STKSTAT library routine. */ -struct stk_stat - { - long now; /* Current total stack size. */ - long maxc; /* Amount of contiguous space which would - be required to satisfy the maximum - stack demand to date. */ - long high_water; /* Stack high-water mark. */ - long overflows; /* Number of stack overflow ($STKOFEN) calls. */ - long hits; /* Number of internal buffer hits. */ - long extends; /* Number of block extensions. */ - long stko_mallocs; /* Block allocations by $STKOFEN. */ - long underflows; /* Number of stack underflow calls ($STKRETN). */ - long stko_free; /* Number of deallocations by $STKRETN. */ - long stkm_free; /* Number of deallocations by $STKMRET. */ - long segments; /* Current number of stack segments. */ - long maxs; /* Maximum number of stack segments so far. */ - long pad_size; /* Stack pad size. */ - long current_address; /* Current stack segment address. */ - long current_size; /* Current stack segment size. This - number is actually corrupted by STKSTAT to - include the fifteen word trailer area. */ - long initial_address; /* Address of initial segment. */ - long initial_size; /* Size of initial segment. */ - }; - -/* The following structure describes the data structure which trails - any stack segment. I think that the description in 'asdef' is - out of date. I only describe the parts that I am sure about. */ - -struct stk_trailer - { - long this_address; /* Address of this block. */ - long this_size; /* Size of this block (does not include - this trailer). */ - long unknown2; - long unknown3; - long link; /* Address of trailer block of previous - segment. */ - long unknown5; - long unknown6; - long unknown7; - long unknown8; - long unknown9; - long unknown10; - long unknown11; - long unknown12; - long unknown13; - long unknown14; - }; - -#endif /* CRAY2 */ -#endif /* not CRAY_STACK */ - -#ifdef CRAY2 -/* Determine a "stack measure" for an arbitrary ADDRESS. - I doubt that "lint" will like this much. */ - -static long -i00afunc (long *address) -{ - struct stk_stat status; - struct stk_trailer *trailer; - long *block, size; - long result = 0; - - /* We want to iterate through all of the segments. The first - step is to get the stack status structure. We could do this - more quickly and more directly, perhaps, by referencing the - $LM00 common block, but I know that this works. */ - - STKSTAT (&status); - - /* Set up the iteration. */ - - trailer = (struct stk_trailer *) (status.current_address - + status.current_size - - 15); - - /* There must be at least one stack segment. Therefore it is - a fatal error if "trailer" is null. */ - - if (trailer == 0) - abort (); - - /* Discard segments that do not contain our argument address. */ - - while (trailer != 0) - { - block = (long *) trailer->this_address; - size = trailer->this_size; - if (block == 0 || size == 0) - abort (); - trailer = (struct stk_trailer *) trailer->link; - if ((block <= address) && (address < (block + size))) - break; - } - - /* Set the result to the offset in this segment and add the sizes - of all predecessor segments. */ - - result = address - block; - - if (trailer == 0) - { - return result; - } - - do - { - if (trailer->this_size <= 0) - abort (); - result += trailer->this_size; - trailer = (struct stk_trailer *) trailer->link; - } - while (trailer != 0); - - /* We are done. Note that if you present a bogus address (one - not in any segment), you will get a different number back, formed - from subtracting the address of the first block. This is probably - not what you want. */ - - return (result); -} - -#else /* not CRAY2 */ -/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP. - Determine the number of the cell within the stack, - given the address of the cell. The purpose of this - routine is to linearize, in some sense, stack addresses - for alloca. */ - -static long -i00afunc (long address) -{ - long stkl = 0; - - long size, pseg, this_segment, stack; - long result = 0; - - struct stack_segment_linkage *ssptr; - - /* Register B67 contains the address of the end of the - current stack segment. If you (as a subprogram) store - your registers on the stack and find that you are past - the contents of B67, you have overflowed the segment. - - B67 also points to the stack segment linkage control - area, which is what we are really interested in. */ - - stkl = CRAY_STACKSEG_END (); - ssptr = (struct stack_segment_linkage *) stkl; - - /* If one subtracts 'size' from the end of the segment, - one has the address of the first word of the segment. - - If this is not the first segment, 'pseg' will be - nonzero. */ - - pseg = ssptr->sspseg; - size = ssptr->sssize; - - this_segment = stkl - size; - - /* It is possible that calling this routine itself caused - a stack overflow. Discard stack segments which do not - contain the target address. */ - - while (!(this_segment <= address && address <= stkl)) - { -#ifdef DEBUG_I00AFUNC - fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl); -#endif - if (pseg == 0) - break; - stkl = stkl - pseg; - ssptr = (struct stack_segment_linkage *) stkl; - size = ssptr->sssize; - pseg = ssptr->sspseg; - this_segment = stkl - size; - } - - result = address - this_segment; - - /* If you subtract pseg from the current end of the stack, - you get the address of the previous stack segment's end. - This seems a little convoluted to me, but I'll bet you save - a cycle somewhere. */ - - while (pseg != 0) - { -#ifdef DEBUG_I00AFUNC - fprintf (stderr, "%011o %011o\n", pseg, size); -#endif - stkl = stkl - pseg; - ssptr = (struct stack_segment_linkage *) stkl; - size = ssptr->sssize; - pseg = ssptr->sspseg; - result += size; - } - return (result); -} - -#endif /* not CRAY2 */ -#endif /* CRAY */ - -#endif /* no alloca */ -#endif /* not GCC version 2 */ diff --git a/gnu/dist/diffutils/cmp.c b/gnu/dist/diffutils/cmp.c deleted file mode 100644 index 9840570e94a..00000000000 --- a/gnu/dist/diffutils/cmp.c +++ /dev/null @@ -1,568 +0,0 @@ -/* cmp -- compare two files. - Copyright (C) 1990, 1991, 1992, 1993, 1994 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 - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/* Written by Torbjorn Granlund and David MacKenzie. */ - -#include "system.h" -#include <stdio.h> -#include "getopt.h" -#include "cmpbuf.h" - -extern char const version_string[]; - -#if __STDC__ && defined (HAVE_VPRINTF) -void error (int, int, char const *, ...); -#else -void error (); -#endif -VOID *xmalloc PARAMS((size_t)); - -static int cmp PARAMS((void)); -static off_t file_position PARAMS((int)); -static size_t block_compare PARAMS((char const *, char const *)); -static size_t block_compare_and_count PARAMS((char const *, char const *, long *)); -static size_t block_read PARAMS((int, char *, size_t)); -static void printc PARAMS((int, unsigned)); -static void try_help PARAMS((char const *)); -static void check_stdout PARAMS((void)); -static void usage PARAMS((void)); - -/* Name under which this program was invoked. */ -char const *program_name; - -/* Filenames of the compared files. */ -static char const *file[2]; - -/* File descriptors of the files. */ -static int file_desc[2]; - -/* Read buffers for the files. */ -static char *buffer[2]; - -/* Optimal block size for the files. */ -static size_t buf_size; - -/* Initial prefix to ignore for each file. */ -static off_t ignore_initial; - -/* Output format: - type_first_diff - to print the offset and line number of the first differing bytes - type_all_diffs - to print the (decimal) offsets and (octal) values of all differing bytes - type_status - to only return an exit status indicating whether the files differ */ -static enum - { - type_first_diff, type_all_diffs, type_status - } comparison_type; - -/* Type used for fast comparison of several bytes at a time. */ -#ifndef word -#define word int -#endif - -/* If nonzero, print values of bytes quoted like cat -t does. */ -static int opt_print_chars; - -static struct option const long_options[] = -{ - {"print-chars", 0, 0, 'c'}, - {"ignore-initial", 1, 0, 'i'}, - {"verbose", 0, 0, 'l'}, - {"silent", 0, 0, 's'}, - {"quiet", 0, 0, 's'}, - {"version", 0, 0, 'v'}, - {"help", 0, 0, 129}, - {0, 0, 0, 0} -}; - -static void -try_help (reason) - char const *reason; -{ - if (reason) - error (0, 0, "%s", reason); - error (2, 0, "Try `%s --help' for more information.", program_name); -} - -static void -check_stdout () -{ - if (ferror (stdout)) - error (2, 0, "write error"); - else if (fclose (stdout) != 0) - error (2, errno, "write error"); -} - -static void -usage () -{ - printf ("Usage: %s [OPTION]... FILE1 [FILE2]\n", program_name); - printf ("%s", "\ - -c --print-chars Output differing bytes as characters.\n\ - -i N --ignore-initial=N Ignore differences in the first N bytes of input.\n\ - -l --verbose Output offsets and codes of all differing bytes.\n\ - -s --quiet --silent Output nothing; yield exit status only.\n\ - -v --version Output version info.\n\ - --help Output this help.\n"); - printf ("If a FILE is `-' or missing, read standard input.\n"); -} - -int -main (argc, argv) - int argc; - char *argv[]; -{ - int c, i, exit_status; - struct stat stat_buf[2]; - - initialize_main (&argc, &argv); - program_name = argv[0]; - - /* Parse command line options. */ - - while ((c = getopt_long (argc, argv, "ci:lsv", long_options, 0)) - != EOF) - switch (c) - { - case 'c': - opt_print_chars = 1; - break; - - case 'i': - ignore_initial = 0; - while (*optarg) - { - /* Don't use `atol', because `off_t' may be longer than `long'. */ - unsigned digit = *optarg++ - '0'; - if (9 < digit) - try_help ("non-digit in --ignore-initial value"); - ignore_initial = 10 * ignore_initial + digit; - } - break; - - case 'l': - comparison_type = type_all_diffs; - break; - - case 's': - comparison_type = type_status; - break; - - case 'v': - printf ("cmp - GNU diffutils version %s\n", version_string); - exit (0); - - case 129: - usage (); - check_stdout (); - exit (0); - - default: - try_help (0); - } - - if (optind == argc) - try_help ("missing operand"); - - file[0] = argv[optind++]; - file[1] = optind < argc ? argv[optind++] : "-"; - - if (optind < argc) - try_help ("extra operands"); - - for (i = 0; i < 2; i++) - { - /* If file[1] is "-", treat it first; this avoids a misdiagnostic if - stdin is closed and opening file[0] yields file descriptor 0. */ - int i1 = i ^ (strcmp (file[1], "-") == 0); - - /* Two files with the same name are identical. - But wait until we open the file once, for proper diagnostics. */ - if (i && filename_cmp (file[0], file[1]) == 0) - exit (0); - - file_desc[i1] = (strcmp (file[i1], "-") == 0 - ? STDIN_FILENO - : open (file[i1], O_RDONLY, 0)); - if (file_desc[i1] < 0 || fstat (file_desc[i1], &stat_buf[i1]) != 0) - { - if (file_desc[i1] < 0 && comparison_type == type_status) - exit (2); - else - error (2, errno, "%s", file[i1]); - } -#if HAVE_SETMODE - setmode (file_desc[i1], O_BINARY); -#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]) - && file_position (0) == file_position (1)) - exit (0); - - /* If output is redirected to the null device, we may assume `-s'. */ - - if (comparison_type != type_status) - { - struct stat outstat, nullstat; - - if (fstat (STDOUT_FILENO, &outstat) == 0 - && stat (NULL_DEVICE, &nullstat) == 0 - && 0 < same_file (&outstat, &nullstat)) - comparison_type = type_status; - } - - /* If only a return code is needed, - and if both input descriptors are associated with plain files, - conclude that the files differ if they have different sizes. */ - - if (comparison_type == type_status - && S_ISREG (stat_buf[0].st_mode) - && 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); - - if (max (0, s0) != max (0, s1)) - exit (1); - } - - /* Get the optimal block size of the files. */ - - buf_size = buffer_lcm (STAT_BLOCKSIZE (stat_buf[0]), - STAT_BLOCKSIZE (stat_buf[1])); - - /* Allocate buffers, with space for sentinels at the end. */ - - for (i = 0; i < 2; i++) - buffer[i] = xmalloc (buf_size + sizeof (word)); - - exit_status = cmp (); - - for (i = 0; i < 2; i++) - if (close (file_desc[i]) != 0) - error (2, errno, "%s", file[i]); - if (exit_status != 0 && comparison_type != type_status) - check_stdout (); - exit (exit_status); - return exit_status; -} - -/* Compare the two files already open on `file_desc[0]' and `file_desc[1]', - using `buffer[0]' and `buffer[1]'. - Return 0 if identical, 1 if different, >1 if error. */ - -static int -cmp () -{ - long line_number = 1; /* Line number (1...) of first difference. */ - long char_number = ignore_initial + 1; - /* Offset (1...) in files of 1st difference. */ - size_t read0, read1; /* Number of chars read from each file. */ - size_t first_diff; /* Offset (0...) in buffers of 1st diff. */ - size_t smaller; /* The lesser of `read0' and `read1'. */ - char *buf0 = buffer[0]; - char *buf1 = buffer[1]; - int ret = 0; - int i; - - if (ignore_initial) - for (i = 0; i < 2; i++) - if (file_position (i) == -1) - { - /* lseek failed; read and discard the ignored initial prefix. */ - off_t ig = ignore_initial; - do - { - size_t r = read (file_desc[i], buf0, (size_t) min (ig, buf_size)); - if (!r) - break; - if (r == -1) - error (2, errno, "%s", file[i]); - ig -= r; - } - while (ig); - } - - do - { - read0 = block_read (file_desc[0], buf0, buf_size); - if (read0 == -1) - error (2, errno, "%s", file[0]); - read1 = block_read (file_desc[1], buf1, buf_size); - if (read1 == -1) - error (2, errno, "%s", file[1]); - - /* Insert sentinels for the block compare. */ - - buf0[read0] = ~buf1[read0]; - buf1[read1] = ~buf0[read1]; - - /* If the line number should be written for differing files, - compare the blocks and count the number of newlines - simultaneously. */ - first_diff = (comparison_type == type_first_diff - ? block_compare_and_count (buf0, buf1, &line_number) - : block_compare (buf0, buf1)); - - char_number += first_diff; - smaller = min (read0, read1); - - if (first_diff < smaller) - { - switch (comparison_type) - { - case type_first_diff: - /* See Posix.2 section 4.10.6.1 for this format. */ - printf ("%s %s differ: char %lu, line %lu", - file[0], file[1], char_number, line_number); - if (opt_print_chars) - { - unsigned char c0 = buf0[first_diff]; - unsigned char c1 = buf1[first_diff]; - printf (" is %3o ", c0); - printc (0, c0); - printf (" %3o ", c1); - printc (0, c1); - } - putchar ('\n'); - /* Fall through. */ - case type_status: - return 1; - - case type_all_diffs: - do - { - unsigned char c0 = buf0[first_diff]; - unsigned char c1 = buf1[first_diff]; - if (c0 != c1) - { - if (opt_print_chars) - { - printf ("%6lu %3o ", char_number, c0); - printc (4, c0); - printf (" %3o ", c1); - printc (0, c1); - putchar ('\n'); - } - else - /* See Posix.2 section 4.10.6.1 for this format. */ - printf ("%6lu %3o %3o\n", char_number, c0, c1); - } - char_number++; - first_diff++; - } - while (first_diff < smaller); - ret = 1; - break; - } - } - - if (read0 != read1) - { - if (comparison_type != type_status) - /* See Posix.2 section 4.10.6.2 for this format. */ - fprintf (stderr, "cmp: EOF on %s\n", file[read1 < read0]); - - return 1; - } - } - while (read0 == buf_size); - return ret; -} - -/* Compare two blocks of memory P0 and P1 until they differ, - and count the number of '\n' occurrences in the common - part of P0 and P1. - Assumes that P0 and P1 are aligned at word addresses! - If the blocks are not guaranteed to be different, put sentinels at the ends - of the blocks before calling this function. - - Return the offset of the first byte that differs. - Increment *COUNT by the count of '\n' occurrences. */ - -static size_t -block_compare_and_count (p0, p1, count) - char const *p0, *p1; - long *count; -{ - word l; /* One word from first buffer. */ - word const *l0, *l1; /* Pointers into each buffer. */ - char const *c0, *c1; /* Pointers for finding exact address. */ - long cnt = 0; /* Number of '\n' occurrences. */ - word nnnn; /* Newline, sizeof (word) times. */ - int i; - - l0 = (word const *) p0; - l1 = (word const *) p1; - - nnnn = 0; - for (i = 0; i < sizeof (word); i++) - nnnn = (nnnn << CHAR_BIT) | '\n'; - - /* Find the rough position of the first difference by reading words, - not bytes. */ - - while ((l = *l0++) == *l1++) - { - l ^= nnnn; - for (i = 0; i < sizeof (word); i++) - { - cnt += ! (unsigned char) l; - l >>= CHAR_BIT; - } - } - - /* Find the exact differing position (endianness independent). */ - - c0 = (char const *) (l0 - 1); - c1 = (char const *) (l1 - 1); - while (*c0 == *c1) - { - cnt += *c0 == '\n'; - c0++; - c1++; - } - - *count += cnt; - return c0 - p0; -} - -/* Compare two blocks of memory P0 and P1 until they differ. - Assumes that P0 and P1 are aligned at word addresses! - If the blocks are not guaranteed to be different, put sentinels at the ends - of the blocks before calling this function. - - Return the offset of the first byte that differs. */ - -static size_t -block_compare (p0, p1) - char const *p0, *p1; -{ - word const *l0, *l1; - char const *c0, *c1; - - l0 = (word const *) p0; - l1 = (word const *) p1; - - /* Find the rough position of the first difference by reading words, - not bytes. */ - - while (*l0++ == *l1++) - ; - - /* Find the exact differing position (endianness independent). */ - - c0 = (char const *) (l0 - 1); - c1 = (char const *) (l1 - 1); - while (*c0 == *c1) - { - c0++; - c1++; - } - - return c0 - p0; -} - -/* Read NCHARS bytes from descriptor FD into BUF. - Return the number of characters successfully read. - The number returned is always NCHARS unless end-of-file or error. */ - -static size_t -block_read (fd, buf, nchars) - int fd; - char *buf; - size_t nchars; -{ - char *bp = buf; - - do - { - size_t nread = read (fd, bp, nchars); - if (nread == -1) - return -1; - if (nread == 0) - break; - bp += nread; - nchars -= nread; - } - while (nchars != 0); - - return bp - buf; -} - -/* Print character C, making unprintable characters - visible by quoting like cat -t does. - Pad with spaces on the right to WIDTH characters. */ - -static void -printc (width, c) - int width; - unsigned c; -{ - register FILE *fs = stdout; - - if (! ISPRINT (c)) - { - if (c >= 128) - { - putc ('M', fs); - putc ('-', fs); - c -= 128; - width -= 2; - } - if (c < 32) - { - putc ('^', fs); - c += 64; - --width; - } - else if (c == 127) - { - putc ('^', fs); - c = '?'; - --width; - } - } - - putc (c, fs); - while (--width > 0) - putc (' ', fs); -} - -/* Position file I to `ignore_initial' bytes from its initial position, - and yield its new position. Don't try more than once. */ - -static off_t -file_position (i) - int i; -{ - static int positioned[2]; - static off_t position[2]; - - if (! positioned[i]) - { - positioned[i] = 1; - position[i] = lseek (file_desc[i], ignore_initial, SEEK_CUR); - } - return position[i]; -} diff --git a/gnu/dist/diffutils/diff.info b/gnu/dist/diffutils/diff.info deleted file mode 100644 index b606a5ea5cf..00000000000 --- a/gnu/dist/diffutils/diff.info +++ /dev/null @@ -1,128 +0,0 @@ -This is Info file diff.info, produced by Makeinfo-1.55 from the input -file ./diff.texi. - - This file documents the the GNU `diff', `diff3', `sdiff', and `cmp' -commands for showing the differences between text files and the `patch' -command for using their output to update files. - - Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. - - Permission is granted to make and distribute verbatim copies of this -manual provided the copyright notice and this permission notice are -preserved on all copies. - - Permission is granted to copy and distribute modified versions of -this manual under the conditions for verbatim copying, provided that -the entire resulting derived work is distributed under the terms of a -permission notice identical to this one. - - Permission is granted to copy and distribute translations of this -manual into another language, under the above conditions for modified -versions, except that this permission notice may be stated in a -translation approved by the Foundation. - - -Indirect: -diff.info-1: 1007 -diff.info-2: 48281 -diff.info-3: 98082 -diff.info-4: 144163 - -Tag Table: -(Indirect) -Node: Top1007 -Node: Overview2412 -Node: Comparison5556 -Node: Hunks8174 -Node: White Space9600 -Node: Blank Lines10825 -Node: Case Folding11589 -Node: Specified Folding12002 -Node: Brief13092 -Node: Binary14343 -Node: Output Formats17683 -Node: Sample diff Input18375 -Node: Normal19868 -Node: Detailed Normal20797 -Node: Example Normal22522 -Node: Context23245 -Node: Context Format24793 -Node: Detailed Context25566 -Node: Example Context27122 -Node: Less Context28615 -Node: Unified Format29747 -Node: Detailed Unified30526 -Node: Example Unified31510 -Node: Sections32509 -Node: Specified Headings33253 -Node: C Function Headings34800 -Node: Alternate Names35619 -Node: Side by Side36516 -Node: Side by Side Format38656 -Node: Example Side by Side39553 -Node: Scripts40880 -Node: ed Scripts41278 -Node: Detailed ed42473 -Node: Example ed44214 -Node: Forward ed44652 -Node: RCS45414 -Node: If-then-else46624 -Node: Line Group Formats48281 -Node: Line Formats53963 -Node: Detailed If-then-else57225 -Node: Example If-then-else59126 -Node: Comparing Directories60178 -Node: Adjusting Output63293 -Node: Tabs63712 -Node: Pagination65234 -Node: diff Performance65653 -Node: Comparing Three Files67599 -Node: Sample diff3 Input68460 -Node: Detailed diff3 Normal69409 -Node: diff3 Hunks71189 -Node: Example diff3 Normal72475 -Node: diff3 Merging73499 -Node: Which Changes75709 -Node: Marking Conflicts77115 -Node: Bypassing ed79572 -Node: Merging Incomplete Lines80927 -Node: Saving the Changed File81644 -Node: Interactive Merging82254 -Node: sdiff Option Summary82952 -Node: Merge Commands84052 -Node: Merging with patch85188 -Node: patch Input87295 -Node: Imperfect87958 -Node: Changed White Space88695 -Node: Reversed Patches89446 -Node: Inexact91031 -Node: Empty Files94385 -Node: Multiple Patches94949 -Node: patch Messages96261 -Node: Making Patches98082 -Node: Invoking cmp101380 -Node: cmp Options101984 -Node: Invoking diff103414 -Node: diff Options104880 -Node: Invoking diff3115476 -Node: diff3 Options116107 -Node: Invoking patch119709 -Node: patch Directories121649 -Node: Backups123464 -Node: Rejects126011 -Node: patch Options126561 -Node: Invoking sdiff131418 -Node: sdiff Options132528 -Node: Incomplete Lines135845 -Node: Projects137468 -Node: Shortcomings138162 -Node: Changing Structure139157 -Node: Special Files140105 -Node: Unusual File Names141051 -Node: Arbitrary Limits141673 -Node: Large Files142102 -Node: Ignoring Changes142974 -Node: Bugs143518 -Node: Concept Index144163 - -End Tag Table diff --git a/gnu/dist/diffutils/diff.info-1 b/gnu/dist/diffutils/diff.info-1 deleted file mode 100644 index 477ac98399d..00000000000 --- a/gnu/dist/diffutils/diff.info-1 +++ /dev/null @@ -1,1211 +0,0 @@ -This is Info file diff.info, produced by Makeinfo-1.55 from the input -file ./diff.texi. - - This file documents the the GNU `diff', `diff3', `sdiff', and `cmp' -commands for showing the differences between text files and the `patch' -command for using their output to update files. - - Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. - - Permission is granted to make and distribute verbatim copies of this -manual provided the copyright notice and this permission notice are -preserved on all copies. - - Permission is granted to copy and distribute modified versions of -this manual under the conditions for verbatim copying, provided that -the entire resulting derived work is distributed under the terms of a -permission notice identical to this one. - - Permission is granted to copy and distribute translations of this -manual into another language, under the above conditions for modified -versions, except that this permission notice may be stated in a -translation approved by the Foundation. - - -File: diff.info, Node: Top, Up: (dir) - - This file documents the the GNU `diff', `diff3', `sdiff', and `cmp' -commands for showing the differences between text files and the `patch' -command for using their output to update files. - - This is Edition 1.2, for `diff' 2.4 and `patch' 2.1. - -* Menu: - -* Overview:: Preliminary information. - -* Comparison:: What file comparison means. -* Output Formats:: Formats for difference reports. -* Comparing Directories:: Comparing files and directories. -* Adjusting Output:: Making `diff' output prettier. -* diff Performance:: Making `diff' smarter or faster. -* Comparing Three Files:: Formats for three-way difference reports. - -* diff3 Merging:: Merging from a common ancestor. -* Interactive Merging:: Interactive merging with `sdiff'. -* Merging with patch:: Using `patch' to change old files into new ones. -* Making Patches:: Tips for making patch distributions. - -* Invoking cmp:: How to run `cmp' and a summary of its options. -* Invoking diff:: How to run `diff' and a summary of its options. -* Invoking diff3:: How to run `diff3' and a summary of its options. -* Invoking patch:: How to run `patch' and a summary of its options. -* Invoking sdiff:: How to run `sdiff' and a summary of its options. - -* Incomplete Lines:: Lines that lack trailing newlines. -* Projects:: If you think you've found a bug or other shortcoming. - -* Concept Index:: Index of concepts. - - -File: diff.info, Node: Overview, Next: Comparison, Up: Top - -Overview -******** - - Computer users often find occasion to ask how two files differ. -Perhaps one file is a newer version of the other file. Or maybe the -two files started out as identical copies but were changed by different -people. - - You can use the `diff' command to show differences between two -files, or each corresponding file in two directories. `diff' outputs -differences between files line by line in any of several formats, -selectable by command line options. This set of differences is often -called a "diff" or "patch". For files that are identical, `diff' -normally produces no output; for binary (non-text) files, `diff' -normally reports only that they are different. - - You can use the `cmp' command to show the offsets and line numbers -where two files differ. `cmp' can also show all the characters that -differ between the two files, side by side. Another way to compare two -files character by character is the Emacs command `M-x -compare-windows'. *Note Other Window: (emacs)Other Window, for more -information on that command. - - You can use the `diff3' command to show differences among three -files. When two people have made independent changes to a common -original, `diff3' can report the differences between the original and -the two changed versions, and can produce a merged file that contains -both persons' changes together with warnings about conflicts. - - You can use the `sdiff' command to merge two files interactively. - - You can use the set of differences produced by `diff' to distribute -updates to text files (such as program source code) to other people. -This method is especially useful when the differences are small compared -to the complete files. Given `diff' output, you can use the `patch' -program to update, or "patch", a copy of the file. If you think of -`diff' as subtracting one file from another to produce their -difference, you can think of `patch' as adding the difference to one -file to reproduce the other. - - This manual first concentrates on making diffs, and later shows how -to use diffs to update files. - - GNU `diff' was written by Mike Haertel, David Hayes, Richard -Stallman, Len Tower, and Paul Eggert. Wayne Davison designed and -implemented the unified output format. The basic algorithm is described -in "An O(ND) Difference Algorithm and its Variations", Eugene W. Myers, -`Algorithmica' Vol. 1 No. 2, 1986, pp. 251-266; and in "A File -Comparison Program", Webb Miller and Eugene W. Myers, -`Software--Practice and Experience' Vol. 15 No. 11, 1985, pp. 1025-1040. -The algorithm was independently discovered as described in "Algorithms -for Approximate String Matching", E. Ukkonen, `Information and Control' -Vol. 64, 1985, pp. 100-118. - - GNU `diff3' was written by Randy Smith. GNU `sdiff' was written by -Thomas Lord. GNU `cmp' was written by Torbjorn Granlund and David -MacKenzie. - - `patch' was written mainly by Larry Wall; the GNU enhancements were -written mainly by Wayne Davison and David MacKenzie. Parts of this -manual are adapted from a manual page written by Larry Wall, with his -permission. - - -File: diff.info, Node: Comparison, Next: Output Formats, Prev: Overview, Up: Top - -What Comparison Means -********************* - - There are several ways to think about the differences between two -files. One way to think of the differences is as a series of lines -that were deleted from, inserted in, or changed in one file to produce -the other file. `diff' compares two files line by line, finds groups of -lines that differ, and reports each group of differing lines. It can -report the differing lines in several formats, which have different -purposes. - - GNU `diff' can show whether files are different without detailing -the differences. It also provides ways to suppress certain kinds of -differences that are not important to you. Most commonly, such -differences are changes in the amount of white space between words or -lines. `diff' also provides ways to suppress differences in alphabetic -case or in lines that match a regular expression that you provide. -These options can accumulate; for example, you can ignore changes in -both white space and alphabetic case. - - Another way to think of the differences between two files is as a -sequence of pairs of characters that can be either identical or -different. `cmp' reports the differences between two files character -by character, instead of line by line. As a result, it is more useful -than `diff' for comparing binary files. For text files, `cmp' is -useful mainly when you want to know only whether two files are -identical. - - To illustrate the effect that considering changes character by -character can have compared with considering them line by line, think -of what happens if a single newline character is added to the beginning -of a file. If that file is then compared with an otherwise identical -file that lacks the newline at the beginning, `diff' will report that a -blank line has been added to the file, while `cmp' will report that -almost every character of the two files differs. - - `diff3' normally compares three input files line by line, finds -groups of lines that differ, and reports each group of differing lines. -Its output is designed to make it easy to inspect two different sets of -changes to the same file. - -* Menu: - -* Hunks:: Groups of differing lines. -* White Space:: Suppressing differences in white space. -* Blank Lines:: Suppressing differences in blank lines. -* Case Folding:: Suppressing differences in alphabetic case. -* Specified Folding:: Suppressing differences that match regular expressions. -* Brief:: Summarizing which files are different. -* Binary:: Comparing binary files or forcing text comparisons. - - -File: diff.info, Node: Hunks, Next: White Space, Up: Comparison - -Hunks -===== - - When comparing two files, `diff' finds sequences of lines common to -both files, interspersed with groups of differing lines called "hunks". -Comparing two identical files yields one sequence of common lines and -no hunks, because no lines differ. Comparing two entirely different -files yields no common lines and one large hunk that contains all lines -of both files. In general, there are many ways to match up lines -between two given files. `diff' tries to minimize the total hunk size -by finding large sequences of common lines interspersed with small -hunks of differing lines. - - For example, suppose the file `F' contains the three lines `a', `b', -`c', and the file `G' contains the same three lines in reverse order -`c', `b', `a'. If `diff' finds the line `c' as common, then the command -`diff F G' produces this output: - - 1,2d0 - < a - < b - 3a2,3 - > b - > a - -But if `diff' notices the common line `b' instead, it produces this -output: - - 1c1 - < a - --- - > c - 3c3 - < c - --- - > a - -It is also possible to find `a' as the common line. `diff' does not -always find an optimal matching between the files; it takes shortcuts -to run faster. But its output is usually close to the shortest -possible. You can adjust this tradeoff with the `--minimal' option -(*note diff Performance::.). - - -File: diff.info, Node: White Space, Next: Blank Lines, Prev: Hunks, Up: Comparison - -Suppressing Differences in Blank and Tab Spacing -================================================ - - The `-b' and `--ignore-space-change' options ignore white space at -line end, and considers all other sequences of one or more white space -characters to be equivalent. With these options, `diff' considers the -following two lines to be equivalent, where `$' denotes the line end: - - Here lyeth muche rychnesse in lytell space. -- John Heywood$ - Here lyeth muche rychnesse in lytell space. -- John Heywood $ - - The `-w' and `--ignore-all-space' options are stronger than `-b'. -They ignore difference even if one file has white space where the other -file has none. "White space" characters include tab, newline, vertical -tab, form feed, carriage return, and space; some locales may define -additional characters to be white space. With these options, `diff' -considers the following two lines to be equivalent, where `$' denotes -the line end and `^M' denotes a carriage return: - - Here lyeth muche rychnesse in lytell space.-- John Heywood$ - He relyeth much erychnes seinly tells pace. --John Heywood ^M$ - - -File: diff.info, Node: Blank Lines, Next: Case Folding, Prev: White Space, Up: Comparison - -Suppressing Differences in Blank Lines -====================================== - - The `-B' and `--ignore-blank-lines' options ignore insertions or -deletions of blank lines. These options normally affect only lines -that are completely empty; they do not affect lines that look empty but -contain space or tab characters. With these options, for example, a -file containing - 1. A point is that which has no part. - - 2. A line is breadthless length. - -- Euclid, The Elements, I - -is considered identical to a file containing - 1. A point is that which has no part. - 2. A line is breadthless length. - - - -- Euclid, The Elements, I - - -File: diff.info, Node: Case Folding, Next: Specified Folding, Prev: Blank Lines, Up: Comparison - -Suppressing Case Differences -============================ - - GNU `diff' can treat lowercase letters as equivalent to their -uppercase counterparts, so that, for example, it considers `Funky -Stuff', `funky STUFF', and `fUNKy stuFf' to all be the same. To -request this, use the `-i' or `--ignore-case' option. - - -File: diff.info, Node: Specified Folding, Next: Brief, Prev: Case Folding, Up: Comparison - -Suppressing Lines Matching a Regular Expression -=============================================== - - To ignore insertions and deletions of lines that match a regular -expression, use the `-I REGEXP' or `--ignore-matching-lines=REGEXP' -option. You should escape regular expressions that contain shell -metacharacters to prevent the shell from expanding them. For example, -`diff -I '^[0-9]'' ignores all changes to lines beginning with a digit. - - However, `-I' only ignores the insertion or deletion of lines that -contain the regular expression if every changed line in the hunk--every -insertion and every deletion--matches the regular expression. In other -words, for each nonignorable change, `diff' prints the complete set of -changes in its vicinity, including the ignorable ones. - - You can specify more than one regular expression for lines to ignore -by using more than one `-I' option. `diff' tries to match each line -against each regular expression, starting with the last one given. - - -File: diff.info, Node: Brief, Next: Binary, Prev: Specified Folding, Up: Comparison - -Summarizing Which Files Differ -============================== - - When you only want to find out whether files are different, and you -don't care what the differences are, you can use the summary output -format. In this format, instead of showing the differences between the -files, `diff' simply reports whether files differ. The `-q' and -`--brief' options select this output format. - - This format is especially useful when comparing the contents of two -directories. It is also much faster than doing the normal line by line -comparisons, because `diff' can stop analyzing the files as soon as it -knows that there are any differences. - - You can also get a brief indication of whether two files differ by -using `cmp'. For files that are identical, `cmp' produces no output. -When the files differ, by default, `cmp' outputs the byte offset and -line number where the first difference occurs. You can use the `-s' -option to suppress that information, so that `cmp' produces no output -and reports whether the files differ using only its exit status (*note -Invoking cmp::.). - - Unlike `diff', `cmp' cannot compare directories; it can only compare -two files. - - -File: diff.info, Node: Binary, Prev: Brief, Up: Comparison - -Binary Files and Forcing Text Comparisons -========================================= - - If `diff' thinks that either of the two files it is comparing is -binary (a non-text file), it normally treats that pair of files much as -if the summary output format had been selected (*note Brief::.), and -reports only that the binary files are different. This is because line -by line comparisons are usually not meaningful for binary files. - - `diff' determines whether a file is text or binary by checking the -first few bytes in the file; the exact number of bytes is system -dependent, but it is typically several thousand. If every character in -that part of the file is non-null, `diff' considers the file to be -text; otherwise it considers the file to be binary. - - Sometimes you might want to force `diff' to consider files to be -text. For example, you might be comparing text files that contain null -characters; `diff' would erroneously decide that those are non-text -files. Or you might be comparing documents that are in a format used -by a word processing system that uses null characters to indicate -special formatting. You can force `diff' to consider all files to be -text files, and compare them line by line, by using the `-a' or -`--text' option. If the files you compare using this option do not in -fact contain text, they will probably contain few newline characters, -and the `diff' output will consist of hunks showing differences between -long lines of whatever characters the files contain. - - You can also force `diff' to consider all files to be binary files, -and report only whether they differ (but not how). Use the `--brief' -option for this. - - In operating systems that distinguish between text and binary files, -`diff' normally reads and writes all data as text. Use the `--binary' -option to force `diff' to read and write binary data instead. This -option has no effect on a Posix-compliant system like GNU or -traditional Unix. However, many personal computer operating systems -represent the end of a line with a carriage return followed by a -newline. On such systems, `diff' normally ignores these carriage -returns on input and generates them at the end of each output line, but -with the `--binary' option `diff' treats each carriage return as just -another input character, and does not generate a carriage return at the -end of each output line. This can be useful when dealing with non-text -files that are meant to be interchanged with Posix-compliant systems. - - If you want to compare two files byte by byte, you can use the `cmp' -program with the `-l' option to show the values of each differing byte -in the two files. With GNU `cmp', you can also use the `-c' option to -show the ASCII representation of those bytes. *Note Invoking cmp::, -for more information. - - If `diff3' thinks that any of the files it is comparing is binary (a -non-text file), it normally reports an error, because such comparisons -are usually not useful. `diff3' uses the same test as `diff' to decide -whether a file is binary. As with `diff', if the input files contain a -few non-text characters but otherwise are like text files, you can -force `diff3' to consider all files to be text files and compare them -line by line by using the `-a' or `--text' options. - - -File: diff.info, Node: Output Formats, Next: Comparing Directories, Prev: Comparison, Up: Top - -`diff' Output Formats -********************* - - `diff' has several mutually exclusive options for output format. -The following sections describe each format, illustrating how `diff' -reports the differences between two sample input files. - -* Menu: - -* Sample diff Input:: Sample `diff' input files for examples. -* Normal:: Showing differences without surrounding text. -* Context:: Showing differences with the surrounding text. -* Side by Side:: Showing differences in two columns. -* Scripts:: Generating scripts for other programs. -* If-then-else:: Merging files with if-then-else. - - -File: diff.info, Node: Sample diff Input, Next: Normal, Up: Output Formats - -Two Sample Input Files -====================== - - Here are two sample files that we will use in numerous examples to -illustrate the output of `diff' and how various options can change it. - - This is the file `lao': - - The Way that can be told of is not the eternal Way; - The name that can be named is not the eternal name. - The Nameless is the origin of Heaven and Earth; - The Named is the mother of all things. - Therefore let there always be non-being, - so we may see their subtlety, - And let there always be being, - so we may see their outcome. - The two are the same, - But after they are produced, - they have different names. - - This is the file `tzu': - - The Nameless is the origin of Heaven and Earth; - The named is the mother of all things. - - Therefore let there always be non-being, - so we may see their subtlety, - And let there always be being, - so we may see their outcome. - The two are the same, - But after they are produced, - they have different names. - They both may be called deep and profound. - Deeper and more profound, - The door of all subtleties! - - In this example, the first hunk contains just the first two lines of -`lao', the second hunk contains the fourth line of `lao' opposing the -second and third lines of `tzu', and the last hunk contains just the -last three lines of `tzu'. - - -File: diff.info, Node: Normal, Next: Context, Prev: Sample diff Input, Up: Output Formats - -Showing Differences Without Context -=================================== - - The "normal" `diff' output format shows each hunk of differences -without any surrounding context. Sometimes such output is the clearest -way to see how lines have changed, without the clutter of nearby -unchanged lines (although you can get similar results with the context -or unified formats by using 0 lines of context). However, this format -is no longer widely used for sending out patches; for that purpose, the -context format (*note Context Format::.) and the unified format (*note -Unified Format::.) are superior. Normal format is the default for -compatibility with older versions of `diff' and the Posix standard. - -* Menu: - -* Detailed Normal:: A detailed description of normal output format. -* Example Normal:: Sample output in the normal format. - - -File: diff.info, Node: Detailed Normal, Next: Example Normal, Up: Normal - -Detailed Description of Normal Format -------------------------------------- - - The normal output format consists of one or more hunks of -differences; each hunk shows one area where the files differ. Normal -format hunks look like this: - - CHANGE-COMMAND - < FROM-FILE-LINE - < FROM-FILE-LINE... - --- - > TO-FILE-LINE - > TO-FILE-LINE... - - There are three types of change commands. Each consists of a line -number or comma-separated range of lines in the first file, a single -character indicating the kind of change to make, and a line number or -comma-separated range of lines in the second file. All line numbers are -the original line numbers in each file. The types of change commands -are: - -`LaR' - Add the lines in range R of the second file after line L of the - first file. For example, `8a12,15' means append lines 12-15 of - file 2 after line 8 of file 1; or, if changing file 2 into file 1, - delete lines 12-15 of file 2. - -`FcT' - Replace the lines in range F of the first file with lines in range - T of the second file. This is like a combined add and delete, but - more compact. For example, `5,7c8,10' means change lines 5-7 of - file 1 to read as lines 8-10 of file 2; or, if changing file 2 into - file 1, change lines 8-10 of file 2 to read as lines 5-7 of file 1. - -`RdL' - Delete the lines in range R from the first file; line L is where - they would have appeared in the second file had they not been - deleted. For example, `5,7d3' means delete lines 5-7 of file 1; - or, if changing file 2 into file 1, append lines 5-7 of file 1 - after line 3 of file 2. - - -File: diff.info, Node: Example Normal, Prev: Detailed Normal, Up: Normal - -An Example of Normal Format ---------------------------- - - Here is the output of the command `diff lao tzu' (*note Sample diff -Input::., for the complete contents of the two files). Notice that it -shows only the lines that are different between the two files. - - 1,2d0 - < The Way that can be told of is not the eternal Way; - < The name that can be named is not the eternal name. - 4c2,3 - < The Named is the mother of all things. - --- - > The named is the mother of all things. - > - 11a11,13 - > They both may be called deep and profound. - > Deeper and more profound, - > The door of all subtleties! - - -File: diff.info, Node: Context, Next: Side by Side, Prev: Normal, Up: Output Formats - -Showing Differences in Their Context -==================================== - - Usually, when you are looking at the differences between files, you -will also want to see the parts of the files near the lines that -differ, to help you understand exactly what has changed. These nearby -parts of the files are called the "context". - - GNU `diff' provides two output formats that show context around the -differing lines: "context format" and "unified format". It can -optionally show in which function or section of the file the differing -lines are found. - - If you are distributing new versions of files to other people in the -form of `diff' output, you should use one of the output formats that -show context so that they can apply the diffs even if they have made -small changes of their own to the files. `patch' can apply the diffs -in this case by searching in the files for the lines of context around -the differing lines; if those lines are actually a few lines away from -where the diff says they are, `patch' can adjust the line numbers -accordingly and still apply the diff correctly. *Note Imperfect::, for -more information on using `patch' to apply imperfect diffs. - -* Menu: - -* Context Format:: An output format that shows surrounding lines. -* Unified Format:: A more compact output format that shows context. -* Sections:: Showing which sections of the files differences are in. -* Alternate Names:: Showing alternate file names in context headers. - - -File: diff.info, Node: Context Format, Next: Unified Format, Up: Context - -Context Format --------------- - - The context output format shows several lines of context around the -lines that differ. It is the standard format for distributing updates -to source code. - - To select this output format, use the `-C LINES', -`--context[=LINES]', or `-c' option. The argument LINES that some of -these options take is the number of lines of context to show. If you -do not specify LINES, it defaults to three. For proper operation, -`patch' typically needs at least two lines of context. - -* Menu: - -* Detailed Context:: A detailed description of the context output format. -* Example Context:: Sample output in context format. -* Less Context:: Another sample with less context. - - -File: diff.info, Node: Detailed Context, Next: Example Context, Up: Context Format - -Detailed Description of Context Format -...................................... - - The context output format starts with a two-line header, which looks -like this: - - *** FROM-FILE FROM-FILE-MODIFICATION-TIME - --- TO-FILE TO-FILE-MODIFICATION TIME - -You can change the header's content with the `-L LABEL' or -`--label=LABEL' option; see *Note Alternate Names::. - - Next come one or more hunks of differences; each hunk shows one area -where the files differ. Context format hunks look like this: - - *************** - *** FROM-FILE-LINE-RANGE **** - FROM-FILE-LINE - FROM-FILE-LINE... - --- TO-FILE-LINE-RANGE ---- - TO-FILE-LINE - TO-FILE-LINE... - - The lines of context around the lines that differ start with two -space characters. The lines that differ between the two files start -with one of the following indicator characters, followed by a space -character: - -`!' - A line that is part of a group of one or more lines that changed - between the two files. There is a corresponding group of lines - marked with `!' in the part of this hunk for the other file. - -`+' - An "inserted" line in the second file that corresponds to nothing - in the first file. - -`-' - A "deleted" line in the first file that corresponds to nothing in - the second file. - - If all of the changes in a hunk are insertions, the lines of -FROM-FILE are omitted. If all of the changes are deletions, the lines -of TO-FILE are omitted. - - -File: diff.info, Node: Example Context, Next: Less Context, Prev: Detailed Context, Up: Context Format - -An Example of Context Format -............................ - - Here is the output of `diff -c lao tzu' (*note Sample diff Input::., -for the complete contents of the two files). Notice that up to three -lines that are not different are shown around each line that is -different; they are the context lines. Also notice that the first two -hunks have run together, because their contents overlap. - - *** lao Sat Jan 26 23:30:39 1991 - --- tzu Sat Jan 26 23:30:50 1991 - *************** - *** 1,7 **** - - The Way that can be told of is not the eternal Way; - - The name that can be named is not the eternal name. - The Nameless is the origin of Heaven and Earth; - ! The Named is the mother of all things. - Therefore let there always be non-being, - so we may see their subtlety, - And let there always be being, - --- 1,6 ---- - The Nameless is the origin of Heaven and Earth; - ! The named is the mother of all things. - ! - Therefore let there always be non-being, - so we may see their subtlety, - And let there always be being, - *************** - *** 9,11 **** - --- 8,13 ---- - The two are the same, - But after they are produced, - they have different names. - + They both may be called deep and profound. - + Deeper and more profound, - + The door of all subtleties! - - -File: diff.info, Node: Less Context, Prev: Example Context, Up: Context Format - -An Example of Context Format with Less Context -.............................................. - - Here is the output of `diff --context=1 lao tzu' (*note Sample diff -Input::., for the complete contents of the two files). Notice that at -most one context line is reported here. - - *** lao Sat Jan 26 23:30:39 1991 - --- tzu Sat Jan 26 23:30:50 1991 - *************** - *** 1,5 **** - - The Way that can be told of is not the eternal Way; - - The name that can be named is not the eternal name. - The Nameless is the origin of Heaven and Earth; - ! The Named is the mother of all things. - Therefore let there always be non-being, - --- 1,4 ---- - The Nameless is the origin of Heaven and Earth; - ! The named is the mother of all things. - ! - Therefore let there always be non-being, - *************** - *** 11 **** - --- 10,13 ---- - they have different names. - + They both may be called deep and profound. - + Deeper and more profound, - + The door of all subtleties! - - -File: diff.info, Node: Unified Format, Next: Sections, Prev: Context Format, Up: Context - -Unified Format --------------- - - The unified output format is a variation on the context format that -is more compact because it omits redundant context lines. To select -this output format, use the `-U LINES', `--unified[=LINES]', or `-u' -option. The argument LINES is the number of lines of context to show. -When it is not given, it defaults to three. - - At present, only GNU `diff' can produce this format and only GNU -`patch' can automatically apply diffs in this format. For proper -operation, `patch' typically needs at least two lines of context. - -* Menu: - -* Detailed Unified:: A detailed description of unified format. -* Example Unified:: Sample output in unified format. - - -File: diff.info, Node: Detailed Unified, Next: Example Unified, Up: Unified Format - -Detailed Description of Unified Format -...................................... - - The unified output format starts with a two-line header, which looks -like this: - - --- FROM-FILE FROM-FILE-MODIFICATION-TIME - +++ TO-FILE TO-FILE-MODIFICATION-TIME - -You can change the header's content with the `-L LABEL' or -`--label=LABEL' option; see *Note Alternate Names::. - - Next come one or more hunks of differences; each hunk shows one area -where the files differ. Unified format hunks look like this: - - @@ FROM-FILE-RANGE TO-FILE-RANGE @@ - LINE-FROM-EITHER-FILE - LINE-FROM-EITHER-FILE... - - The lines common to both files begin with a space character. The -lines that actually differ between the two files have one of the -following indicator characters in the left column: - -`+' - A line was added here to the first file. - -`-' - A line was removed here from the first file. - - -File: diff.info, Node: Example Unified, Prev: Detailed Unified, Up: Unified Format - -An Example of Unified Format -............................ - - Here is the output of the command `diff -u lao tzu' (*note Sample -diff Input::., for the complete contents of the two files): - - --- lao Sat Jan 26 23:30:39 1991 - +++ tzu Sat Jan 26 23:30:50 1991 - @@ -1,7 +1,6 @@ - -The Way that can be told of is not the eternal Way; - -The name that can be named is not the eternal name. - The Nameless is the origin of Heaven and Earth; - -The Named is the mother of all things. - +The named is the mother of all things. - + - Therefore let there always be non-being, - so we may see their subtlety, - And let there always be being, - @@ -9,3 +8,6 @@ - The two are the same, - But after they are produced, - they have different names. - +They both may be called deep and profound. - +Deeper and more profound, - +The door of all subtleties! - - -File: diff.info, Node: Sections, Next: Alternate Names, Prev: Unified Format, Up: Context - -Showing Which Sections Differences Are in ------------------------------------------ - - Sometimes you might want to know which part of the files each change -falls in. If the files are source code, this could mean which function -was changed. If the files are documents, it could mean which chapter or -appendix was changed. GNU `diff' can show this by displaying the -nearest section heading line that precedes the differing lines. Which -lines are "section headings" is determined by a regular expression. - -* Menu: - -* Specified Headings:: Showing headings that match regular expressions. -* C Function Headings:: Showing headings of C functions. - - -File: diff.info, Node: Specified Headings, Next: C Function Headings, Up: Sections - -Showing Lines That Match Regular Expressions -............................................ - - To show in which sections differences occur for files that are not -source code for C or similar languages, use the `-F REGEXP' or -`--show-function-line=REGEXP' option. `diff' considers lines that -match the argument REGEXP to be the beginning of a section of the file. -Here are suggested regular expressions for some common languages: - -`^[A-Za-z_]' - C, C++, Prolog - -`^(' - Lisp - -`^@\(chapter\|appendix\|unnumbered\|chapheading\)' - Texinfo - - This option does not automatically select an output format; in order -to use it, you must select the context format (*note Context Format::.) -or unified format (*note Unified Format::.). In other output formats it -has no effect. - - The `-F' and `--show-function-line' options find the nearest -unchanged line that precedes each hunk of differences and matches the -given regular expression. Then they add that line to the end of the -line of asterisks in the context format, or to the `@@' line in unified -format. If no matching line exists, they leave the output for that -hunk unchanged. If that line is more than 40 characters long, they -output only the first 40 characters. You can specify more than one -regular expression for such lines; `diff' tries to match each line -against each regular expression, starting with the last one given. This -means that you can use `-p' and `-F' together, if you wish. - - -File: diff.info, Node: C Function Headings, Prev: Specified Headings, Up: Sections - -Showing C Function Headings -........................... - - To show in which functions differences occur for C and similar -languages, you can use the `-p' or `--show-c-function' option. This -option automatically defaults to the context output format (*note -Context Format::.), with the default number of lines of context. You -can override that number with `-C LINES' elsewhere in the command line. -You can override both the format and the number with `-U LINES' -elsewhere in the command line. - - The `-p' and `--show-c-function' options are equivalent to -`-F'^[_a-zA-Z$]'' if the unified format is specified, otherwise `-c --F'^[_a-zA-Z$]'' (*note Specified Headings::.). GNU `diff' provides -them for the sake of convenience. - - -File: diff.info, Node: Alternate Names, Prev: Sections, Up: Context - -Showing Alternate File Names ----------------------------- - - If you are comparing two files that have meaningless or uninformative -names, you might want `diff' to show alternate names in the header of -the context and unified output formats. To do this, use the `-L LABEL' -or `--label=LABEL' option. The first time you give this option, its -argument replaces the name and date of the first file in the header; -the second time, its argument replaces the name and date of the second -file. If you give this option more than twice, `diff' reports an -error. The `-L' option does not affect the file names in the `pr' -header when the `-l' or `--paginate' option is used (*note -Pagination::.). - - Here are the first two lines of the output from `diff -C2 -Loriginal --Lmodified lao tzu': - - *** original - --- modified - - -File: diff.info, Node: Side by Side, Next: Scripts, Prev: Context, Up: Output Formats - -Showing Differences Side by Side -================================ - - `diff' can produce a side by side difference listing of two files. -The files are listed in two columns with a gutter between them. The -gutter contains one of the following markers: - -white space - The corresponding lines are in common. That is, either the lines - are identical, or the difference is ignored because of one of the - `--ignore' options (*note White Space::.). - -`|' - The corresponding lines differ, and they are either both complete - or both incomplete. - -`<' - The files differ and only the first file contains the line. - -`>' - The files differ and only the second file contains the line. - -`(' - Only the first file contains the line, but the difference is - ignored. - -`)' - Only the second file contains the line, but the difference is - ignored. - -`\' - The corresponding lines differ, and only the first line is - incomplete. - -`/' - The corresponding lines differ, and only the second line is - incomplete. - - Normally, an output line is incomplete if and only if the lines that -it contains are incomplete; *Note Incomplete Lines::. However, when an -output line represents two differing lines, one might be incomplete -while the other is not. In this case, the output line is complete, but -its the gutter is marked `\' if the first line is incomplete, `/' if -the second line is. - - Side by side format is sometimes easiest to read, but it has -limitations. It generates much wider output than usual, and truncates -lines that are too long to fit. Also, it relies on lining up output -more heavily than usual, so its output looks particularly bad if you -use varying width fonts, nonstandard tab stops, or nonprinting -characters. - - You can use the `sdiff' command to interactively merge side by side -differences. *Note Interactive Merging::, for more information on -merging files. - -* Menu: - -* Side by Side Format:: Controlling side by side output format. -* Example Side by Side:: Sample side by side output. - - -File: diff.info, Node: Side by Side Format, Next: Example Side by Side, Up: Side by Side - -Controlling Side by Side Format -=============================== - - The `-y' or `--side-by-side' option selects side by side format. -Because side by side output lines contain two input lines, they are -wider than usual. They are normally 130 columns, which can fit onto a -traditional printer line. You can set the length of output lines with -the `-W COLUMNS' or `--width=COLUMNS' option. The output line is split -into two halves of equal length, separated by a small gutter to mark -differences; the right half is aligned to a tab stop so that tabs line -up. Input lines that are too long to fit in half of an output line are -truncated for output. - - The `--left-column' option prints only the left column of two common -lines. The `--suppress-common-lines' option suppresses common lines -entirely. - - -File: diff.info, Node: Example Side by Side, Prev: Side by Side Format, Up: Side by Side - -An Example of Side by Side Format ---------------------------------- - - Here is the output of the command `diff -y -W 72 lao tzu' (*note -Sample diff Input::., for the complete contents of the two files). - - The Way that can be told of is n < - The name that can be named is no < - The Nameless is the origin of He The Nameless is the origin of He - The Named is the mother of all t | The named is the mother of all t - > - Therefore let there always be no Therefore let there always be no - so we may see their subtlety, so we may see their subtlety, - And let there always be being, And let there always be being, - so we may see their outcome. so we may see their outcome. - The two are the same, The two are the same, - But after they are produced, But after they are produced, - they have different names. they have different names. - > They both may be called deep and - > Deeper and more profound, - > The door of all subtleties! - - -File: diff.info, Node: Scripts, Next: If-then-else, Prev: Side by Side, Up: Output Formats - -Making Edit Scripts -=================== - - Several output modes produce command scripts for editing FROM-FILE -to produce TO-FILE. - -* Menu: - -* ed Scripts:: Using `diff' to produce commands for `ed'. -* Forward ed:: Making forward `ed' scripts. -* RCS:: A special `diff' output format used by RCS. - - -File: diff.info, Node: ed Scripts, Next: Forward ed, Up: Scripts - -`ed' Scripts ------------- - - `diff' can produce commands that direct the `ed' text editor to -change the first file into the second file. Long ago, this was the -only output mode that was suitable for editing one file into another -automatically; today, with `patch', it is almost obsolete. Use the -`-e' or `--ed' option to select this output format. - - Like the normal format (*note Normal::.), this output format does not -show any context; unlike the normal format, it does not include the -information necessary to apply the diff in reverse (to produce the first -file if all you have is the second file and the diff). - - If the file `d' contains the output of `diff -e old new', then the -command `(cat d && echo w) | ed - old' edits `old' to make it a copy of -`new'. More generally, if `d1', `d2', ..., `dN' contain the outputs of -`diff -e old new1', `diff -e new1 new2', ..., `diff -e newN-1 newN', -respectively, then the command `(cat d1 d2 ... dN && echo w) | ed - -old' edits `old' to make it a copy of `newN'. - -* Menu: - -* Detailed ed:: A detailed description of `ed' format. -* Example ed:: A sample `ed' script. - - -File: diff.info, Node: Detailed ed, Next: Example ed, Up: ed Scripts - -Detailed Description of `ed' Format -................................... - - The `ed' output format consists of one or more hunks of differences. -The changes closest to the ends of the files come first so that -commands that change the number of lines do not affect how `ed' -interprets line numbers in succeeding commands. `ed' format hunks look -like this: - - CHANGE-COMMAND - TO-FILE-LINE - TO-FILE-LINE... - . - - Because `ed' uses a single period on a line to indicate the end of -input, GNU `diff' protects lines of changes that contain a single -period on a line by writing two periods instead, then writing a -subsequent `ed' command to change the two periods into one. The `ed' -format cannot represent an incomplete line, so if the second file ends -in a changed incomplete line, `diff' reports an error and then pretends -that a newline was appended. - - There are three types of change commands. Each consists of a line -number or comma-separated range of lines in the first file and a single -character indicating the kind of change to make. All line numbers are -the original line numbers in the file. The types of change commands -are: - -`La' - Add text from the second file after line L in the first file. For - example, `8a' means to add the following lines after line 8 of file - 1. - -`Rc' - Replace the lines in range R in the first file with the following - lines. Like a combined add and delete, but more compact. For - example, `5,7c' means change lines 5-7 of file 1 to read as the - text file 2. - -`Rd' - Delete the lines in range R from the first file. For example, - `5,7d' means delete lines 5-7 of file 1. - - -File: diff.info, Node: Example ed, Prev: Detailed ed, Up: ed Scripts - -Example `ed' Script -................... - - Here is the output of `diff -e lao tzu' (*note Sample diff Input::., -for the complete contents of the two files): - - 11a - They both may be called deep and profound. - Deeper and more profound, - The door of all subtleties! - . - 4c - The named is the mother of all things. - - . - 1,2d - - -File: diff.info, Node: Forward ed, Next: RCS, Prev: ed Scripts, Up: Scripts - -Forward `ed' Scripts --------------------- - - `diff' can produce output that is like an `ed' script, but with -hunks in forward (front to back) order. The format of the commands is -also changed slightly: command characters precede the lines they -modify, spaces separate line numbers in ranges, and no attempt is made -to disambiguate hunk lines consisting of a single period. Like `ed' -format, forward `ed' format cannot represent incomplete lines. - - Forward `ed' format is not very useful, because neither `ed' nor -`patch' can apply diffs in this format. It exists mainly for -compatibility with older versions of `diff'. Use the `-f' or -`--forward-ed' option to select it. - - -File: diff.info, Node: RCS, Prev: Forward ed, Up: Scripts - -RCS Scripts ------------ - - The RCS output format is designed specifically for use by the -Revision Control System, which is a set of free programs used for -organizing different versions and systems of files. Use the `-n' or -`--rcs' option to select this output format. It is like the forward -`ed' format (*note Forward ed::.), but it can represent arbitrary -changes to the contents of a file because it avoids the forward `ed' -format's problems with lines consisting of a single period and with -incomplete lines. Instead of ending text sections with a line -consisting of a single period, each command specifies the number of -lines it affects; a combination of the `a' and `d' commands are used -instead of `c'. Also, if the second file ends in a changed incomplete -line, then the output also ends in an incomplete line. - - Here is the output of `diff -n lao tzu' (*note Sample diff Input::., -for the complete contents of the two files): - - d1 2 - d4 1 - a4 2 - The named is the mother of all things. - - a11 3 - They both may be called deep and profound. - Deeper and more profound, - The door of all subtleties! - - -File: diff.info, Node: If-then-else, Prev: Scripts, Up: Output Formats - -Merging Files with If-then-else -=============================== - - You can use `diff' to merge two files of C source code. The output -of `diff' in this format contains all the lines of both files. Lines -common to both files are output just once; the differing parts are -separated by the C preprocessor directives `#ifdef NAME' or `#ifndef -NAME', `#else', and `#endif'. When compiling the output, you select -which version to use by either defining or leaving undefined the macro -NAME. - - To merge two files, use `diff' with the `-D NAME' or `--ifdef=NAME' -option. The argument NAME is the C preprocessor identifier to use in -the `#ifdef' and `#ifndef' directives. - - For example, if you change an instance of `wait (&s)' to `waitpid -(-1, &s, 0)' and then merge the old and new files with the -`--ifdef=HAVE_WAITPID' option, then the affected part of your code -might look like this: - - do { - #ifndef HAVE_WAITPID - if ((w = wait (&s)) < 0 && errno != EINTR) - #else /* HAVE_WAITPID */ - if ((w = waitpid (-1, &s, 0)) < 0 && errno != EINTR) - #endif /* HAVE_WAITPID */ - return w; - } while (w != child); - - You can specify formats for languages other than C by using line -group formats and line formats, as described in the next sections. - -* Menu: - -* Line Group Formats:: Formats for general if-then-else line groups. -* Line Formats:: Formats for each line in a line group. -* Detailed If-then-else:: A detailed description of if-then-else format. -* Example If-then-else:: Sample if-then-else format output. - diff --git a/gnu/dist/diffutils/diff.info-2 b/gnu/dist/diffutils/diff.info-2 deleted file mode 100644 index 43fae2835c7..00000000000 --- a/gnu/dist/diffutils/diff.info-2 +++ /dev/null @@ -1,1312 +0,0 @@ -This is Info file diff.info, produced by Makeinfo-1.55 from the input -file ./diff.texi. - - This file documents the the GNU `diff', `diff3', `sdiff', and `cmp' -commands for showing the differences between text files and the `patch' -command for using their output to update files. - - Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. - - Permission is granted to make and distribute verbatim copies of this -manual provided the copyright notice and this permission notice are -preserved on all copies. - - Permission is granted to copy and distribute modified versions of -this manual under the conditions for verbatim copying, provided that -the entire resulting derived work is distributed under the terms of a -permission notice identical to this one. - - Permission is granted to copy and distribute translations of this -manual into another language, under the above conditions for modified -versions, except that this permission notice may be stated in a -translation approved by the Foundation. - - -File: diff.info, Node: Line Group Formats, Next: Line Formats, Up: If-then-else - -Line Group Formats ------------------- - - Line group formats let you specify formats suitable for many -applications that allow if-then-else input, including programming -languages and text formatting languages. A line group format specifies -the output format for a contiguous group of similar lines. - - For example, the following command compares the TeX files `old' and -`new', and outputs a merged file in which old regions are surrounded by -`\begin{em}'-`\end{em}' lines, and new regions are surrounded by -`\begin{bf}'-`\end{bf}' lines. - - diff \ - --old-group-format='\begin{em} - %<\end{em} - ' \ - --new-group-format='\begin{bf} - %>\end{bf} - ' \ - old new - - The following command is equivalent to the above example, but it is a -little more verbose, because it spells out the default line group -formats. - - diff \ - --old-group-format='\begin{em} - %<\end{em} - ' \ - --new-group-format='\begin{bf} - %>\end{bf} - ' \ - --unchanged-group-format='%=' \ - --changed-group-format='\begin{em} - %<\end{em} - \begin{bf} - %>\end{bf} - ' \ - old new - - Here is a more advanced example, which outputs a diff listing with -headers containing line numbers in a "plain English" style. - - diff \ - --unchanged-group-format='' \ - --old-group-format='-------- %dn line%(n=1?:s) deleted at %df: - %<' \ - --new-group-format='-------- %dN line%(N=1?:s) added after %de: - %>' \ - --changed-group-format='-------- %dn line%(n=1?:s) changed at %df: - %<-------- to: - %>' \ - old new - - To specify a line group format, use `diff' with one of the options -listed below. You can specify up to four line group formats, one for -each kind of line group. You should quote FORMAT, because it typically -contains shell metacharacters. - -`--old-group-format=FORMAT' - These line groups are hunks containing only lines from the first - file. The default old group format is the same as the changed - group format if it is specified; otherwise it is a format that - outputs the line group as-is. - -`--new-group-format=FORMAT' - These line groups are hunks containing only lines from the second - file. The default new group format is same as the the changed - group format if it is specified; otherwise it is a format that - outputs the line group as-is. - -`--changed-group-format=FORMAT' - These line groups are hunks containing lines from both files. The - default changed group format is the concatenation of the old and - new group formats. - -`--unchanged-group-format=FORMAT' - These line groups contain lines common to both files. The default - unchanged group format is a format that outputs the line group - as-is. - - In a line group format, ordinary characters represent themselves; -conversion specifications start with `%' and have one of the following -forms. - -`%<' - stands for the lines from the first file, including the trailing - newline. Each line is formatted according to the old line format - (*note Line Formats::.). - -`%>' - stands for the lines from the second file, including the trailing - newline. Each line is formatted according to the new line format. - -`%=' - stands for the lines common to both files, including the trailing - newline. Each line is formatted according to the unchanged line - format. - -`%%' - stands for `%'. - -`%c'C'' - where C is a single character, stands for C. C may not be a - backslash or an apostrophe. For example, `%c':'' stands for a - colon, even inside the then-part of an if-then-else format, which - a colon would normally terminate. - -`%c'\O'' - where O is a string of 1, 2, or 3 octal digits, stands for the - character with octal code O. For example, `%c'\0'' stands for a - null character. - -`FN' - where F is a `printf' conversion specification and N is one of the - following letters, stands for N's value formatted with F. - - `e' - The line number of the line just before the group in the old - file. - - `f' - The line number of the first line in the group in the old - file; equals E + 1. - - `l' - The line number of the last line in the group in the old file. - - `m' - The line number of the line just after the group in the old - file; equals L + 1. - - `n' - The number of lines in the group in the old file; equals L - - F + 1. - - `E, F, L, M, N' - Likewise, for lines in the new file. - - The `printf' conversion specification can be `%d', `%o', `%x', or - `%X', specifying decimal, octal, lower case hexadecimal, or upper - case hexadecimal output respectively. After the `%' the following - options can appear in sequence: a `-' specifying - left-justification; an integer specifying the minimum field width; - and a period followed by an optional integer specifying the - minimum number of digits. For example, `%5dN' prints the number - of new lines in the group in a field of width 5 characters, using - the `printf' format `"%5d"'. - -`(A=B?T:E)' - If A equals B then T else E. A and B are each either a decimal - constant or a single letter interpreted as above. This format - spec is equivalent to T if A's value equals B's; otherwise it is - equivalent to E. - - For example, `%(N=0?no:%dN) line%(N=1?:s)' is equivalent to `no - lines' if N (the number of lines in the group in the the new file) - is 0, to `1 line' if N is 1, and to `%dN lines' otherwise. - - -File: diff.info, Node: Line Formats, Next: Detailed If-then-else, Prev: Line Group Formats, Up: If-then-else - -Line Formats ------------- - - Line formats control how each line taken from an input file is -output as part of a line group in if-then-else format. - - For example, the following command outputs text with a one-column -change indicator to the left of the text. The first column of output -is `-' for deleted lines, `|' for added lines, and a space for -unchanged lines. The formats contain newline characters where newlines -are desired on output. - - diff \ - --old-line-format='-%l - ' \ - --new-line-format='|%l - ' \ - --unchanged-line-format=' %l - ' \ - old new - - To specify a line format, use one of the following options. You -should quote FORMAT, since it often contains shell metacharacters. - -`--old-line-format=FORMAT' - formats lines just from the first file. - -`--new-line-format=FORMAT' - formats lines just from the second file. - -`--unchanged-line-format=FORMAT' - formats lines common to both files. - -`--line-format=FORMAT' - formats all lines; in effect, it sets all three above options - simultaneously. - - In a line format, ordinary characters represent themselves; -conversion specifications start with `%' and have one of the following -forms. - -`%l' - stands for the the contents of the line, not counting its trailing - newline (if any). This format ignores whether the line is - incomplete; *Note Incomplete Lines::. - -`%L' - stands for the the contents of the line, including its trailing - newline (if any). If a line is incomplete, this format preserves - its incompleteness. - -`%%' - stands for `%'. - -`%c'C'' - where C is a single character, stands for C. C may not be a - backslash or an apostrophe. For example, `%c':'' stands for a - colon. - -`%c'\O'' - where O is a string of 1, 2, or 3 octal digits, stands for the - character with octal code O. For example, `%c'\0'' stands for a - null character. - -`Fn' - where F is a `printf' conversion specification, stands for the - line number formatted with F. For example, `%.5dn' prints the - line number using the `printf' format `"%.5d"'. *Note Line Group - Formats::, for more about printf conversion specifications. - - The default line format is `%l' followed by a newline character. - - If the input contains tab characters and it is important that they -line up on output, you should ensure that `%l' or `%L' in a line format -is just after a tab stop (e.g. by preceding `%l' or `%L' with a tab -character), or you should use the `-t' or `--expand-tabs' option. - - Taken together, the line and line group formats let you specify many -different formats. For example, the following command uses a format -similar to `diff''s normal format. You can tailor this command to get -fine control over `diff''s output. - - diff \ - --old-line-format='< %l - ' \ - --new-line-format='> %l - ' \ - --old-group-format='%df%(f=l?:,%dl)d%dE - %<' \ - --new-group-format='%dea%dF%(F=L?:,%dL) - %>' \ - --changed-group-format='%df%(f=l?:,%dl)c%dF%(F=L?:,%dL) - %<--- - %>' \ - --unchanged-group-format='' \ - old new - - -File: diff.info, Node: Detailed If-then-else, Next: Example If-then-else, Prev: Line Formats, Up: If-then-else - -Detailed Description of If-then-else Format -------------------------------------------- - - For lines common to both files, `diff' uses the unchanged line group -format. For each hunk of differences in the merged output format, if -the hunk contains only lines from the first file, `diff' uses the old -line group format; if the hunk contains only lines from the second -file, `diff' uses the new group format; otherwise, `diff' uses the -changed group format. - - The old, new, and unchanged line formats specify the output format of -lines from the first file, lines from the second file, and lines common -to both files, respectively. - - The option `--ifdef=NAME' is equivalent to the following sequence of -options using shell syntax: - - --old-group-format='#ifndef NAME - %<#endif /* not NAME */ - ' \ - --new-group-format='#ifdef NAME - %>#endif /* NAME */ - ' \ - --unchanged-group-format='%=' \ - --changed-group-format='#ifndef NAME - %<#else /* NAME */ - %>#endif /* NAME */ - ' - - You should carefully check the `diff' output for proper nesting. -For example, when using the the `-D NAME' or `--ifdef=NAME' option, you -should check that if the differing lines contain any of the C -preprocessor directives `#ifdef', `#ifndef', `#else', `#elif', or -`#endif', they are nested properly and match. If they don't, you must -make corrections manually. It is a good idea to carefully check the -resulting code anyway to make sure that it really does what you want it -to; depending on how the input files were produced, the output might -contain duplicate or otherwise incorrect code. - - The `patch' `-D NAME' option behaves just like the `diff' `-D NAME' -option, except it operates on a file and a diff to produce a merged -file; *Note patch Options::. - - -File: diff.info, Node: Example If-then-else, Prev: Detailed If-then-else, Up: If-then-else - -An Example of If-then-else Format ---------------------------------- - - Here is the output of `diff -DTWO lao tzu' (*note Sample diff -Input::., for the complete contents of the two files): - - #ifndef TWO - The Way that can be told of is not the eternal Way; - The name that can be named is not the eternal name. - #endif /* not TWO */ - The Nameless is the origin of Heaven and Earth; - #ifndef TWO - The Named is the mother of all things. - #else /* TWO */ - The named is the mother of all things. - - #endif /* TWO */ - Therefore let there always be non-being, - so we may see their subtlety, - And let there always be being, - so we may see their outcome. - The two are the same, - But after they are produced, - they have different names. - #ifdef TWO - They both may be called deep and profound. - Deeper and more profound, - The door of all subtleties! - #endif /* TWO */ - - -File: diff.info, Node: Comparing Directories, Next: Adjusting Output, Prev: Output Formats, Up: Top - -Comparing Directories -********************* - - You can use `diff' to compare some or all of the files in two -directory trees. When both file name arguments to `diff' are -directories, it compares each file that is contained in both -directories, examining file names in alphabetical order. Normally -`diff' is silent about pairs of files that contain no differences, but -if you use the `-s' or `--report-identical-files' option, it reports -pairs of identical files. Normally `diff' reports subdirectories -common to both directories without comparing subdirectories' files, but -if you use the `-r' or `--recursive' option, it compares every -corresponding pair of files in the directory trees, as many levels deep -as they go. - - For file names that are in only one of the directories, `diff' -normally does not show the contents of the file that exists; it reports -only that the file exists in that directory and not in the other. You -can make `diff' act as though the file existed but was empty in the -other directory, so that it outputs the entire contents of the file that -actually exists. (It is output as either an insertion or a deletion, -depending on whether it is in the first or the second directory given.) -To do this, use the `-N' or `--new-file' option. - - If the older directory contains one or more large files that are not -in the newer directory, you can make the patch smaller by using the -`-P' or `--unidirectional-new-file' option instead of `-N'. This -option is like `-N' except that it only inserts the contents of files -that appear in the second directory but not the first (that is, files -that were added). At the top of the patch, write instructions for the -user applying the patch to remove the files that were deleted before -applying the patch. *Note Making Patches::, for more discussion of -making patches for distribution. - - To ignore some files while comparing directories, use the `-x -PATTERN' or `--exclude=PATTERN' option. This option ignores any files -or subdirectories whose base names match the shell pattern PATTERN. -Unlike in the shell, a period at the start of the base of a file name -matches a wildcard at the start of a pattern. You should enclose -PATTERN in quotes so that the shell does not expand it. For example, -the option `-x '*.[ao]'' ignores any file whose name ends with `.a' or -`.o'. - - This option accumulates if you specify it more than once. For -example, using the options `-x 'RCS' -x '*,v'' ignores any file or -subdirectory whose base name is `RCS' or ends with `,v'. - - If you need to give this option many times, you can instead put the -patterns in a file, one pattern per line, and use the `-X FILE' or -`--exclude-from=FILE' option. - - If you have been comparing two directories and stopped partway -through, later you might want to continue where you left off. You can -do this by using the `-S FILE' or `--starting-file=FILE' option. This -compares only the file FILE and all alphabetically later files in the -topmost directory level. - - -File: diff.info, Node: Adjusting Output, Next: diff Performance, Prev: Comparing Directories, Up: Top - -Making `diff' Output Prettier -***************************** - - `diff' provides several ways to adjust the appearance of its output. -These adjustments can be applied to any output format. - -* Menu: - -* Tabs:: Preserving the alignment of tabstops. -* Pagination:: Page numbering and timestamping `diff' output. - - -File: diff.info, Node: Tabs, Next: Pagination, Up: Adjusting Output - -Preserving Tabstop Alignment -============================ - - The lines of text in some of the `diff' output formats are preceded -by one or two characters that indicate whether the text is inserted, -deleted, or changed. The addition of those characters can cause tabs to -move to the next tabstop, throwing off the alignment of columns in the -line. GNU `diff' provides two ways to make tab-aligned columns line up -correctly. - - The first way is to have `diff' convert all tabs into the correct -number of spaces before outputting them; select this method with the -`-t' or `--expand-tabs' option. `diff' assumes that tabstops are set -every 8 columns. To use this form of output with `patch', you must -give `patch' the `-l' or `--ignore-white-space' option (*note Changed -White Space::., for more information). - - The other method for making tabs line up correctly is to add a tab -character instead of a space after the indicator character at the -beginning of the line. This ensures that all following tab characters -are in the same position relative to tabstops that they were in the -original files, so that the output is aligned correctly. Its -disadvantage is that it can make long lines too long to fit on one line -of the screen or the paper. It also does not work with the unified -output format, which does not have a space character after the change -type indicator character. Select this method with the `-T' or -`--initial-tab' option. - - -File: diff.info, Node: Pagination, Prev: Tabs, Up: Adjusting Output - -Paginating `diff' Output -======================== - - It can be convenient to have long output page-numbered and -time-stamped. The `-l' and `--paginate' options do this by sending the -`diff' output through the `pr' program. Here is what the page header -might look like for `diff -lc lao tzu': - - Mar 11 13:37 1991 diff -lc lao tzu Page 1 - - -File: diff.info, Node: diff Performance, Next: Comparing Three Files, Prev: Adjusting Output, Up: Top - -`diff' Performance Tradeoffs -**************************** - - GNU `diff' runs quite efficiently; however, in some circumstances -you can cause it to run faster or produce a more compact set of changes. -There are two ways that you can affect the performance of GNU `diff' by -changing the way it compares files. - - Performance has more than one dimension. These options improve one -aspect of performance at the cost of another, or they improve -performance in some cases while hurting it in others. - - The way that GNU `diff' determines which lines have changed always -comes up with a near-minimal set of differences. Usually it is good -enough for practical purposes. If the `diff' output is large, you -might want `diff' to use a modified algorithm that sometimes produces a -smaller set of differences. The `-d' or `--minimal' option does this; -however, it can also cause `diff' to run more slowly than usual, so it -is not the default behavior. - - When the files you are comparing are large and have small groups of -changes scattered throughout them, you can use the `-H' or -`--speed-large-files' option to make a different modification to the -algorithm that `diff' uses. If the input files have a constant small -density of changes, this option speeds up the comparisons without -changing the output. If not, `diff' might produce a larger set of -differences; however, the output will still be correct. - - Normally `diff' discards the prefix and suffix that is common to -both files before it attempts to find a minimal set of differences. -This makes `diff' run faster, but occasionally it may produce -non-minimal output. The `--horizon-lines=LINES' option prevents `diff' -from discarding the last LINES lines of the prefix and the first LINES -lines of the suffix. This gives `diff' further opportunities to find a -minimal output. - - -File: diff.info, Node: Comparing Three Files, Next: diff3 Merging, Prev: diff Performance, Up: Top - -Comparing Three Files -********************* - - Use the program `diff3' to compare three files and show any -differences among them. (`diff3' can also merge files; see *Note diff3 -Merging::). - - The "normal" `diff3' output format shows each hunk of differences -without surrounding context. Hunks are labeled depending on whether -they are two-way or three-way, and lines are annotated by their -location in the input files. - - *Note Invoking diff3::, for more information on how to run `diff3'. - -* Menu: - -* Sample diff3 Input:: Sample `diff3' input for examples. -* Detailed diff3 Normal:: A detailed description of normal output format. -* diff3 Hunks:: The format of normal output format. -* Example diff3 Normal:: Sample output in the normal format. - - -File: diff.info, Node: Sample diff3 Input, Next: Detailed diff3 Normal, Up: Comparing Three Files - -A Third Sample Input File -========================= - - Here is a third sample file that will be used in examples to -illustrate the output of `diff3' and how various options can change it. -The first two files are the same that we used for `diff' (*note Sample -diff Input::.). This is the third sample file, called `tao': - - The Way that can be told of is not the eternal Way; - The name that can be named is not the eternal name. - The Nameless is the origin of Heaven and Earth; - The named is the mother of all things. - - Therefore let there always be non-being, - so we may see their subtlety, - And let there always be being, - so we may see their result. - The two are the same, - But after they are produced, - they have different names. - - -- The Way of Lao-Tzu, tr. Wing-tsit Chan - - -File: diff.info, Node: Detailed diff3 Normal, Next: diff3 Hunks, Prev: Sample diff3 Input, Up: Comparing Three Files - -Detailed Description of `diff3' Normal Format -============================================= - - Each hunk begins with a line marked `===='. Three-way hunks have -plain `====' lines, and two-way hunks have `1', `2', or `3' appended to -specify which of the three input files differ in that hunk. The hunks -contain copies of two or three sets of input lines each preceded by one -or two commands identifying where the lines came from. - - Normally, two spaces precede each copy of an input line to -distinguish it from the commands. But with the `-T' or `--initial-tab' -option, `diff3' uses a tab instead of two spaces; this lines up tabs -correctly. *Note Tabs::, for more information. - - Commands take the following forms: - -`FILE:La' - This hunk appears after line L of file FILE, and contains no lines - in that file. To edit this file to yield the other files, one - must append hunk lines taken from the other files. For example, - `1:11a' means that the hunk follows line 11 in the first file and - contains no lines from that file. - -`FILE:Rc' - This hunk contains the lines in the range R of file FILE. The - range R is a comma-separated pair of line numbers, or just one - number if the range is a singleton. To edit this file to yield the - other files, one must change the specified lines to be the lines - taken from the other files. For example, `2:11,13c' means that - the hunk contains lines 11 through 13 from the second file. - - If the last line in a set of input lines is incomplete (*note -Incomplete Lines::.), it is distinguished on output from a full line by -a following line that starts with `\'. - - -File: diff.info, Node: diff3 Hunks, Next: Example diff3 Normal, Prev: Detailed diff3 Normal, Up: Comparing Three Files - -`diff3' Hunks -============= - - Groups of lines that differ in two or three of the input files are -called "diff3 hunks", by analogy with `diff' hunks (*note Hunks::.). -If all three input files differ in a `diff3' hunk, the hunk is called a -"three-way hunk"; if just two input files differ, it is a "two-way -hunk". - - As with `diff', several solutions are possible. When comparing the -files `A', `B', and `C', `diff3' normally finds `diff3' hunks by -merging the two-way hunks output by the two commands `diff A B' and -`diff A C'. This does not necessarily minimize the size of the output, -but exceptions should be rare. - - For example, suppose `F' contains the three lines `a', `b', `f', `G' -contains the lines `g', `b', `g', and `H' contains the lines `a', `b', -`h'. `diff3 F G H' might output the following: - - ====2 - 1:1c - 3:1c - a - 2:1c - g - ==== - 1:3c - f - 2:3c - g - 3:3c - h - -because it found a two-way hunk containing `a' in the first and third -files and `g' in the second file, then the single line `b' common to -all three files, then a three-way hunk containing the last line of each -file. - - -File: diff.info, Node: Example diff3 Normal, Prev: diff3 Hunks, Up: Comparing Three Files - -An Example of `diff3' Normal Format -=================================== - - Here is the output of the command `diff3 lao tzu tao' (*note Sample -diff3 Input::., for the complete contents of the files). Notice that -it shows only the lines that are different among the three files. - - ====2 - 1:1,2c - 3:1,2c - The Way that can be told of is not the eternal Way; - The name that can be named is not the eternal name. - 2:0a - ====1 - 1:4c - The Named is the mother of all things. - 2:2,3c - 3:4,5c - The named is the mother of all things. - - ====3 - 1:8c - 2:7c - so we may see their outcome. - 3:9c - so we may see their result. - ==== - 1:11a - 2:11,13c - They both may be called deep and profound. - Deeper and more profound, - The door of all subtleties! - 3:13,14c - - -- The Way of Lao-Tzu, tr. Wing-tsit Chan - - -File: diff.info, Node: diff3 Merging, Next: Interactive Merging, Prev: Comparing Three Files, Up: Top - -Merging From a Common Ancestor -****************************** - - When two people have made changes to copies of the same file, -`diff3' can produce a merged output that contains both sets of changes -together with warnings about conflicts. - - One might imagine programs with names like `diff4' and `diff5' to -compare more than three files simultaneously, but in practice the need -rarely arises. You can use `diff3' to merge three or more sets of -changes to a file by merging two change sets at a time. - - `diff3' can incorporate changes from two modified versions into a -common preceding version. This lets you merge the sets of changes -represented by the two newer files. Specify the common ancestor version -as the second argument and the two newer versions as the first and third -arguments, like this: - - diff3 MINE OLDER YOURS - -You can remember the order of the arguments by noting that they are in -alphabetical order. - - You can think of this as subtracting OLDER from YOURS and adding the -result to MINE, or as merging into MINE the changes that would turn -OLDER into YOURS. This merging is well-defined as long as MINE and -OLDER match in the neighborhood of each such change. This fails to be -true when all three input files differ or when only OLDER differs; we -call this a "conflict". When all three input files differ, we call the -conflict an "overlap". - - `diff3' gives you several ways to handle overlaps and conflicts. -You can omit overlaps or conflicts, or select only overlaps, or mark -conflicts with special `<<<<<<<' and `>>>>>>>' lines. - - `diff3' can output the merge results as an `ed' script that that can -be applied to the first file to yield the merged output. However, it -is usually better to have `diff3' generate the merged output directly; -this bypasses some problems with `ed'. - -* Menu: - -* Which Changes:: Selecting changes to incorporate. -* Marking Conflicts:: Marking conflicts. -* Bypassing ed:: Generating merged output directly. -* Merging Incomplete Lines:: How `diff3' merges incomplete lines. -* Saving the Changed File:: Emulating System V behavior. - - -File: diff.info, Node: Which Changes, Next: Marking Conflicts, Up: diff3 Merging - -Selecting Which Changes to Incorporate -====================================== - - You can select all unmerged changes from OLDER to YOURS for merging -into MINE with the `-e' or `--ed' option. You can select only the -nonoverlapping unmerged changes with `-3' or `--easy-only', and you can -select only the overlapping changes with `-x' or `--overlap-only'. - - The `-e', `-3' and `-x' options select only "unmerged changes", i.e. -changes where MINE and YOURS differ; they ignore changes from OLDER to -YOURS where MINE and YOURS are identical, because they assume that such -changes have already been merged. If this assumption is not a safe -one, you can use the `-A' or `--show-all' option (*note Marking -Conflicts::.). - - Here is the output of the command `diff3' with each of these three -options (*note Sample diff3 Input::., for the complete contents of the -files). Notice that `-e' outputs the union of the disjoint sets of -changes output by `-3' and `-x'. - - Output of `diff3 -e lao tzu tao': - 11a - - -- The Way of Lao-Tzu, tr. Wing-tsit Chan - . - 8c - so we may see their result. - . - - Output of `diff3 -3 lao tzu tao': - 8c - so we may see their result. - . - - Output of `diff3 -x lao tzu tao': - 11a - - -- The Way of Lao-Tzu, tr. Wing-tsit Chan - . - - -File: diff.info, Node: Marking Conflicts, Next: Bypassing ed, Prev: Which Changes, Up: diff3 Merging - -Marking Conflicts -================= - - `diff3' can mark conflicts in the merged output by bracketing them -with special marker lines. A conflict that comes from two files A and -B is marked as follows: - - <<<<<<< A - lines from A - ======= - lines from B - >>>>>>> B - - A conflict that comes from three files A, B and C is marked as -follows: - - <<<<<<< A - lines from A - ||||||| B - lines from B - ======= - lines from C - >>>>>>> C - - The `-A' or `--show-all' option acts like the `-e' option, except -that it brackets conflicts, and it outputs all changes from OLDER to -YOURS, not just the unmerged changes. Thus, given the sample input -files (*note Sample diff3 Input::.), `diff3 -A lao tzu tao' puts -brackets around the conflict where only `tzu' differs: - - <<<<<<< tzu - ======= - The Way that can be told of is not the eternal Way; - The name that can be named is not the eternal name. - >>>>>>> tao - - And it outputs the three-way conflict as follows: - - <<<<<<< lao - ||||||| tzu - They both may be called deep and profound. - Deeper and more profound, - The door of all subtleties! - ======= - - -- The Way of Lao-Tzu, tr. Wing-tsit Chan - >>>>>>> tao - - The `-E' or `--show-overlap' option outputs less information than -the `-A' or `--show-all' option, because it outputs only unmerged -changes, and it never outputs the contents of the second file. Thus -the `-E' option acts like the `-e' option, except that it brackets the -first and third files from three-way overlapping changes. Similarly, -`-X' acts like `-x', except it brackets all its (necessarily -overlapping) changes. For example, for the three-way overlapping -change above, the `-E' and `-X' options output the following: - - <<<<<<< lao - ======= - - -- The Way of Lao-Tzu, tr. Wing-tsit Chan - >>>>>>> tao - - If you are comparing files that have meaningless or uninformative -names, you can use the `-L LABEL' or `--label=LABEL' option to show -alternate names in the `<<<<<<<', `|||||||' and `>>>>>>>' brackets. -This option can be given up to three times, once for each input file. -Thus `diff3 -A -L X -L Y -L Z A B C' acts like `diff3 -A A B C', except -that the output looks like it came from files named `X', `Y' and `Z' -rather than from files named `A', `B' and `C'. - - -File: diff.info, Node: Bypassing ed, Next: Merging Incomplete Lines, Prev: Marking Conflicts, Up: diff3 Merging - -Generating the Merged Output Directly -===================================== - - With the `-m' or `--merge' option, `diff3' outputs the merged file -directly. This is more efficient than using `ed' to generate it, and -works even with non-text files that `ed' would reject. If you specify -`-m' without an `ed' script option, `-A' (`--show-all') is assumed. - - For example, the command `diff3 -m lao tzu tao' (*note Sample diff3 -Input::. for a copy of the input files) would output the following: - - <<<<<<< tzu - ======= - The Way that can be told of is not the eternal Way; - The name that can be named is not the eternal name. - >>>>>>> tao - The Nameless is the origin of Heaven and Earth; - The Named is the mother of all things. - Therefore let there always be non-being, - so we may see their subtlety, - And let there always be being, - so we may see their result. - The two are the same, - But after they are produced, - they have different names. - <<<<<<< lao - ||||||| tzu - They both may be called deep and profound. - Deeper and more profound, - The door of all subtleties! - ======= - - -- The Way of Lao-Tzu, tr. Wing-tsit Chan - >>>>>>> tao - - -File: diff.info, Node: Merging Incomplete Lines, Next: Saving the Changed File, Prev: Bypassing ed, Up: diff3 Merging - -How `diff3' Merges Incomplete Lines -=================================== - - With `-m', incomplete lines (*note Incomplete Lines::.) are simply -copied to the output as they are found; if the merged output ends in an -conflict and one of the input files ends in an incomplete line, -succeeding `|||||||', `=======' or `>>>>>>>' brackets appear somewhere -other than the start of a line because they are appended to the -incomplete line. - - Without `-m', if an `ed' script option is specified and an -incomplete line is found, `diff3' generates a warning and acts as if a -newline had been present. - - -File: diff.info, Node: Saving the Changed File, Prev: Merging Incomplete Lines, Up: diff3 Merging - -Saving the Changed File -======================= - - Traditional Unix `diff3' generates an `ed' script without the -trailing `w' and and `q' commands that save the changes. System V -`diff3' generates these extra commands. GNU `diff3' normally behaves -like traditional Unix `diff3', but with the `-i' option it behaves like -System V `diff3' and appends the `w' and `q' commands. - - The `-i' option requires one of the `ed' script options `-AeExX3', -and is incompatible with the merged output option `-m'. - - -File: diff.info, Node: Interactive Merging, Next: Merging with patch, Prev: diff3 Merging, Up: Top - -Interactive Merging with `sdiff' -******************************** - - With `sdiff', you can merge two files interactively based on a -side-by-side `-y' format comparison (*note Side by Side::.). Use `-o -FILE' or `--output=FILE' to specify where to put the merged text. -*Note Invoking sdiff::, for more details on the options to `sdiff'. - - Another way to merge files interactively is to use the Emacs Lisp -package `emerge'. *Note emerge: (emacs)emerge, for more information. - -* Menu: - -* sdiff Option Summary::Summary of `sdiff' options. -* Merge Commands:: Merging two files interactively. - - -File: diff.info, Node: sdiff Option Summary, Next: Merge Commands, Up: Interactive Merging - -Specifying `diff' Options to `sdiff' -==================================== - - The following `sdiff' options have the same meaning as for `diff'. -*Note diff Options::, for the use of these options. - - -a -b -d -i -t -v - -B -H -I REGEXP - - --ignore-blank-lines --ignore-case - --ignore-matching-lines=REGEXP --ignore-space-change - --left-column --minimal --speed-large-files - --suppress-common-lines --expand-tabs - --text --version --width=COLUMNS - - For historical reasons, `sdiff' has alternate names for some -options. The `-l' option is equivalent to the `--left-column' option, -and similarly `-s' is equivalent to `--suppress-common-lines'. The -meaning of the `sdiff' `-w' and `-W' options is interchanged from that -of `diff': with `sdiff', `-w COLUMNS' is equivalent to -`--width=COLUMNS', and `-W' is equivalent to `--ignore-all-space'. -`sdiff' without the `-o' option is equivalent to `diff' with the `-y' -or `--side-by-side' option (*note Side by Side::.). - - -File: diff.info, Node: Merge Commands, Prev: sdiff Option Summary, Up: Interactive Merging - -Merge Commands -============== - - Groups of common lines, with a blank gutter, are copied from the -first file to the output. After each group of differing lines, `sdiff' -prompts with `%' and pauses, waiting for one of the following commands. -Follow each command with RET. - -`e' - Discard both versions. Invoke a text editor on an empty temporary - file, then copy the resulting file to the output. - -`eb' - Concatenate the two versions, edit the result in a temporary file, - then copy the edited result to the output. - -`el' - Edit a copy of the left version, then copy the result to the - output. - -`er' - Edit a copy of the right version, then copy the result to the - output. - -`l' - Copy the left version to the output. - -`q' - Quit. - -`r' - Copy the right version to the output. - -`s' - Silently copy common lines. - -`v' - Verbosely copy common lines. This is the default. - - The text editor invoked is specified by the `EDITOR' environment -variable if it is set. The default is system-dependent. - - -File: diff.info, Node: Merging with patch, Next: Making Patches, Prev: Interactive Merging, Up: Top - -Merging with `patch' -******************** - - `patch' takes comparison output produced by `diff' and applies the -differences to a copy of the original file, producing a patched -version. With `patch', you can distribute just the changes to a set of -files instead of distributing the entire file set; your correspondents -can apply `patch' to update their copy of the files with your changes. -`patch' automatically determines the diff format, skips any leading or -trailing headers, and uses the headers to determine which file to -patch. This lets your correspondents feed an article or message -containing a difference listing directly to `patch'. - - `patch' detects and warns about common problems like forward -patches. It saves the original version of the files it patches, and -saves any patches that it could not apply. It can also maintain a -`patchlevel.h' file to ensures that your correspondents apply diffs in -the proper order. - - `patch' accepts a series of diffs in its standard input, usually -separated by headers that specify which file to patch. It applies -`diff' hunks (*note Hunks::.) one by one. If a hunk does not exactly -match the original file, `patch' uses heuristics to try to patch the -file as well as it can. If no approximate match can be found, `patch' -rejects the hunk and skips to the next hunk. `patch' normally replaces -each file F with its new version, saving the original file in `F.orig', -and putting reject hunks (if any) into `F.rej'. - - *Note Invoking patch::, for detailed information on the options to -`patch'. *Note Backups::, for more information on how `patch' names -backup files. *Note Rejects::, for more information on where `patch' -puts reject hunks. - -* Menu: - -* patch Input:: Selecting the type of `patch' input. -* Imperfect:: Dealing with imperfect patches. -* Empty Files:: Removing empty files after patching. -* Multiple Patches:: Handling multiple patches in a file specially. -* patch Messages:: Messages and questions `patch' can produce. - - -File: diff.info, Node: patch Input, Next: Imperfect, Up: Merging with patch - -Selecting the `patch' Input Format -================================== - - `patch' normally determines which `diff' format the patch file uses -by examining its contents. For patch files that contain particularly -confusing leading text, you might need to use one of the following -options to force `patch' to interpret the patch file as a certain -format of diff. The output formats listed here are the only ones that -`patch' can understand. - -`-c' -`--context' - context diff. - -`-e' -`--ed' - `ed' script. - -`-n' -`--normal' - normal diff. - -`-u' -`--unified' - unified diff. - - -File: diff.info, Node: Imperfect, Next: Empty Files, Prev: patch Input, Up: Merging with patch - -Applying Imperfect Patches -========================== - - `patch' tries to skip any leading text in the patch file, apply the -diff, and then skip any trailing text. Thus you can feed a news article -or mail message directly to `patch', and it should work. If the entire -diff is indented by a constant amount of white space, `patch' -automatically ignores the indentation. - - However, certain other types of imperfect input require user -intervention. - -* Menu: - -* Changed White Space:: When tabs and spaces don't match exactly. -* Reversed Patches:: Applying reversed patches correctly. -* Inexact:: Helping `patch' find close matches. - - -File: diff.info, Node: Changed White Space, Next: Reversed Patches, Up: Imperfect - -Applying Patches with Changed White Space ------------------------------------------ - - Sometimes mailers, editors, or other programs change spaces into -tabs, or vice versa. If this happens to a patch file or an input file, -the files might look the same, but `patch' will not be able to match -them properly. If this problem occurs, use the `-l' or -`--ignore-white-space' option, which makes `patch' compare white space -loosely so that any sequence of white space in the patch file matches -any sequence of white space in the input files. Non-white-space -characters must still match exactly. Each line of the context must -still match a line in the input file. - - -File: diff.info, Node: Reversed Patches, Next: Inexact, Prev: Changed White Space, Up: Imperfect - -Applying Reversed Patches -------------------------- - - Sometimes people run `diff' with the new file first instead of -second. This creates a diff that is "reversed". To apply such -patches, give `patch' the `-R' or `--reverse' option. `patch' then -attempts to swap each hunk around before applying it. Rejects come out -in the swapped format. The `-R' option does not work with `ed' scripts -because there is too little information in them to reconstruct the -reverse operation. - - Often `patch' can guess that the patch is reversed. If the first -hunk of a patch fails, `patch' reverses the hunk to see if it can apply -it that way. If it can, `patch' asks you if you want to have the `-R' -option set; if it can't, `patch' continues to apply the patch normally. -This method cannot detect a reversed patch if it is a normal diff and -the first command is an append (which should have been a delete) since -appends always succeed, because a null context matches anywhere. But -most patches add or change lines rather than delete them, so most -reversed normal diffs begin with a delete, which fails, and `patch' -notices. - - If you apply a patch that you have already applied, `patch' thinks -it is a reversed patch and offers to un-apply the patch. This could be -construed as a feature. If you did this inadvertently and you don't -want to un-apply the patch, just answer `n' to this offer and to the -subsequent "apply anyway" question--or type `C-c' to kill the `patch' -process. - - -File: diff.info, Node: Inexact, Prev: Reversed Patches, Up: Imperfect - -Helping `patch' Find Inexact Matches ------------------------------------- - - For context diffs, and to a lesser extent normal diffs, `patch' can -detect when the line numbers mentioned in the patch are incorrect, and -it attempts to find the correct place to apply each hunk of the patch. -As a first guess, it takes the line number mentioned in the hunk, plus -or minus any offset used in applying the previous hunk. If that is not -the correct place, `patch' scans both forward and backward for a set of -lines matching the context given in the hunk. - - First `patch' looks for a place where all lines of the context -match. If it cannot find such a place, and it is reading a context or -unified diff, and the maximum fuzz factor is set to 1 or more, then -`patch' makes another scan, ignoring the first and last line of -context. If that fails, and the maximum fuzz factor is set to 2 or -more, it makes another scan, ignoring the first two and last two lines -of context are ignored. It continues similarly if the maximum fuzz -factor is larger. - - The `-F LINES' or `--fuzz=LINES' option sets the maximum fuzz factor -to LINES. This option only applies to context and unified diffs; it -ignores up to LINES lines while looking for the place to install a -hunk. Note that a larger fuzz factor increases the odds of making a -faulty patch. The default fuzz factor is 2; it may not be set to more -than the number of lines of context in the diff, ordinarily 3. - - If `patch' cannot find a place to install a hunk of the patch, it -writes the hunk out to a reject file (*note Rejects::., for information -on how reject files are named). It writes out rejected hunks in context -format no matter what form the input patch is in. If the input is a -normal or `ed' diff, many of the contexts are simply null. The line -numbers on the hunks in the reject file may be different from those in -the patch file: they show the approximate location where `patch' thinks -the failed hunks belong in the new file rather than in the old one. - - As it completes each hunk, `patch' tells you whether the hunk -succeeded or failed, and if it failed, on which line (in the new file) -`patch' thinks the hunk should go. If this is different from the line -number specified in the diff, it tells you the offset. A single large -offset *may* indicate that `patch' installed a hunk in the wrong place. -`patch' also tells you if it used a fuzz factor to make the match, in -which case you should also be slightly suspicious. - - `patch' cannot tell if the line numbers are off in an `ed' script, -and can only detect wrong line numbers in a normal diff when it finds a -change or delete command. It may have the same problem with a context -diff using a fuzz factor equal to or greater than the number of lines -of context shown in the diff (typically 3). In these cases, you should -probably look at a context diff between your original and patched input -files to see if the changes make sense. Compiling without errors is a -pretty good indication that the patch worked, but not a guarantee. - - `patch' usually produces the correct results, even when it must make -many guesses. However, the results are guaranteed only when the patch -is applied to an exact copy of the file that the patch was generated -from. - - -File: diff.info, Node: Empty Files, Next: Multiple Patches, Prev: Imperfect, Up: Merging with patch - -Removing Empty Files -==================== - - Sometimes when comparing two directories, the first directory -contains a file that the second directory does not. If you give `diff' -the `-N' or `--new-file' option, it outputs a diff that deletes the -contents of this file. By default, `patch' leaves an empty file after -applying such a diff. The `-E' or `--remove-empty-files' option to -`patch' deletes output files that are empty after applying the diff. - - -File: diff.info, Node: Multiple Patches, Next: patch Messages, Prev: Empty Files, Up: Merging with patch - -Multiple Patches in a File -========================== - - If the patch file contains more than one patch, `patch' tries to -apply each of them as if they came from separate patch files. This -means that it determines the name of the file to patch for each patch, -and that it examines the leading text before each patch for file names -and prerequisite revision level (*note Making Patches::., for more on -that topic). - - For the second and subsequent patches in the patch file, you can give -options and another original file name by separating their argument -lists with a `+'. However, the argument list for a second or -subsequent patch may not specify a new patch file, since that does not -make sense. - - For example, to tell `patch' to strip the first three slashes from -the name of the first patch in the patch file and none from subsequent -patches, and to use `code.c' as the first input file, you can use: - - patch -p3 code.c + -p0 < patchfile - - The `-S' or `--skip' option ignores the current patch from the patch -file, but continue looking for the next patch in the file. Thus, to -ignore the first and third patches in the patch file, you can use: - - patch -S + + -S + < patch file - - -File: diff.info, Node: patch Messages, Prev: Multiple Patches, Up: Merging with patch - -Messages and Questions from `patch' -=================================== - - `patch' can produce a variety of messages, especially if it has -trouble decoding its input. In a few situations where it's not sure how -to proceed, `patch' normally prompts you for more information from the -keyboard. There are options to suppress printing non-fatal messages -and stopping for keyboard input. - - The message `Hmm...' indicates that `patch' is reading text in the -patch file, attempting to determine whether there is a patch in that -text, and if so, what kind of patch it is. - - You can inhibit all terminal output from `patch', unless an error -occurs, by using the `-s', `--quiet', or `--silent' option. - - There are two ways you can prevent `patch' from asking you any -questions. The `-f' or `--force' option assumes that you know what you -are doing. It assumes the following: - - * skip patches that do not contain file names in their headers; - - * patch files even though they have the wrong version for the - `Prereq:' line in the patch; - - * assume that patches are not reversed even if they look like they - are. - - The `-t' or `--batch' option is similar to `-f', in that it -suppresses questions, but it makes somewhat different assumptions: - - * skip patches that do not contain file names in their headers (the - same as `-f'); - - * skip patches for which the file has the wrong version for the - `Prereq:' line in the patch; - - * assume that patches are reversed if they look like they are. - - `patch' exits with a non-zero status if it creates any reject files. -When applying a set of patches in a loop, you should check the exit -status, so you don't apply a later patch to a partially patched file. - diff --git a/gnu/dist/diffutils/diff.info-3 b/gnu/dist/diffutils/diff.info-3 deleted file mode 100644 index 71bf86972d2..00000000000 --- a/gnu/dist/diffutils/diff.info-3 +++ /dev/null @@ -1,1327 +0,0 @@ -This is Info file diff.info, produced by Makeinfo-1.55 from the input -file ./diff.texi. - - This file documents the the GNU `diff', `diff3', `sdiff', and `cmp' -commands for showing the differences between text files and the `patch' -command for using their output to update files. - - Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. - - Permission is granted to make and distribute verbatim copies of this -manual provided the copyright notice and this permission notice are -preserved on all copies. - - Permission is granted to copy and distribute modified versions of -this manual under the conditions for verbatim copying, provided that -the entire resulting derived work is distributed under the terms of a -permission notice identical to this one. - - Permission is granted to copy and distribute translations of this -manual into another language, under the above conditions for modified -versions, except that this permission notice may be stated in a -translation approved by the Foundation. - - -File: diff.info, Node: Making Patches, Next: Invoking cmp, Prev: Merging with patch, Up: Top - -Tips for Making Patch Distributions -*********************************** - - Here are some things you should keep in mind if you are going to -distribute patches for updating a software package. - - Make sure you have specified the file names correctly, either in a -context diff header or with an `Index:' line. If you are patching -files in a subdirectory, be sure to tell the patch user to specify a -`-p' or `--strip' option as needed. Take care to not send out reversed -patches, since these make people wonder whether they have already -applied the patch. - - To save people from partially applying a patch before other patches -that should have gone before it, you can make the first patch in the -patch file update a file with a name like `patchlevel.h' or -`version.c', which contains a patch level or version number. If the -input file contains the wrong version number, `patch' will complain -immediately. - - An even clearer way to prevent this problem is to put a `Prereq:' -line before the patch. If the leading text in the patch file contains a -line that starts with `Prereq:', `patch' takes the next word from that -line (normally a version number) and checks whether the next input file -contains that word, preceded and followed by either white space or a -newline. If not, `patch' prompts you for confirmation before -proceeding. This makes it difficult to accidentally apply patches in -the wrong order. - - Since `patch' does not handle incomplete lines properly, make sure -that all the source files in your program end with a newline whenever -you release a version. - - To create a patch that changes an older version of a package into a -newer version, first make a copy of the older version in a scratch -directory. Typically you do that by unpacking a `tar' or `shar' -archive of the older version. - - You might be able to reduce the size of the patch by renaming or -removing some files before making the patch. If the older version of -the package contains any files that the newer version does not, or if -any files have been renamed between the two versions, make a list of -`rm' and `mv' commands for the user to execute in the old version -directory before applying the patch. Then run those commands yourself -in the scratch directory. - - If there are any files that you don't need to include in the patch -because they can easily be rebuilt from other files (for example, -`TAGS' and output from `yacc' and `makeinfo'), replace the versions in -the scratch directory with the newer versions, using `rm' and `ln' or -`cp'. - - Now you can create the patch. The de-facto standard `diff' format -for patch distributions is context format with two lines of context, -produced by giving `diff' the `-C 2' option. Do not use less than two -lines of context, because `patch' typically needs at least two lines -for proper operation. Give `diff' the `-P' option in case the newer -version of the package contains any files that the older one does not. -Make sure to specify the scratch directory first and the newer -directory second. - - Add to the top of the patch a note telling the user any `rm' and -`mv' commands to run before applying the patch. Then you can remove -the scratch directory. - - -File: diff.info, Node: Invoking cmp, Next: Invoking diff, Prev: Making Patches, Up: Top - -Invoking `cmp' -************** - - The `cmp' command compares two files, and if they differ, tells the -first byte and line number where they differ. Its arguments are as -follows: - - cmp OPTIONS... FROM-FILE [TO-FILE] - - The file name `-' is always the standard input. `cmp' also uses the -standard input if one file name is omitted. - - An exit status of 0 means no differences were found, 1 means some -differences were found, and 2 means trouble. - -* Menu: - -* cmp Options:: Summary of options to `cmp'. - - -File: diff.info, Node: cmp Options, Up: Invoking cmp - -Options to `cmp' -================ - - Below is a summary of all of the options that GNU `cmp' accepts. -Most options have two equivalent names, one of which is a single letter -preceded by `-', and the other of which is a long name preceded by -`--'. Multiple single letter options (unless they take an argument) -can be combined into a single command line word: `-cl' is equivalent to -`-c -l'. - -`-c' - Print the differing characters. Display control characters as a - `^' followed by a letter of the alphabet and precede characters - that have the high bit set with `M-' (which stands for "meta"). - -`--ignore-initial=BYTES' - Ignore any differences in the the first BYTES bytes of the input - files. Treat files with fewer than BYTES bytes as if they are - empty. - -`-l' - Print the (decimal) offsets and (octal) values of all differing - bytes. - -`--print-chars' - Print the differing characters. Display control characters as a - `^' followed by a letter of the alphabet and precede characters - that have the high bit set with `M-' (which stands for "meta"). - -`--quiet' -`-s' -`--silent' - Do not print anything; only return an exit status indicating - whether the files differ. - -`--verbose' - Print the (decimal) offsets and (octal) values of all differing - bytes. - -`-v' -`--version' - Output the version number of `cmp'. - - -File: diff.info, Node: Invoking diff, Next: Invoking diff3, Prev: Invoking cmp, Up: Top - -Invoking `diff' -*************** - - The format for running the `diff' command is: - - diff OPTIONS... FROM-FILE TO-FILE - - In the simplest case, `diff' compares the contents of the two files -FROM-FILE and TO-FILE. A file name of `-' stands for text read from -the standard input. As a special case, `diff - -' compares a copy of -standard input to itself. - - If FROM-FILE is a directory and TO-FILE is not, `diff' compares the -file in FROM-FILE whose file name is that of TO-FILE, and vice versa. -The non-directory file must not be `-'. - - If both FROM-FILE and TO-FILE are directories, `diff' compares -corresponding files in both directories, in alphabetical order; this -comparison is not recursive unless the `-r' or `--recursive' option is -given. `diff' never compares the actual contents of a directory as if -it were a file. The file that is fully specified may not be standard -input, because standard input is nameless and the notion of "file with -the same name" does not apply. - - `diff' options begin with `-', so normally FROM-FILE and TO-FILE may -not begin with `-'. However, `--' as an argument by itself treats the -remaining arguments as file names even if they begin with `-'. - - An exit status of 0 means no differences were found, 1 means some -differences were found, and 2 means trouble. - -* Menu: - -* diff Options:: Summary of options to `diff'. - - -File: diff.info, Node: diff Options, Up: Invoking diff - -Options to `diff' -================= - - Below is a summary of all of the options that GNU `diff' accepts. -Most options have two equivalent names, one of which is a single letter -preceded by `-', and the other of which is a long name preceded by -`--'. Multiple single letter options (unless they take an argument) -can be combined into a single command line word: `-ac' is equivalent to -`-a -c'. Long named options can be abbreviated to any unique prefix of -their name. Brackets ([ and ]) indicate that an option takes an -optional argument. - -`-LINES' - Show LINES (an integer) lines of context. This option does not - specify an output format by itself; it has no effect unless it is - combined with `-c' (*note Context Format::.) or `-u' (*note - Unified Format::.). This option is obsolete. For proper - operation, `patch' typically needs at least two lines of context. - -`-a' - Treat all files as text and compare them line-by-line, even if they - do not seem to be text. *Note Binary::. - -`-b' - Ignore changes in amount of white space. *Note White Space::. - -`-B' - Ignore changes that just insert or delete blank lines. *Note - Blank Lines::. - -`--binary' - Read and write data in binary mode. *Note Binary::. - -`--brief' - Report only whether the files differ, not the details of the - differences. *Note Brief::. - -`-c' - Use the context output format. *Note Context Format::. - -`-C LINES' -`--context[=LINES]' - Use the context output format, showing LINES (an integer) lines of - context, or three if LINES is not given. *Note Context Format::. - For proper operation, `patch' typically needs at least two lines of - context. - -`--changed-group-format=FORMAT' - Use FORMAT to output a line group containing differing lines from - both files in if-then-else format. *Note Line Group Formats::. - -`-d' - Change the algorithm perhaps find a smaller set of changes. This - makes `diff' slower (sometimes much slower). *Note diff - Performance::. - -`-D NAME' - Make merged `#ifdef' format output, conditional on the preprocessor - macro NAME. *Note If-then-else::. - -`-e' -`--ed' - Make output that is a valid `ed' script. *Note ed Scripts::. - -`--exclude=PATTERN' - When comparing directories, ignore files and subdirectories whose - basenames match PATTERN. *Note Comparing Directories::. - -`--exclude-from=FILE' - When comparing directories, ignore files and subdirectories whose - basenames match any pattern contained in FILE. *Note Comparing - Directories::. - -`--expand-tabs' - Expand tabs to spaces in the output, to preserve the alignment of - tabs in the input files. *Note Tabs::. - -`-f' - Make output that looks vaguely like an `ed' script but has changes - in the order they appear in the file. *Note Forward ed::. - -`-F REGEXP' - In context and unified format, for each hunk of differences, show - some of the last preceding line that matches REGEXP. *Note - Specified Headings::. - -`--forward-ed' - Make output that looks vaguely like an `ed' script but has changes - in the order they appear in the file. *Note Forward ed::. - -`-h' - This option currently has no effect; it is present for Unix - compatibility. - -`-H' - Use heuristics to speed handling of large files that have numerous - scattered small changes. *Note diff Performance::. - -`--horizon-lines=LINES' - Do not discard the last LINES lines of the common prefix and the - first LINES lines of the common suffix. *Note diff Performance::. - -`-i' - Ignore changes in case; consider upper- and lower-case letters - equivalent. *Note Case Folding::. - -`-I REGEXP' - Ignore changes that just insert or delete lines that match REGEXP. - *Note Specified Folding::. - -`--ifdef=NAME' - Make merged if-then-else output using NAME. *Note If-then-else::. - -`--ignore-all-space' - Ignore white space when comparing lines. *Note White Space::. - -`--ignore-blank-lines' - Ignore changes that just insert or delete blank lines. *Note - Blank Lines::. - -`--ignore-case' - Ignore changes in case; consider upper- and lower-case to be the - same. *Note Case Folding::. - -`--ignore-matching-lines=REGEXP' - Ignore changes that just insert or delete lines that match REGEXP. - *Note Specified Folding::. - -`--ignore-space-change' - Ignore changes in amount of white space. *Note White Space::. - -`--initial-tab' - Output a tab rather than a space before the text of a line in - normal or context format. This causes the alignment of tabs in - the line to look normal. *Note Tabs::. - -`-l' - Pass the output through `pr' to paginate it. *Note Pagination::. - -`-L LABEL' - Use LABEL instead of the file name in the context format (*note - Context Format::.) and unified format (*note Unified Format::.) - headers. *Note RCS::. - -`--label=LABEL' - Use LABEL instead of the file name in the context format (*note - Context Format::.) and unified format (*note Unified Format::.) - headers. - -`--left-column' - Print only the left column of two common lines in side by side - format. *Note Side by Side Format::. - -`--line-format=FORMAT' - Use FORMAT to output all input lines in if-then-else format. - *Note Line Formats::. - -`--minimal' - Change the algorithm to perhaps find a smaller set of changes. - This makes `diff' slower (sometimes much slower). *Note diff - Performance::. - -`-n' - Output RCS-format diffs; like `-f' except that each command - specifies the number of lines affected. *Note RCS::. - -`-N' -`--new-file' - In directory comparison, if a file is found in only one directory, - treat it as present but empty in the other directory. *Note - Comparing Directories::. - -`--new-group-format=FORMAT' - Use FORMAT to output a group of lines taken from just the second - file in if-then-else format. *Note Line Group Formats::. - -`--new-line-format=FORMAT' - Use FORMAT to output a line taken from just the second file in - if-then-else format. *Note Line Formats::. - -`--old-group-format=FORMAT' - Use FORMAT to output a group of lines taken from just the first - file in if-then-else format. *Note Line Group Formats::. - -`--old-line-format=FORMAT' - Use FORMAT to output a line taken from just the first file in - if-then-else format. *Note Line Formats::. - -`-p' - Show which C function each change is in. *Note C Function - Headings::. - -`-P' - When comparing directories, if a file appears only in the second - directory of the two, treat it as present but empty in the other. - *Note Comparing Directories::. - -`--paginate' - Pass the output through `pr' to paginate it. *Note Pagination::. - -`-q' - Report only whether the files differ, not the details of the - differences. *Note Brief::. - -`-r' - When comparing directories, recursively compare any subdirectories - found. *Note Comparing Directories::. - -`--rcs' - Output RCS-format diffs; like `-f' except that each command - specifies the number of lines affected. *Note RCS::. - -`--recursive' - When comparing directories, recursively compare any subdirectories - found. *Note Comparing Directories::. - -`--report-identical-files' - Report when two files are the same. *Note Comparing Directories::. - -`-s' - Report when two files are the same. *Note Comparing Directories::. - -`-S FILE' - When comparing directories, start with the file FILE. This is - used for resuming an aborted comparison. *Note Comparing - Directories::. - -`--sdiff-merge-assist' - Print extra information to help `sdiff'. `sdiff' uses this option - when it runs `diff'. This option is not intended for users to use - directly. - -`--show-c-function' - Show which C function each change is in. *Note C Function - Headings::. - -`--show-function-line=REGEXP' - In context and unified format, for each hunk of differences, show - some of the last preceding line that matches REGEXP. *Note - Specified Headings::. - -`--side-by-side' - Use the side by side output format. *Note Side by Side Format::. - -`--speed-large-files' - Use heuristics to speed handling of large files that have numerous - scattered small changes. *Note diff Performance::. - -`--starting-file=FILE' - When comparing directories, start with the file FILE. This is - used for resuming an aborted comparison. *Note Comparing - Directories::. - -`--suppress-common-lines' - Do not print common lines in side by side format. *Note Side by - Side Format::. - -`-t' - Expand tabs to spaces in the output, to preserve the alignment of - tabs in the input files. *Note Tabs::. - -`-T' - Output a tab rather than a space before the text of a line in - normal or context format. This causes the alignment of tabs in - the line to look normal. *Note Tabs::. - -`--text' - Treat all files as text and compare them line-by-line, even if they - do not appear to be text. *Note Binary::. - -`-u' - Use the unified output format. *Note Unified Format::. - -`--unchanged-group-format=FORMAT' - Use FORMAT to output a group of common lines taken from both files - in if-then-else format. *Note Line Group Formats::. - -`--unchanged-line-format=FORMAT' - Use FORMAT to output a line common to both files in if-then-else - format. *Note Line Formats::. - -`--unidirectional-new-file' - When comparing directories, if a file appears only in the second - directory of the two, treat it as present but empty in the other. - *Note Comparing Directories::. - -`-U LINES' -`--unified[=LINES]' - Use the unified output format, showing LINES (an integer) lines of - context, or three if LINES is not given. *Note Unified Format::. - For proper operation, `patch' typically needs at least two lines of - context. - -`-v' -`--version' - Output the version number of `diff'. - -`-w' - Ignore white space when comparing lines. *Note White Space::. - -`-W COLUMNS' -`--width=COLUMNS' - Use an output width of COLUMNS in side by side format. *Note Side - by Side Format::. - -`-x PATTERN' - When comparing directories, ignore files and subdirectories whose - basenames match PATTERN. *Note Comparing Directories::. - -`-X FILE' - When comparing directories, ignore files and subdirectories whose - basenames match any pattern contained in FILE. *Note Comparing - Directories::. - -`-y' - Use the side by side output format. *Note Side by Side Format::. - - -File: diff.info, Node: Invoking diff3, Next: Invoking patch, Prev: Invoking diff, Up: Top - -Invoking `diff3' -**************** - - The `diff3' command compares three files and outputs descriptions of -their differences. Its arguments are as follows: - - diff3 OPTIONS... MINE OLDER YOURS - - The files to compare are MINE, OLDER, and YOURS. At most one of -these three file names may be `-', which tells `diff3' to read the -standard input for that file. - - An exit status of 0 means `diff3' was successful, 1 means some -conflicts were found, and 2 means trouble. - -* Menu: - -* diff3 Options:: Summary of options to `diff3'. - - -File: diff.info, Node: diff3 Options, Up: Invoking diff3 - -Options to `diff3' -================== - - Below is a summary of all of the options that GNU `diff3' accepts. -Multiple single letter options (unless they take an argument) can be -combined into a single command line argument. - -`-a' - Treat all files as text and compare them line-by-line, even if they - do not appear to be text. *Note Binary::. - -`-A' - Incorporate all changes from OLDER to YOURS into MINE, surrounding - all conflicts with bracket lines. *Note Marking Conflicts::. - -`-e' - Generate an `ed' script that incorporates all the changes from - OLDER to YOURS into MINE. *Note Which Changes::. - -`-E' - Like `-e', except bracket lines from overlapping changes' first - and third files. *Note Marking Conflicts::. With `-e', an - overlapping change looks like this: - - <<<<<<< MINE - lines from MINE - ======= - lines from YOURS - >>>>>>> YOURS - -`--ed' - Generate an `ed' script that incorporates all the changes from - OLDER to YOURS into MINE. *Note Which Changes::. - -`--easy-only' - Like `-e', except output only the nonoverlapping changes. *Note - Which Changes::. - -`-i' - Generate `w' and `q' commands at the end of the `ed' script for - System V compatibility. This option must be combined with one of - the `-AeExX3' options, and may not be combined with `-m'. *Note - Saving the Changed File::. - -`--initial-tab' - Output a tab rather than two spaces before the text of a line in - normal format. This causes the alignment of tabs in the line to - look normal. *Note Tabs::. - -`-L LABEL' -`--label=LABEL' - Use the label LABEL for the brackets output by the `-A', `-E' and - `-X' options. This option may be given up to three times, one for - each input file. The default labels are the names of the input - files. Thus `diff3 -L X -L Y -L Z -m A B C' acts like `diff3 -m A - B C', except that the output looks like it came from files named - `X', `Y' and `Z' rather than from files named `A', `B' and `C'. - *Note Marking Conflicts::. - -`-m' -`--merge' - Apply the edit script to the first file and send the result to - standard output. Unlike piping the output from `diff3' to `ed', - this works even for binary files and incomplete lines. `-A' is - assumed if no edit script option is specified. *Note Bypassing - ed::. - -`--overlap-only' - Like `-e', except output only the overlapping changes. *Note - Which Changes::. - -`--show-all' - Incorporate all unmerged changes from OLDER to YOURS into MINE, - surrounding all overlapping changes with bracket lines. *Note - Marking Conflicts::. - -`--show-overlap' - Like `-e', except bracket lines from overlapping changes' first - and third files. *Note Marking Conflicts::. - -`-T' - Output a tab rather than two spaces before the text of a line in - normal format. This causes the alignment of tabs in the line to - look normal. *Note Tabs::. - -`--text' - Treat all files as text and compare them line-by-line, even if they - do not appear to be text. *Note Binary::. - -`-v' -`--version' - Output the version number of `diff3'. - -`-x' - Like `-e', except output only the overlapping changes. *Note - Which Changes::. - -`-X' - Like `-E', except output only the overlapping changes. In other - words, like `-x', except bracket changes as in `-E'. *Note - Marking Conflicts::. - -`-3' - Like `-e', except output only the nonoverlapping changes. *Note - Which Changes::. - - -File: diff.info, Node: Invoking patch, Next: Invoking sdiff, Prev: Invoking diff3, Up: Top - -Invoking `patch' -**************** - - Normally `patch' is invoked like this: - - patch <PATCHFILE - - The full format for invoking `patch' is: - - patch OPTIONS... [ORIGFILE [PATCHFILE]] [+ OPTIONS... [ORIGFILE]]... - - If you do not specify PATCHFILE, or if PATCHFILE is `-', `patch' -reads the patch (that is, the `diff' output) from the standard input. - - You can specify one or more of the original files as ORIG arguments; -each one and options for interpreting it is separated from the others -with a `+'. *Note Multiple Patches::, for more information. - - If you do not specify an input file on the command line, `patch' -tries to figure out from the "leading text" (any text in the patch that -comes before the `diff' output) which file to edit. In the header of a -context or unified diff, `patch' looks in lines beginning with `***', -`---', or `+++'; among those, it chooses the shortest name of an -existing file. Otherwise, if there is an `Index:' line in the leading -text, `patch' tries to use the file name from that line. If `patch' -cannot figure out the name of an existing file from the leading text, -it prompts you for the name of the file to patch. - - If the input file does not exist or is read-only, and a suitable RCS -or SCCS file exists, `patch' attempts to check out or get the file -before proceeding. - - By default, `patch' replaces the original input file with the -patched version, after renaming the original file into a backup file -(*note Backups::., for a description of how `patch' names backup -files). You can also specify where to put the output with the `-o -OUTPUT-FILE' or `--output=OUTPUT-FILE' option. - -* Menu: - -* patch Directories:: Changing directory and stripping directories. -* Backups:: Backup file names. -* Rejects:: Reject file names. -* patch Options:: Summary table of options to `patch'. - - -File: diff.info, Node: patch Directories, Next: Backups, Up: Invoking patch - -Applying Patches in Other Directories -===================================== - - The `-d DIRECTORY' or `--directory=DIRECTORY' option to `patch' -makes directory DIRECTORY the current directory for interpreting both -file names in the patch file, and file names given as arguments to -other options (such as `-B' and `-o'). For example, while in a news -reading program, you can patch a file in the `/usr/src/emacs' directory -directly from the article containing the patch like this: - - | patch -d /usr/src/emacs - - Sometimes the file names given in a patch contain leading -directories, but you keep your files in a directory different from the -one given in the patch. In those cases, you can use the `-p[NUMBER]' -or `--strip[=NUMBER]' option to set the file name strip count to -NUMBER. The strip count tells `patch' how many slashes, along with the -directory names between them, to strip from the front of file names. -`-p' with no NUMBER given is equivalent to `-p0'. By default, `patch' -strips off all leading directories, leaving just the base file names, -except that when a file name given in the patch is a relative file name -and all of its leading directories already exist, `patch' does not -strip off the leading directory. (A "relative" file name is one that -does not start with a slash.) - - `patch' looks for each file (after any slashes have been stripped) -in the current directory, or if you used the `-d DIRECTORY' option, in -that directory. - - For example, suppose the file name in the patch file is -`/gnu/src/emacs/etc/NEWS'. Using `-p' or `-p0' gives the entire file -name unmodified, `-p1' gives `gnu/src/emacs/etc/NEWS' (no leading -slash), `-p4' gives `etc/NEWS', and not specifying `-p' at all gives -`NEWS'. - - -File: diff.info, Node: Backups, Next: Rejects, Prev: patch Directories, Up: Invoking patch - -Backup File Names -================= - - Normally, `patch' renames an original input file into a backup file -by appending to its name the extension `.orig', or `~' on systems that -do not support long file names. The `-b BACKUP-SUFFIX' or -`--suffix=BACKUP-SUFFIX' option uses BACKUP-SUFFIX as the backup -extension instead. - - Alternately, you can specify the extension for backup files with the -`SIMPLE_BACKUP_SUFFIX' environment variable, which the options override. - - `patch' can also create numbered backup files the way GNU Emacs -does. With this method, instead of having a single backup of each file, -`patch' makes a new backup file name each time it patches a file. For -example, the backups of a file named `sink' would be called, -successively, `sink.~1~', `sink.~2~', `sink.~3~', etc. - - The `-V BACKUP-STYLE' or `--version-control=BACKUP-STYLE' option -takes as an argument a method for creating backup file names. You can -alternately control the type of backups that `patch' makes with the -`VERSION_CONTROL' environment variable, which the `-V' option -overrides. The value of the `VERSION_CONTROL' environment variable and -the argument to the `-V' option are like the GNU Emacs -`version-control' variable (*note emacs: Backups., for more information -on backup versions in Emacs). They also recognize synonyms that are -more descriptive. The valid values are listed below; unique -abbreviations are acceptable. - -`t' -`numbered' - Always make numbered backups. - -`nil' -`existing' - Make numbered backups of files that already have them, simple - backups of the others. This is the default. - -`never' -`simple' - Always make simple backups. - - Alternately, you can tell `patch' to prepend a prefix, such as a -directory name, to produce backup file names. The `-B BACKUP-PREFIX' -or `--prefix=BACKUP-PREFIX' option makes backup files by prepending -BACKUP-PREFIX to them. If you use this option, `patch' ignores any -`-b' option that you give. - - If the backup file already exists, `patch' creates a new backup file -name by changing the first lowercase letter in the last component of -the file name into uppercase. If there are no more lowercase letters -in the name, it removes the first character from the name. It repeats -this process until it comes up with a backup file name that does not -already exist. - - If you specify the output file with the `-o' option, that file is -the one that is backed up, not the input file. - - -File: diff.info, Node: Rejects, Next: patch Options, Prev: Backups, Up: Invoking patch - -Reject File Names -================= - - The names for reject files (files containing patches that `patch' -could not find a place to apply) are normally the name of the output -file with `.rej' appended (or `#' on systems that do not support long -file names). - - Alternatively, you can tell `patch' to place all of the rejected -patches in a single file. The `-r REJECT-FILE' or -`--reject-file=REJECT-FILE' option uses REJECT-FILE as the reject file -name. - - -File: diff.info, Node: patch Options, Prev: Rejects, Up: Invoking patch - -Options to `patch' -================== - - Here is a summary of all of the options that `patch' accepts. Older -versions of `patch' do not accept long-named options or the `-t', `-E', -or `-V' options. - - Multiple single-letter options that do not take an argument can be -combined into a single command line argument (with only one dash). -Brackets ([ and ]) indicate that an option takes an optional argument. - -`-b BACKUP-SUFFIX' - Use BACKUP-SUFFIX as the backup extension instead of `.orig' or - `~'. *Note Backups::. - -`-B BACKUP-PREFIX' - Use BACKUP-PREFIX as a prefix to the backup file name. If this - option is specified, any `-b' option is ignored. *Note Backups::. - -`--batch' - Do not ask any questions. *Note patch Messages::. - -`-c' -`--context' - Interpret the patch file as a context diff. *Note patch Input::. - -`-d DIRECTORY' -`--directory=DIRECTORY' - Makes directory DIRECTORY the current directory for interpreting - both file names in the patch file, and file names given as - arguments to other options. *Note patch Directories::. - -`-D NAME' - Make merged if-then-else output using FORMAT. *Note - If-then-else::. - -`--debug=NUMBER' - Set internal debugging flags. Of interest only to `patch' - patchers. - -`-e' -`--ed' - Interpret the patch file as an `ed' script. *Note patch Input::. - -`-E' - Remove output files that are empty after the patches have been - applied. *Note Empty Files::. - -`-f' - Assume that the user knows exactly what he or she is doing, and do - not ask any questions. *Note patch Messages::. - -`-F LINES' - Set the maximum fuzz factor to LINES. *Note Inexact::. - -`--force' - Assume that the user knows exactly what he or she is doing, and do - not ask any questions. *Note patch Messages::. - -`--forward' - Ignore patches that `patch' thinks are reversed or already applied. - See also `-R'. *Note Reversed Patches::. - -`--fuzz=LINES' - Set the maximum fuzz factor to LINES. *Note Inexact::. - -`--help' - Print a summary of the options that `patch' recognizes, then exit. - -`--ifdef=NAME' - Make merged if-then-else output using FORMAT. *Note - If-then-else::. - -`--ignore-white-space' -`-l' - Let any sequence of white space in the patch file match any - sequence of white space in the input file. *Note Changed White - Space::. - -`-n' -`--normal' - Interpret the patch file as a normal diff. *Note patch Input::. - -`-N' - Ignore patches that `patch' thinks are reversed or already applied. - See also `-R'. *Note Reversed Patches::. - -`-o OUTPUT-FILE' -`--output=OUTPUT-FILE' - Use OUTPUT-FILE as the output file name. *Note patch Options::. - -`-p[NUMBER]' - Set the file name strip count to NUMBER. *Note patch - Directories::. - -`--prefix=BACKUP-PREFIX' - Use BACKUP-PREFIX as a prefix to the backup file name. If this - option is specified, any `-b' option is ignored. *Note Backups::. - -`--quiet' - Work silently unless an error occurs. *Note patch Messages::. - -`-r REJECT-FILE' - Use REJECT-FILE as the reject file name. *Note Rejects::. - -`-R' - Assume that this patch was created with the old and new files - swapped. *Note Reversed Patches::. - -`--reject-file=REJECT-FILE' - Use REJECT-FILE as the reject file name. *Note Rejects::. - -`--remove-empty-files' - Remove output files that are empty after the patches have been - applied. *Note Empty Files::. - -`--reverse' - Assume that this patch was created with the old and new files - swapped. *Note Reversed Patches::. - -`-s' - Work silently unless an error occurs. *Note patch Messages::. - -`-S' - Ignore this patch from the patch file, but continue looking for - the next patch in the file. *Note Multiple Patches::. - -`--silent' - Work silently unless an error occurs. *Note patch Messages::. - -`--skip' - Ignore this patch from the patch file, but continue looking for - the next patch in the file. *Note Multiple Patches::. - -`--strip[=NUMBER]' - Set the file name strip count to NUMBER. *Note patch - Directories::. - -`--suffix=BACKUP-SUFFIX' - Use BACKUP-SUFFIX as the backup extension instead of `.orig' or - `~'. *Note Backups::. - -`-t' - Do not ask any questions. *Note patch Messages::. - -`-u' -`--unified' - Interpret the patch file as a unified diff. *Note patch Input::. - -`-v' - Output the revision header and patch level of `patch'. - -`-V BACKUP-STYLE' - Select the kind of backups to make. *Note Backups::. - -`--version' - Output the revision header and patch level of `patch', then exit. - -`--version=control=BACKUP-STYLE' - Select the kind of backups to make. *Note Backups::. - -`-x NUMBER' - Set internal debugging flags. Of interest only to `patch' - patchers. - - -File: diff.info, Node: Invoking sdiff, Next: Incomplete Lines, Prev: Invoking patch, Up: Top - -Invoking `sdiff' -**************** - - The `sdiff' command merges two files and interactively outputs the -results. Its arguments are as follows: - - sdiff -o OUTFILE OPTIONS... FROM-FILE TO-FILE - - This merges FROM-FILE with TO-FILE, with output to OUTFILE. If -FROM-FILE is a directory and TO-FILE is not, `sdiff' compares the file -in FROM-FILE whose file name is that of TO-FILE, and vice versa. -fROM-FILE and TO-FILE may not both be directories. - - `sdiff' options begin with `-', so normally FROM-FILE and TO-FILE -may not begin with `-'. However, `--' as an argument by itself treats -the remaining arguments as file names even if they begin with `-'. You -may not use `-' as an input file. - - An exit status of 0 means no differences were found, 1 means some -differences were found, and 2 means trouble. - - `sdiff' without `-o' (or `--output') produces a side-by-side -difference. This usage is obsolete; use `diff --side-by-side' instead. - -* Menu: - -* sdiff Options:: Summary of options to `diff'. - - -File: diff.info, Node: sdiff Options, Up: Invoking sdiff - -Options to `sdiff' -================== - - Below is a summary of all of the options that GNU `sdiff' accepts. -Each option has two equivalent names, one of which is a single letter -preceded by `-', and the other of which is a long name preceded by -`--'. Multiple single letter options (unless they take an argument) -can be combined into a single command line argument. Long named -options can be abbreviated to any unique prefix of their name. - -`-a' - Treat all files as text and compare them line-by-line, even if they - do not appear to be text. *Note Binary::. - -`-b' - Ignore changes in amount of white space. *Note White Space::. - -`-B' - Ignore changes that just insert or delete blank lines. *Note - Blank Lines::. - -`-d' - Change the algorithm to perhaps find a smaller set of changes. - This makes `sdiff' slower (sometimes much slower). *Note diff - Performance::. - -`-H' - Use heuristics to speed handling of large files that have numerous - scattered small changes. *Note diff Performance::. - -`--expand-tabs' - Expand tabs to spaces in the output, to preserve the alignment of - tabs in the input files. *Note Tabs::. - -`-i' - Ignore changes in case; consider upper- and lower-case to be the - same. *Note Case Folding::. - -`-I REGEXP' - Ignore changes that just insert or delete lines that match REGEXP. - *Note Specified Folding::. - -`--ignore-all-space' - Ignore white space when comparing lines. *Note White Space::. - -`--ignore-blank-lines' - Ignore changes that just insert or delete blank lines. *Note - Blank Lines::. - -`--ignore-case' - Ignore changes in case; consider upper- and lower-case to be the - same. *Note Case Folding::. - -`--ignore-matching-lines=REGEXP' - Ignore changes that just insert or delete lines that match REGEXP. - *Note Specified Folding::. - -`--ignore-space-change' - Ignore changes in amount of white space. *Note White Space::. - -`-l' -`--left-column' - Print only the left column of two common lines. *Note Side by - Side Format::. - -`--minimal' - Change the algorithm to perhaps find a smaller set of changes. - This makes `sdiff' slower (sometimes much slower). *Note diff - Performance::. - -`-o FILE' -`--output=FILE' - Put merged output into FILE. This option is required for merging. - -`-s' -`--suppress-common-lines' - Do not print common lines. *Note Side by Side Format::. - -`--speed-large-files' - Use heuristics to speed handling of large files that have numerous - scattered small changes. *Note diff Performance::. - -`-t' - Expand tabs to spaces in the output, to preserve the alignment of - tabs in the input files. *Note Tabs::. - -`--text' - Treat all files as text and compare them line-by-line, even if they - do not appear to be text. *Note Binary::. - -`-v' -`--version' - Output the version number of `sdiff'. - -`-w COLUMNS' -`--width=COLUMNS' - Use an output width of COLUMNS. *Note Side by Side Format::. - Note that for historical reasons, this option is `-W' in `diff', - `-w' in `sdiff'. - -`-W' - Ignore horizontal white space when comparing lines. *Note White - Space::. Note that for historical reasons, this option is `-w' in - `diff', `-W' in `sdiff'. - - -File: diff.info, Node: Incomplete Lines, Next: Projects, Prev: Invoking sdiff, Up: Top - -Incomplete Lines -**************** - - When an input file ends in a non-newline character, its last line is -called an "incomplete line" because its last character is not a -newline. All other lines are called "full lines" and end in a newline -character. Incomplete lines do not match full lines unless differences -in white space are ignored (*note White Space::.). - - An incomplete line is normally distinguished on output from a full -line by a following line that starts with `\'. However, the RCS format -(*note RCS::.) outputs the incomplete line as-is, without any trailing -newline or following line. The side by side format normally represents -incomplete lines as-is, but in some cases uses a `\' or `/' gutter -marker; *Note Side by Side::. The if-then-else line format preserves a -line's incompleteness with `%L', and discards the newline with `%l'; -*Note Line Formats::. Finally, with the `ed' and forward `ed' output -formats (*note Output Formats::.) `diff' cannot represent an incomplete -line, so it pretends there was a newline and reports an error. - - For example, suppose `F' and `G' are one-byte files that contain -just `f' and `g', respectively. Then `diff F G' outputs - - 1c1 - < f - \ No newline at end of file - --- - > g - \ No newline at end of file - -(The exact message may differ in non-English locales.) `diff -n F G' -outputs the following without a trailing newline: - - d1 1 - a1 1 - g - - `diff -e F G' reports two errors and outputs the following: - - 1c - g - . - - -File: diff.info, Node: Projects, Next: Concept Index, Prev: Incomplete Lines, Up: Top - -Future Projects -*************** - - Here are some ideas for improving GNU `diff' and `patch'. The GNU -project has identified some improvements as potential programming -projects for volunteers. You can also help by reporting any bugs that -you find. - - If you are a programmer and would like to contribute something to the -GNU project, please consider volunteering for one of these projects. If -you are seriously contemplating work, please write to -`gnu@prep.ai.mit.edu' to coordinate with other volunteers. - -* Menu: - -* Shortcomings:: Suggested projects for improvements. -* Bugs:: Reporting bugs. - - -File: diff.info, Node: Shortcomings, Next: Bugs, Up: Projects - -Suggested Projects for Improving GNU `diff' and `patch' -======================================================= - - One should be able to use GNU `diff' to generate a patch from any -pair of directory trees, and given the patch and a copy of one such -tree, use `patch' to generate a faithful copy of the other. -Unfortunately, some changes to directory trees cannot be expressed using -current patch formats; also, `patch' does not handle some of the -existing formats. These shortcomings motivate the following suggested -projects. - -* Menu: - -* Changing Structure:: Handling changes to the directory structure. -* Special Files:: Handling symbolic links, device special files, etc. -* Unusual File Names:: Handling file names that contain unusual characters. -* Arbitrary Limits:: Patching non-text files. -* Large Files:: Handling files that do not fit in memory. -* Ignoring Changes:: Ignoring certain changes while showing others. - - -File: diff.info, Node: Changing Structure, Next: Special Files, Up: Shortcomings - -Handling Changes to the Directory Structure -------------------------------------------- - - `diff' and `patch' do not handle some changes to directory -structure. For example, suppose one directory tree contains a directory -named `D' with some subsidiary files, and another contains a file with -the same name `D'. `diff -r' does not output enough information for -`patch' to transform the the directory subtree into the file. - - There should be a way to specify that a file has been deleted without -having to include its entire contents in the patch file. There should -also be a way to tell `patch' that a file was renamed, even if there is -no way for `diff' to generate such information. - - These problems can be fixed by extending the `diff' output format to -represent changes in directory structure, and extending `patch' to -understand these extensions. - - -File: diff.info, Node: Special Files, Next: Unusual File Names, Prev: Changing Structure, Up: Shortcomings - -Files that are Neither Directories Nor Regular Files ----------------------------------------------------- - - Some files are neither directories nor regular files: they are -unusual files like symbolic links, device special files, named pipes, -and sockets. Currently, `diff' treats symbolic links like regular -files; it treats other special files like regular files if they are -specified at the top level, but simply reports their presence when -comparing directories. This means that `patch' cannot represent changes -to such files. For example, if you change which file a symbolic link -points to, `diff' outputs the difference between the two files, instead -of the change to the symbolic link. - - `diff' should optionally report changes to special files specially, -and `patch' should be extended to understand these extensions. - - -File: diff.info, Node: Unusual File Names, Next: Arbitrary Limits, Prev: Special Files, Up: Shortcomings - -File Names that Contain Unusual Characters ------------------------------------------- - - When a file name contains an unusual character like a newline or -white space, `diff -r' generates a patch that `patch' cannot parse. -The problem is with format of `diff' output, not just with `patch', -because with odd enough file names one can cause `diff' to generate a -patch that is syntactically correct but patches the wrong files. The -format of `diff' output should be extended to handle all possible file -names. - - -File: diff.info, Node: Arbitrary Limits, Next: Large Files, Prev: Unusual File Names, Up: Shortcomings - -Arbitrary Limits ----------------- - - GNU `diff' can analyze files with arbitrarily long lines and files -that end in incomplete lines. However, `patch' cannot patch such -files. The `patch' internal limits on line lengths should be removed, -and `patch' should be extended to parse `diff' reports of incomplete -lines. - - -File: diff.info, Node: Large Files, Next: Ignoring Changes, Prev: Arbitrary Limits, Up: Shortcomings - -Handling Files that Do Not Fit in Memory ----------------------------------------- - - `diff' operates by reading both files into memory. This method -fails if the files are too large, and `diff' should have a fallback. - - One way to do this is to scan the files sequentially to compute hash -codes of the lines and put the lines in equivalence classes based only -on hash code. Then compare the files normally. This does produce some -false matches. - - Then scan the two files sequentially again, checking each match to -see whether it is real. When a match is not real, mark both the -"matching" lines as changed. Then build an edit script as usual. - - The output routines would have to be changed to scan the files -sequentially looking for the text to print. - - -File: diff.info, Node: Ignoring Changes, Prev: Large Files, Up: Shortcomings - -Ignoring Certain Changes ------------------------- - - It would be nice to have a feature for specifying two strings, one in -FROM-FILE and one in TO-FILE, which should be considered to match. -Thus, if the two strings are `foo' and `bar', then if two lines differ -only in that `foo' in file 1 corresponds to `bar' in file 2, the lines -are treated as identical. - - It is not clear how general this feature can or should be, or what -syntax should be used for it. - - -File: diff.info, Node: Bugs, Prev: Shortcomings, Up: Projects - -Reporting Bugs -============== - - If you think you have found a bug in GNU `cmp', `diff', `diff3', -`sdiff', or `patch', please report it by electronic mail to -`bug-gnu-utils@prep.ai.mit.edu'. Send as precise a description of the -problem as you can, including sample input files that produce the bug, -if applicable. - - Because Larry Wall has not released a new version of `patch' since -mid 1988 and the GNU version of `patch' has been changed since then, -please send bug reports for `patch' by electronic mail to both -`bug-gnu-utils@prep.ai.mit.edu' and `lwall@netlabs.com'. - diff --git a/gnu/dist/diffutils/diff.info-4 b/gnu/dist/diffutils/diff.info-4 deleted file mode 100644 index 95cf8e561e6..00000000000 --- a/gnu/dist/diffutils/diff.info-4 +++ /dev/null @@ -1,152 +0,0 @@ -This is Info file diff.info, produced by Makeinfo-1.55 from the input -file ./diff.texi. - - This file documents the the GNU `diff', `diff3', `sdiff', and `cmp' -commands for showing the differences between text files and the `patch' -command for using their output to update files. - - Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. - - Permission is granted to make and distribute verbatim copies of this -manual provided the copyright notice and this permission notice are -preserved on all copies. - - Permission is granted to copy and distribute modified versions of -this manual under the conditions for verbatim copying, provided that -the entire resulting derived work is distributed under the terms of a -permission notice identical to this one. - - Permission is granted to copy and distribute translations of this -manual into another language, under the above conditions for modified -versions, except that this permission notice may be stated in a -translation approved by the Foundation. - - -File: diff.info, Node: Concept Index, Prev: Projects, Up: Top - -Concept Index -************* - -* Menu: - -* cmp invocation: Invoking cmp. -* cmp options: cmp Options. -* diff3 hunks: diff3 Hunks. -* diff3 invocation: Invoking diff3. -* diff3 options: diff3 Options. -* diff3 sample input: Sample diff3 Input. -* diff invocation: Invoking diff. -* diff options: diff Options. -* diff sample input: Sample diff Input. -* ed script output format: ed Scripts. -* ifdef output format: If-then-else. -* patch input format: patch Input. -* patch invocation: Invoking patch. -* patch messages and questions: patch Messages. -* patch options: patch Options. -* sdiff invocation: Invoking sdiff. -* sdiff options: sdiff Options. -* sdiff output format: sdiff Option Summary. -* ! output format: Context. -* +- output format: Unified Format. -* <<<<<<< for marking conflicts: Marking Conflicts. -* < output format: Normal. -* aligning tabstops: Tabs. -* alternate file names: Alternate Names. -* backup file names: Backups. -* binary file diff: Binary. -* binary file patching: Arbitrary Limits. -* blank and tab difference suppression: White Space. -* blank line difference suppression: Blank Lines. -* brief difference reports: Brief. -* bug reports: Bugs. -* C function headings: C Function Headings. -* C if-then-else output format: If-then-else. -* case difference suppression: Case Folding. -* columnar output: Side by Side. -* comparing three files: Comparing Three Files. -* conflict: diff3 Merging. -* conflict marking: Marking Conflicts. -* context output format: Context. -* diagnostics from patch: patch Messages. -* diff merging: Interactive Merging. -* directories and patch: patch Directories. -* directory structure changes: Changing Structure. -* empty files, removing: Empty Files. -* file name alternates: Alternate Names. -* file names with unusual characters: Unusual File Names. -* format of diff3 output: Comparing Three Files. -* format of diff output: Output Formats. -* formats for if-then-else line groups: Line Group Formats. -* forward ed script output format: Forward ed. -* full lines: Incomplete Lines. -* function headings, C: C Function Headings. -* fuzz factor when patching: Inexact. -* headings: Sections. -* hunks: Hunks. -* hunks for diff3: diff3 Hunks. -* if-then-else output format: If-then-else. -* imperfect patch application: Imperfect. -* incomplete line merging: Merging Incomplete Lines. -* incomplete lines: Incomplete Lines. -* inexact patches: Inexact. -* interactive merging: Interactive Merging. -* introduction: Comparison. -* invoking cmp: Invoking cmp. -* invoking diff3: Invoking diff3. -* invoking diff: Invoking diff. -* invoking patch: Invoking patch. -* invoking sdiff: Invoking sdiff. -* large files: Large Files. -* line formats: Line Formats. -* line group formats: Line Group Formats. -* merge commands: Merge Commands. -* merged diff3 format: Bypassing ed. -* merged output format: If-then-else. -* merging from a common ancestor: diff3 Merging. -* merging interactively: Merge Commands. -* messages from patch: patch Messages. -* multiple patches: Multiple Patches. -* newline treatment by diff: Incomplete Lines. -* normal output format: Normal. -* options for cmp: cmp Options. -* options for diff3: diff3 Options. -* options for diff: diff Options. -* options for patch: patch Options. -* options for sdiff: sdiff Options. -* output formats: Output Formats. -* overlap: diff3 Merging. -* overlapping change, selection of: Which Changes. -* overview of diff and patch: Overview. -* paginating diff output: Pagination. -* patch making tips: Making Patches. -* patching directories: patch Directories. -* performance of diff: diff Performance. -* projects for directories: Shortcomings. -* RCS script output format: RCS. -* regular expression matching headings: Specified Headings. -* regular expression suppression: Specified Folding. -* reject file names: Rejects. -* removing empty files: Empty Files. -* reporting bugs: Bugs. -* reversed patches: Reversed Patches. -* sample input for diff3: Sample diff3 Input. -* sample input for diff: Sample diff Input. -* script output formats: Scripts. -* section headings: Sections. -* side by side: Side by Side. -* side by side format: Side by Side Format. -* special files: Special Files. -* specified headings: Specified Headings. -* summarizing which files differ: Brief. -* System V diff3 compatibility: Saving the Changed File. -* tab and blank difference suppression: White Space. -* tabstop alignment: Tabs. -* text versus binary diff: Binary. -* tips for patch making: Making Patches. -* two-column output: Side by Side. -* unified output format: Unified Format. -* unmerged change: Which Changes. -* white space in patches: Changed White Space. - - diff --git a/gnu/dist/diffutils/error.c b/gnu/dist/diffutils/error.c deleted file mode 100644 index e1d24dfce8e..00000000000 --- a/gnu/dist/diffutils/error.c +++ /dev/null @@ -1,111 +0,0 @@ -/* error.c -- error handler for noninteractive utilities - Copyright (C) 1990, 1991, 1992, 1993 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 - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/* Written by David MacKenzie. */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <stdio.h> - -#ifdef HAVE_VPRINTF - -#if __STDC__ -#include <stdarg.h> -#define VA_START(args, lastarg) va_start(args, lastarg) -#else /* !__STDC__ */ -#include <varargs.h> -#define VA_START(args, lastarg) va_start(args) -#endif /* !__STDC__ */ - -#else /* !HAVE_VPRINTF */ - -#ifdef HAVE_DOPRNT -#define va_alist args -#define va_dcl int args; -#else /* !HAVE_DOPRNT */ -#define va_alist a1, a2, a3, a4, a5, a6, a7, a8 -#define va_dcl char *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8; -#endif /* !HAVE_DOPRNT */ - -#endif /* !HAVE_VPRINTF */ - -#ifdef STDC_HEADERS -#include <stdlib.h> -#include <string.h> -#else /* !STDC_HEADERS */ -void exit (); -#endif /* !STDC_HEADERS */ - -extern char *program_name; - -#ifndef HAVE_STRERROR -static char * -private_strerror (errnum) - int errnum; -{ - extern char *sys_errlist[]; - extern int sys_nerr; - - if (errnum > 0 && errnum <= sys_nerr) - return sys_errlist[errnum]; - return "Unknown system error"; -} -#define strerror private_strerror -#endif /* !HAVE_STRERROR */ - -/* Print the program name and error message MESSAGE, which is a printf-style - format string with optional args. - If ERRNUM is nonzero, print its corresponding system error message. - Exit with status STATUS if it is nonzero. */ -/* VARARGS */ -void -#if defined (HAVE_VPRINTF) && __STDC__ -error (int status, int errnum, char *message, ...) -#else /* !HAVE_VPRINTF or !__STDC__ */ -error (status, errnum, message, va_alist) - int status; - int errnum; - char *message; - va_dcl -#endif /* !HAVE_VPRINTF or !__STDC__ */ -{ -#ifdef HAVE_VPRINTF - va_list args; -#endif /* HAVE_VPRINTF */ - - fflush (stdout); - fprintf (stderr, "%s: ", program_name); -#ifdef HAVE_VPRINTF - VA_START (args, message); - vfprintf (stderr, message, args); - va_end (args); -#else /* !HAVE_VPRINTF */ -#ifdef HAVE_DOPRNT - _doprnt (message, &args, stderr); -#else /* !HAVE_DOPRNT */ - fprintf (stderr, message, a1, a2, a3, a4, a5, a6, a7, a8); -#endif /* !HAVE_DOPRNT */ -#endif /* !HAVE_VPRINTF */ - if (errnum) - fprintf (stderr, ": %s", strerror (errnum)); - putc ('\n', stderr); - fflush (stderr); - if (status) - exit (status); -} diff --git a/gnu/dist/diffutils/getopt.c b/gnu/dist/diffutils/getopt.c index 964189d2dd4..0c5aa771c83 100644 --- a/gnu/dist/diffutils/getopt.c +++ b/gnu/dist/diffutils/getopt.c @@ -39,6 +39,8 @@ #endif #include <stdio.h> +#include <stdlib.h> +#include <string.h> /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself. This code is part of the GNU C diff --git a/gnu/dist/diffutils/install-sh b/gnu/dist/diffutils/install-sh deleted file mode 100644 index ab74c882e92..00000000000 --- a/gnu/dist/diffutils/install-sh +++ /dev/null @@ -1,238 +0,0 @@ -#!/bin/sh -# -# install - install a program, script, or datafile -# This comes from X11R5. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. -# - - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -tranformbasename="" -transform_arg="" -instcmd="$mvprog" -chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src="" -dst="" -dir_arg="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd="$cpprog" - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd="$stripprog" - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; - esac -done - -if [ x"$src" = x ] -then - echo "install: no input file specified" - exit 1 -else - true -fi - -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d $dst ]; then - instcmd=: - else - instcmd=mkdir - fi -else - -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. - - if [ -f $src -o -d $src ] - then - true - else - echo "install: $src does not exist" - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "install: no destination specified" - exit 1 - else - true - fi - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - - if [ -d $dst ] - then - dst="$dst"/`basename $src` - else - true - fi -fi - -## this sed command emulates the dirname command -dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script - -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' -' -IFS="${IFS-${defaultIFS}}" - -oIFS="${IFS}" -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS="${oIFS}" - -pathcomp='' - -while [ $# -ne 0 ] ; do - pathcomp="${pathcomp}${1}" - shift - - if [ ! -d "${pathcomp}" ] ; - then - $mkdirprog "${pathcomp}" - else - true - fi - - pathcomp="${pathcomp}/" -done -fi - -if [ x"$dir_arg" != x ] -then - $doit $instcmd $dst && - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi -else - -# If we're going to rename the final executable, determine the name now. - - if [ x"$transformarg" = x ] - then - dstfile=`basename $dst` - else - dstfile=`basename $dst $transformbasename | - sed $transformarg`$transformbasename - fi - -# don't allow the sed command to completely eliminate the filename - - if [ x"$dstfile" = x ] - then - dstfile=`basename $dst` - else - true - fi - -# Make a temp file name in the proper directory. - - dsttmp=$dstdir/#inst.$$# - -# Move or copy the file name to the temp name - - $doit $instcmd $src $dsttmp && - - trap "rm -f ${dsttmp}" 0 && - -# and set any options; do chmod last to preserve setuid bits - -# If any of these fail, we abort the whole thing. If we want to -# ignore errors from any of these, just make sure not to ignore -# errors from the above "$doit $instcmd $src $dsttmp" command. - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && - -# Now rename the file to the real destination. - - $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile - -fi && - - -exit 0 diff --git a/gnu/dist/diffutils/memchr.c b/gnu/dist/diffutils/memchr.c deleted file mode 100644 index 65ea2229ce1..00000000000 --- a/gnu/dist/diffutils/memchr.c +++ /dev/null @@ -1,19 +0,0 @@ -/* Support memchr on systems where it doesn't work. */ - -#include <config.h> -#include <sys/types.h> - -void * -memchr (s, c, n) - void const *s; - int c; - size_t n; -{ - unsigned char const *p = s; - unsigned char const *lim = p + n; - - for (; p < lim; p++) - if (*p == c) - return p; - return 0; -} diff --git a/gnu/dist/diffutils/mkinstalldirs b/gnu/dist/diffutils/mkinstalldirs deleted file mode 100644 index 91f6d04e17c..00000000000 --- a/gnu/dist/diffutils/mkinstalldirs +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh -# mkinstalldirs --- make directory hierarchy -# Author: Noah Friedman <friedman@prep.ai.mit.edu> -# Created: 1993-05-16 -# Last modified: 1994-03-25 -# Public domain - -errstatus=0 - -for file in ${1+"$@"} ; do - set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` - shift - - pathcomp= - for d in ${1+"$@"} ; do - pathcomp="$pathcomp$d" - case "$pathcomp" in - -* ) pathcomp=./$pathcomp ;; - esac - - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" 1>&2 - mkdir "$pathcomp" || errstatus=$? - fi - - pathcomp="$pathcomp/" - done -done - -exit $errstatus - -# mkinstalldirs ends here diff --git a/gnu/dist/diffutils/regex.c b/gnu/dist/diffutils/regex.c index 4b22b31a3c3..5d8c4566f5f 100644 --- a/gnu/dist/diffutils/regex.c +++ b/gnu/dist/diffutils/regex.c @@ -1001,7 +1001,7 @@ typedef struct value. Assumes the variable `fail_stack'. Probably should only be called from within `PUSH_FAILURE_POINT'. */ #define PUSH_FAILURE_ITEM(item) \ - fail_stack.stack[fail_stack.avail++] = (fail_stack_elt_t) item + fail_stack.stack[fail_stack.avail++] = (fail_stack_elt_t) (long) item /* The complement operation. Assumes `fail_stack' is nonempty. */ #define POP_FAILURE_ITEM() fail_stack.stack[--fail_stack.avail] @@ -1168,10 +1168,10 @@ typedef struct DEBUG_PRINT_COMPILED_PATTERN (bufp, pat, pend); \ \ /* Restore register info. */ \ - high_reg = (unsigned) POP_FAILURE_ITEM (); \ + high_reg = (unsigned long) POP_FAILURE_ITEM (); \ DEBUG_PRINT2 (" Popping high active reg: %d\n", high_reg); \ \ - low_reg = (unsigned) POP_FAILURE_ITEM (); \ + low_reg = (unsigned long) POP_FAILURE_ITEM (); \ DEBUG_PRINT2 (" Popping low active reg: %d\n", low_reg); \ \ for (this_reg = high_reg; this_reg >= low_reg; this_reg--) \ @@ -3994,7 +3994,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) regstart[r] = old_regstart[r]; /* xx why this test? */ - if ((int) old_regend[r] >= (int) regstart[r]) + if ((long) old_regend[r] >= (long) regstart[r]) regend[r] = old_regend[r]; } } diff --git a/gnu/dist/diffutils/stamp-h.in b/gnu/dist/diffutils/stamp-h.in deleted file mode 100644 index 3e01c72e641..00000000000 --- a/gnu/dist/diffutils/stamp-h.in +++ /dev/null @@ -1 +0,0 @@ -Fri Sep 30 22:22:28 PDT 1994 |
