summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* Include c-stack.h, exitfail.h.Paul Eggert2002-02-281-225/+261
| | | | | | | | | | | | | | | | | | | | | | | | | | | Do not include signal.h. (specify_style, specify_value): Bring these routines back, as POSIX requires that the order of options not matter. (shortopts): New constant. (group_format_option, line_format_option): New constants. (LONG_OPTION, GROUP_FORMAT_OPTION, LINE_FORMAT_OPTION): New macros. (longopts): Use them. (main): 0 -> EXIT_SUCCESS, 1 -> EXIT_FAILURE, 2 -> EXIT_TROUBLE. Ensure that order of options does not matter. Check for stack overflow. If contexts overflow, substitute LIN_MAX, as that's good enough. If multiple contexts are specified, use their maximum. -c is equivalent to -C 3 now, instead of having an implicit context; likewise for -u and -U 3. Use specify_style and specify_value. (SIGCHLD): Do not define; now done in a header. Use new style time stamp format for -u / -U. Reject numeric-string options if operating in POSIX 1003.1-2001 mode. Avoid overflow problems with tab width. Simplify from-file and to-file code. (usage): Do not mention obsolete options. (filetype): Do not mention whether a file is executable. Add typed memory objects. (compare_files): 0 -> EXIT_SUCCESS, 1 -> EXIT_FAILURE, 2 -> EXIT_TROUBLE.
* (pr_context_hunk): Do not dump core if an enormous context causes anPaul Eggert2002-02-281-13/+36
| | | | | | arithmetic overflow. (pr_unidiff_hunk): Likewise. (find_hunk): Likewise.
* Include c-stack.h, exitfail.h.Paul Eggert2002-02-281-31/+43
| | | | | | | | | | | (hard_locale_LC_MESSAGES): Depend on ENABLE_NLS. (try_help, check_stdout, main, cmp): 2 -> EXIT_TROUBLE. (main): Check for stack overflow. 0 -> EXIT_SUCCESS. 1 -> EXIT_FAILURE. (cmp): Likewise. Accommodate ancient AIX hosts that set errno to EINTR after uncaught SIGCONT.
* (diff_2_files): Avoid arithmetic overflow in buffer size calculation.Paul Eggert2002-02-281-3/+5
|
* (datadir): @DATADIRNAME@ -> share.Paul Eggert2002-02-281-7/+4
| | | | | (INCLUDES): Remove intl. (LDADD): Change INTLLIBS to LIBINTL. No need to link libdiffutils.a twice.
* (finish_output): Ensure that werrno is initialized.Paul Eggert2002-01-241-2/+5
| | | | | (lines_differ): Have an explicit do-nothing case for IGNORE_NO_WHITE_SPACE, to pacify gcc -Wall.
* (UINTMAX_MAX): New macro.Paul Eggert2002-01-241-4/+7
| | | | | Include gettext.h, not libgettext.h. (N_): Do not wrap arg in parentheses. Fix from Bruno Haible.
* (copyright_string): Update to 2002.Paul Eggert2002-01-241-11/+15
| | | | | | | | | | (usage): Reformat messages to ease translation. (handler_index_of_SIGINT, handler_index_of_SIGPIPE): New macros. (main): Do not confuse signal numbers with their indices. Bug reported by Bruno Haible. (edit): Cat lin to long before printing with %ld, since lin might be narrow than long.
* (file_block_read): Use SIZE_MAX instead of (size_t) -1,Paul Eggert2002-01-241-3/+3
| | | | to avoid warnings on some compilers.
* Include <setjmp.h>Paul Eggert2002-01-241-36/+55
| | | | | | | | | | | | | | | | (struct dirdata): New member nnames. (locale_specific_sorting, failed_strcoll): New vars. (dir_read): Renamed from dir_sort. Don't sort the dir. Set new nnames member of struct dirdata. All callers changed. (compare_names): Don't check for errno after strcasecmp. Use strcoll only if locale_specific_sorting is nonzero. If strcoll fails, longjmp out rather than returning a value that might result in an invalid comparison function that might make qsort dump core. (diff_dirs): Sort the directory ourselves. Use setjmp to recover from strcoll failure, falling back on native byte comparison. Make local variables volatile if they need to preserve their value after setjmp/longjmp.
* (copyright_string): Update to 2002.Paul Eggert2002-01-242-9/+8
| | | | | (usage): Reformat messages to ease translation. (main): Remove unused variable.
* (copyright_string): Update to 2002.Paul Eggert2002-01-241-17/+15
| | | | | | (bytes, parse_ignore_initial, cmp): Use UINTMAX_MAX instead of (uintmax_t) -1, to avoid warnings on some compilers. (usage): Reformat messages to ease translation.
* (interact): After extracting rlen from the editor command, test for aPaul Eggert2001-12-311-1/+1
| | | | terminating null character, not for a newline.
* (begin_output): Have child exit with status 127 rather than reportingPaul Eggert2001-12-241-7/+8
| | | | | | failure on its own. Set errno to 0 before invoking popen. (finish_output): Report errno on pclose failure. Distinguish between subsidiary program not found, and failure.
* (not_found, execdiff): Remove.Paul Eggert2001-12-241-58/+76
| | | | | | | | | | | | | | | (DIFF_PROGRAM_OPTION): New constant. (longopts, option_help_msgid, main): Add --diff-program=PROGRAM. (check_stdout): New function. (main): Remove DIFF_PROGRAM support. Check stdout after printing version. Use check_stdout after printing help. Use execvp/perror_fatail rather than execdiff. Set errno to 0 before invoking popen. Check for pclose failure properly. (main, edit): If child exec fails, exit with 127 rather than trying to print diagnostic. Distinguish between subsidiary program failing and not being found. (edit): Handle signals the same way, regardless of whether we're using system or fork+exec. Check for system returning -1.
* (DIFF_PROGRAM_OPTION, HELP_OPTION): New constants.Paul Eggert2001-12-241-13/+27
| | | | | | | | | | | (longopts, main): Use them. (longopts, main, option_help_msgid): New option --diff-option=PROGRAM. (main): Remove DIFF_PROGRAM support. Check stdout after printing version. (check_stdout): Report errno info if fclose fails. (read_diff): Have child exit with status 127 when program is not found, rather than trying to have the child report failure. CHeck for pclose returning -1.
* (DEFAULT_WIDTH): Remove.Paul Eggert2001-12-241-11/+8
| | | | | | | | (main): Use 130 instead of DEFAULT_WIDTH, since it's not really builder-settable. Do not prepend DIFF_OPTIONS. (check-stdout): If fclose (stdout) fails, print errno info. (option_help_msgid): Default context is 3, not 2. (usage): Work even if ptrdiff_t is wider than int.
* (valid_suffixes): Add '0', to support suffixes like "MB" and "MiB".Paul Eggert2001-12-241-3/+4
| | | | | | (check_stdout): Don't assume that the translations of "write failed" and of "standard output" lack '%'. (main): Check stdout after printing version.
* Include dirname.h.Paul Eggert2001-12-111-8/+11
| | | | (dir_file_pathname): Use base_name rather than file_name_lastdirchar.
* (S_IXUSR, S_IXGRP, S_IXOTH): New macros.Paul Eggert2001-12-111-33/+13
| | | | | Include <libgettext.h> rather than rolling it ourselves. (file_name_lastdirchar, HAVE_SETMODE, set_binary_mode): Remove.
* Include <dirname.h>.Paul Eggert2001-12-111-5/+6
| | | | | | | (expand_name): Use base_name rather than file_name_lastdirchar, for portability to DOS. (main): Initialize xalloc_exit_failure before possibly invoking any memory allocator.
* Include setmode.h.Paul Eggert2001-12-111-0/+1
|
* (main): Initialize xalloc_exit_failure before possibly invoking any memoryPaul Eggert2001-12-111-1/+1
| | | | allocator.
* Include dirname.h, setmode.h.Paul Eggert2001-12-111-80/+79
| | | | | | | | | | | | | | | | | (main): Later values and/or styles now silently override earlier. (specify_value, specify_style): Likewise. All callers changed. Remove. (binary, main, option_help_msgid, compare_files): HAVE_SETMODE -> HAVE_SETMODE_DOS. (NO_IGNORE_FILE_NAME_CASE_OPTION): New constant. (longopts, main, option_help_msgid): Support it. (exclude_options): New function. (main): Use it. Initialize xalloc_exit_failure before potentially allocating memory. (filetype): Distinguish executable files from others, as POSIX suggests. (compare_files): Use base_name instead of file_name_lastdirchar.
* Include <hard-locale.h>, <setmode.h>.Paul Eggert2001-12-111-40/+77
| | | | | | | | | | | | | | (hard_locale_LC_MESSAGES): New macro. (sprintc): Remove int width arg; it's now the caller's responsibility to pad. All callers changed. (stat_buf): New static var; was formerly a local var in 'main'. (valid_suffixes): Add 'K', for 'KiB'. (option_help_msgid): Don't confuse bytes with characters. (main): Set xalloc_exit_failure before invoking anything that might allocate memory. Fix bug: -n was incorrectly ignored when optimizing the case of regular files with different lengths. (cmp): Use an index column wide enough to store this comparison's indexes. In locales other than the POSIX locale, say "byte" rather than "char".
* (usage): Clarify.Paul Eggert2001-12-031-2/+8
|
* (setup_output, begin_output, finish_output): HAVE_FORK ->Paul Eggert2001-12-031-7/+7
| | | | HAVE_WORKING_FORK || HAVE_WORKING_VFORK.
* (STAT_BLOCKSIZE): Use HAVE_STRUCT_STAT_ST_BLKSIZE, not HAVE_ST_BLKSIZE.Paul Eggert2001-12-031-14/+29
| | | | | | (vfork): New macro. (HAVE_FORK): Remove. (set_binary_mode): New macro.
* (diffpid, cleanup, main, edit): HAVE_FORK -> HAVE_WORKING_FORK ||Paul Eggert2001-12-031-29/+27
| | | | | | | | HAVE_WORKING_VFORK. (main): HAVE_VFORK -> HAVE_WORKING_VFORK. (edit): Reopen the temporary file after the editor has run, in case the editor operates by unlinking the old file and linking a new one. (P_tmpdir): Rename from PVT_tmpdir; this fixes a typo. All uses changed.
* (sip, read_files): Remove tests for HAVE_SETMODE; use set_binary_modePaul Eggert2001-12-031-12/+15
| | | | | instead of setmode. (sip): Fix typo in backward lseek when reverting to text mode.
* (read_diff): HAVE_FORK -> HAVE_WORKING_FORK || HAVE_WORKING_VFORK.Paul Eggert2001-12-031-6/+6
|
* <xstrtol.h>: Include.Paul Eggert2001-12-031-27/+84
| | | | | | | | | | | | | | | (ignore_initial): Now an array with 2 elements. All uses changed. (bytes): New var. (HELP_OPTION): New constant. (long_options, main): Use it. (long_options, option_help_msgid, main, cmp): Add support for -n or --bytes. (parse_ignore_initial): New function. (option_help_msgid, main): Add -i M:N. (usage, main): Add two optional trailing operands, a la BSD. (main): setmode -> set_binary_mode. (cmp): Report byte number of what we've seen, not of the entire file. This is to be consistent with the line number, which is always relative with what we've seen.
* (main, compare_files): setmode -> set_binary_mode.Paul Eggert2001-12-031-10/+10
|
* (INCLUDES): Add -I../lib, for regex.h.Paul Eggert2001-11-251-1/+1
|
* (option_help_msgid): offsets -> indicesPaul Eggert2001-11-251-4/+4
|
* (option_help_msgid): Don't mention --binary on POSIX hosts.Paul Eggert2001-11-251-2/+0
|
* (STRIP_TRAILING_CR_OPTION): New constant.Paul Eggert2001-11-251-5/+15
| | | | | (longopts, option_help_msgid, main): Add -E, --ignore-tab-expansion, --strip-trailing-cr.
* Assume C89 or better.Paul Eggert2001-11-251-113/+191
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (_GNU_SOURCE): Remove; config.h now defines it. (alloca): Declare like coreutils does it. (verify, TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM, O_RDWR, S_IRUSR, S_IWUSR): New macros. (STAT_BLOCKSIZE): Parenthesize definiens. <inttypes.h>: Include if HAVE_INTTYPES_H. (CHAR_MAX, INT_MAX): Remove. (PTRDIFF_MAX, SIZE_MAX): New macros. (strtoumax): New decl. Include stddef.h. (bzero): Remove. (bindtextdomain, textdomain, N_): New macros. (ISPRINT, ISSPACE): Remove ifndef wrappers. (ISUPPER, ISDIGIT): Remove. (TOLOWER): New macro. (MIN): Renamed from min; all callers changed. (MAX): Likewise, from max. (lin): New type. (LIN_MAX): New macro. (file_name_cmp): Renamed from filename_cmp. All callers changed. (file_name_lastdirchar): Renamed from file_name_lastdirchar. All callers changed. (could_be_mvfs_stat_bug, could_be_nfs_stat_bug, dev_may_have_duplicate_ino): Remove. (HAVE_SETMODE, NULL_DEVICE): New macros. (same_file): Do not check attributes. (same_file_attributes): New macro.
* Assume C89 or better.Paul Eggert2001-11-251-129/+155
| | | | | | | | | | | | | | | | | | | int -> bool for booleans. int -> lin for line numbers. int -> size_t for sizes. Use angle-brackets when including quotesys.h. Include error.h, regex.h, xalloc.h. (message5): sizeof -> offsetof (begin_output): Invoke pr without -f. (lines_differ): Renamed from line_cmp, and return bool not 3-way int. All callers changed. Add support for IGNORE_TAB_EXPANSION. (change_letter): Now an array rather than a function. All callers changed. (translate_range): Translate line numbers to long, not lin, for convenience with printf. (analyze_hunk): Return enum changes instead of a count of inserts and deletes. All callers changed. (zalloc): New function.
* Assume C89 or better.Paul Eggert2001-11-241-49/+45
| | | | | int -> bool for booleans. int -> lin for line numbers.
* Assume C89 or better.Paul Eggert2001-11-241-375/+261
| | | | | | | | | | | | | | | | | int -> bool for booleans. int -> lin for line numbers. Use angle-brackets when including getopt.h, quotesys.h. Include error.h, freesoft.h, stdio.h, xalloc.h. (copyright_string): Use only most recent year. (authorship_msgid, option_help_msgid): Wrap in N_(). (tmpname): Now volatile. (tmpmade): Remove. (tmp): New var. (private_tempnam, exists, letters): Remove. (temporary_file): New function. (edit): Use it. (interact): Use strtoumax, not atoi.
* Assume C89 or better.Paul Eggert2001-11-241-16/+15
| | | | int -> lin for line numbers.
* Assume C89 or better.Paul Eggert2001-11-241-233/+309
| | | | | | | | | | | | | | | | | | | | | | | | int -> bool for booleans. int -> lin for line numbers. int -> size_t for sizes. Use angle-brackets when including cmpbuf.h. Include regex.h, xalloc.h. (word): Remove; now done in system.h. (hash_value): New type; use it instead of 'unsigned' for hash values. (file_block_read): New function. (sip, slurp): Use it. Now static. (sip): Ensure block size is a multiple of word size. Clear eof flag. (slurp): Use xalloc_die to report memory exhaustion. (find_and_hash_each_line): Use TOLOWER instead of _tolower. Add support for IGNORE_TAB_EXPANSION. (prepare_text_end): Strip trailing CR if requested. (find_identical_ends): Prepare the text only once, if they're duplicates. Let the compiler take advantage more of the fact that the buffers are word-aligned. (primes): Remove. (prime_offset): New var. (read_var): Use prime_offset instead of primes. Use zalloc instead of xmalloc + bzero.
* Assume C89 or better.Paul Eggert2001-11-241-248/+242
| | | | | | | | int -> lin for line numbers. (format_group): Use strtoumax to parse line numbers. (format_group, print_ifdef_lines): Use do_printf_spec to handle printf specs. (groups_letter_value): Don't use _tolower; it's locale-dependent. (do_printf_spec): Renamed from scan_printf_spec; now does the printing.
* Assume C89 or better.Paul Eggert2001-11-241-69/+40
| | | | | int -> lin for line numbers (or 'long' when that's more convenient). (print_ed_hunk): Fix bug when handling double-dot inserts.
* Assume C89 or better.Paul Eggert2001-11-241-37/+66
| | | | | | | | | | | | | | | int -> bool for booleans. Include error.h, exclude.h, xalloc.h. (dir_sort): Return 0 on error, 1 on success. All callers changed. compare_names -> compare_names_for_qsort. (compare_names): Try strcasecmp if ignore_file_name_case. Then try strcoll. Use file_name_cmp only as a last resort. Warn about strcasecmp or strcoll failure. (compare_names_for_qsort): New function. (diff_dirs): Use compare_names rather than filename_cmp.
* Assume C89 or better.Paul Eggert2001-11-241-308/+245
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | int -> bool for booleans. int -> lin for line numbers. Use angle-brackets when including getopt.h, quotesys.h. Include error.h, freesoft.h, inttostr.h, xalloc.h. (copyright_string): Use only most recent year. (authorship_msgid, option_help_msgid): Wrap in N_(). Rename the following variables for consistency with user-visible option spellings. All uses changed. (text): Renamed from always_text. (initial_tab): Renamed from tab_align_flag. (horizon_lines): Remove. Remove all uses. (main): Invoke bindtextdomain and textdomain after setlocale. Rename "DIFF" to "DIFF_PROGRAM". Try to compare file0 to file1, because this is where changes are expected to come from. Diffing between these pairs of files is more likely to avoid phantom changes from file0 to file1. However, use file2 as the common file if this is a 3-way diff, for backward compatibility. (create_diff3_block): Use xcalloc instead of malloc + bzero. (INT_STRLEN_BOUND): Remove; now in system.h. (read_diff): Always use --horizon-lines=100 rather than trying to guess it. Do not pass --inhibit-hunk-merge. Minimum chunk size is 1, not 8KiB. Use xalloc_die to report memory exhaustion. (undotlines): Use long for start, not int.
* Assume C89 or better.Paul Eggert2001-11-241-119/+147
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | int -> bool for booleans. int -> lin for line numbers. Don't include regex.h. (enum changes): New enum. (enum line_class): Remove; subsumed by enum changes. (enum output_style): New constant OUTPUT_UNSPECIFIED. (ignore_space_change_flag, ignore_all_space_flag): Remove. (ignore_white_space): New decl, subsuming the above two. All uses changed. Rename the following decls for consistency with user-visible option spellings. All uses changed. (text): Renamed from always_text_flag. (ignore_blank_lines): Renamed from ignore_blank_lines_flag. (ignore_case): Renamed from ignore_case_flag. (brief): Renamed from no_details_flag. (initial_tab): Renamed from tab_align_flag. (expand_tabs): Renamed from tab_expand_flag. (starting_file): Renamed from dir_start_file. (paginate): Renamed from paginate_flag. (sdiff_merge_assist): Renamed from sdiff_help_sdiff. (left_column): Renamed from sdiff_left_only. (suppress_common_lines): Renamed from sdiff_skip_common_lines. (speed_large_files): Renamed from heuristic. (minimal): Renamed from no_discards. (inhibit_hunk_merge): Remove. (strip_trailing_cr, excluded, time_format): New decls. (files_can_be_treated_as_binary): Renamed from ignore_some_changes. (group_format, line_format): Now char const *[], not char *[]. (struct file_data): Buffer is now word*, not char*, as it's always aligned and this can help the compiler. buffered_chars -> buffered (since it's a byte count, not a char count). All uses changed. New member `eof'. (FILE_BUFFER): New macro. (excluded_filename, error, free_software_msgid): Remove decls; now in other .h files. (sip, slurp): Remove decls. (file_block_read): New decl. (change_letter): Now an array, not a function. (lines_differ): Renamed from line_cmp. (analyze_hunk): Now returns enum changes rather than two change counts.
* (diff_LDADD): New symbol.Paul Eggert2001-11-241-0/+1
|
* Assume C89 or better.Paul Eggert2001-11-241-418/+431
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | int -> bool for booleans. long -> off_t for line numbers. Use angle-brackets when including getopt.h, fnmatch.h, quotesys.h. Include error.h, exclude.h, freesoft.h, hard-locale.h, prepargs.h, regex.h, signal.h, xalloc.h. (copyright_string): Use only most recent year. (authorship_msgid, option_help_msgid): Wrap in N_(). Rename the following variables for consistency with user-visible option spellings. All uses changed. (binary): Renamed from binary_flag. (new_file): Renamed from entire_new_file_flag. (unidirectional_new_file): Renamed from unidirectional_new_file_flag. (report_identical_files): Renamed from print_file_same_flag. (numeric_arg): Remove. (exclude, exclude_alloc, exclude_count, excluded_filename, add_exclude, add_exclude_file): Remove; now done by exclude.h. (BINARY_OPTION, FROM_FILE_OPTION, HELP_OPTION, HORIZON_LINES_OPTION, IGNORE_FILE_NAME_CASE_OPTION, INHIBIT_HUNK_MERGE_OPTION, LEFT_COLUMN_OPTION, LINE_FORMAT_OPTION, NORMAL_OPTION, SDIFF_MERGE_ASSIST_OPTION, STRIP_TRAILING_CR_OPTION, SUPPRESS_COMMON_LINES_OPTION, TO_FILE_OPTION, UNCHANGED_LINE_FORMAT_OPTION, OLD_LINE_FORMAT_OPTION, NEW_LINE_FORMAT_OPTION, UNCHANGED_GROUP_FORMAT_OPTION, OLD_GROUP_FORMAT_OPTION, NEW_GROUP_FORMAT_OPTION, CHANGED_GROUP_FORMAT_OPTION): New constants. (longopts, main): Use them. (longopts, main, option_help_msgid): Add -E, --from-file, --to-file. (main): Invoke bindtextdomain and textdomain after setlocale. Use grep syntax, not Emacs, for regular expressions. Use exclude.h, not our own functions. Use ISO 8601 time format in hard locales. Prepend DIFF_OPTIONS. Don't update ignore_some_changes. Use strtoumax instead of numeric_arg. Use specify_value when appropriate. error -> try_help when appropriate. -p now means ^[[:alpha:]$_], not ^[_a-zA-Z$]. Ignore --inhibit-hunk-merge. Prefer changed group formats to unchanged ones. Remove now-unnecessary casts. Set files_can_be_treated_as_binary. (specify_value): Renamed from specify_format. All uses changed. (specify_style): Default is now unspecified, not normal. All uses changed. (set_mtime_to_now): New function. (compare_files): Use it. Use memset, not bzero. Set stdin mtime to current time even when stdin is not a regular file. Check for same file attributes, as well as for same file. Use files_can_be_treated_as_binary. "write failed" -> "standard output on output failure.