| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
| |
Adopt POSIX convention for ENOEXEC and exit status 126.
unsigned -> unsigned int
|
|
|
|
|
|
|
|
| |
unsigned -> unsigned int
(EXIT_SUCCESS, EXIT_FAILURE, EXIT_TROUBLE): Define if not defined.
Include signal.h.
(SA_RESTART): Define if not defined.
(SIGCHLD): Likewise.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
0 -> EXIT_SUCCESS, 1 -> EXIT_FAILURE, 2 -> EXIT_TROUBLE.
(ck_editor_status): New function.
(main): Check for stack overflow.
Adopt POSIX convention for subsidiary programs not found.
(diffarg): Check for integer overflow to avoid core dumps.
(trapsigs): Remove SA_INTERRUPT special case; now done by header.
(SIGCHLD): Likewise.
(edit): Adopt POSIX convention for subsidiary programs not found.
|
|
|
|
|
|
|
|
|
|
|
| |
preposterously incompatible.
(slurp): Do not dump core if the file is growing as we read it.
If a regular file grows, keep reading until we catch up with its EOF.
(find_and_hash_each_line): Check for integer overflow to avoid core dumps.
(GUESS_LINES): Remove.
(guess_lines): New function. Avoid integer overflow.
(find_identical_ends): Use it.
Avoid integer overflow and possible core dumps.
|
|
|
|
|
| |
bad formats.
(do_printf_spec): Avoid alloca.
|
|
|
|
|
| |
Check for integer overflow to avoid core dumps.
(diff_dirs): 0 -> EXIT_SUCCESS, 2 -> EXIT_TROUBLE.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(ALLOCATE): Remove. All uses changed to xmalloc, or to xmalloc plus
an overflow check.
(myread): Remove.
(main): Check for stack overflow.
0 -> EXIT_SUCCESS, 1 -> EXIT_FAIULRE, 2 -> EXIT_TROUBLE.
(try_help): Likewise.
(process_diff): Check for integer overflow, to avoid core dumps.
2 -> EXIT_TROUBLE.
(read_diff): Exit with status 126 if the file is not executable,
for compatibility with POSIX 1003.1-2001.
Accommodate ancient AIX hosts that set errno to EINTR after uncaught
SIGCONT.
Check for integer overflow to avoid core dumps.
(fatal, perror_with_exit): 2 -> EXIT_TROUBLE.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
arithmetic overflow.
(pr_unidiff_hunk): Likewise.
(find_hunk): Likewise.
|
|
|
|
|
|
|
|
|
|
|
| |
(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.
|
| |
|
|
|
|
|
| |
(INCLUDES): Remove intl.
(LDADD): Change INTLLIBS to LIBINTL. No need to link libdiffutils.a twice.
|
|
|
|
|
| |
(lines_differ): Have an explicit do-nothing case for
IGNORE_NO_WHITE_SPACE, to pacify gcc -Wall.
|
|
|
|
|
| |
Include gettext.h, not libgettext.h.
(N_): Do not wrap arg in parentheses. Fix from Bruno Haible.
|
|
|
|
|
|
|
|
|
|
| |
(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.
|
|
|
|
| |
to avoid warnings on some compilers.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(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.
|
|
|
|
|
| |
(usage): Reformat messages to ease translation.
(main): Remove unused variable.
|
|
|
|
|
|
| |
(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.
|
|
|
|
| |
terminating null character, not for a newline.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(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.
|
|
|
|
|
|
|
|
|
|
|
| |
(longopts, main): Use them.
(longopts, main, option_help_msgid): New option --diff-option=PROGRAM.
(main): Remove DIFF_PROGRAM support.
Check stdout after printing version.
(check_stdout): Report errno info if fclose fails.
(read_diff): Have child exit with status 127 when program is not found,
rather than trying to have the child report failure. CHeck for
pclose returning -1.
|
|
|
|
|
|
|
|
| |
(main): 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.
|
|
|
|
|
|
| |
(check_stdout): Don't assume that the translations of "write failed"
and of "standard output" lack '%'.
(main): Check stdout after printing version.
|
|
|
|
| |
(dir_file_pathname): Use base_name rather than file_name_lastdirchar.
|
|
|
|
|
| |
Include <libgettext.h> rather than rolling it ourselves.
(file_name_lastdirchar, HAVE_SETMODE, set_binary_mode): Remove.
|
|
|
|
|
|
|
| |
(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.
|
| |
|
|
|
|
| |
allocator.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(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".
|
| |
|
|
|
|
| |
HAVE_WORKING_FORK || HAVE_WORKING_VFORK.
|
|
|
|
|
|
| |
(vfork): New macro.
(HAVE_FORK): Remove.
(set_binary_mode): New macro.
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
instead of setmode.
(sip): Fix typo in backward lseek when reverting to text mode.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(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.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
(longopts, option_help_msgid, main): Add -E, --ignore-tab-expansion,
--strip-trailing-cr.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(_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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
int -> bool for booleans.
int -> lin for line numbers.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
int -> lin for line numbers.
|