summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* 2 -> EXIT_TROUBLE.Paul Eggert2002-02-281-11/+12
| | | | | Adopt POSIX convention for ENOEXEC and exit status 126. unsigned -> unsigned int
* Don't use alloca or include <alloca.h>.Paul Eggert2002-02-281-26/+24
| | | | | | | | unsigned -> unsigned int (EXIT_SUCCESS, EXIT_FAILURE, EXIT_TROUBLE): Define if not defined. Include signal.h. (SA_RESTART): Define if not defined. (SIGCHLD): Likewise.
* unsigned -> unsigned int.Paul Eggert2002-02-282-24/+29
|
* Include c-stack.h, exitfail.h. Do not include signal.h.Paul Eggert2002-02-281-34/+43
| | | | | | | | | | | 0 -> EXIT_SUCCESS, 1 -> EXIT_FAILURE, 2 -> EXIT_TROUBLE. (ck_editor_status): New function. (main): Check for stack overflow. Adopt POSIX convention for subsidiary programs not found. (diffarg): Check for integer overflow to avoid core dumps. (trapsigs): Remove SA_INTERRUPT special case; now done by header. (SIGCHLD): Likewise. (edit): Adopt POSIX convention for subsidiary programs not found.
* (sip): Avoid integer overflow and core dumps if buffer alignments arePaul Eggert2002-02-281-48/+92
| | | | | | | | | | | 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.
* (format_group, print_ifdef_lines): Avoid core dumps withPaul Eggert2002-02-281-17/+17
| | | | | bad formats. (do_printf_spec): Avoid alloca.
* (dir_read): Ignore st_size of directories: POSIX says it's garbage.Paul Eggert2002-02-281-7/+14
| | | | | Check for integer overflow to avoid core dumps. (diff_dirs): 0 -> EXIT_SUCCESS, 2 -> EXIT_TROUBLE.
* Include c-stack.h, exitfail.h.Paul Eggert2002-02-281-51/+63
| | | | | | | | | | | | | | | | | (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.
* 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.