Commit Graph
10580 Commits
Author SHA1 Message Date
Jim Meyering d4142ec88e (AUTHORS): Add Paul Eggert. 2001-02-19 08:53:24 +00:00
Jim Meyering 80016947b7 *** empty log message *** 2001-02-19 08:52:58 +00:00
Jim Meyering 5af9b0048f Fix a race condition: freed storage accessed during a signal handler.
(struct tempnode.next): Now volatile.
(zaptemp): Free the file name after removing it from the temp list,
not before, because a signal can arrive between the two actions
and cleanup () traverses the list.
2001-02-19 08:52:53 +00:00
Jim Meyering 9758a4d87a *** empty log message *** 2001-02-19 08:51:00 +00:00
Jim Meyering 3e593e8a31 (jm_CHECK_ALL_HEADERS): Check for sys/resource.h. 2001-02-19 08:50:54 +00:00
Jim Meyering b0abc5579f *** empty log message *** 2001-02-19 08:50:18 +00:00
Jim Meyering 55d155dbbe Check for input size, and do not overallocate memory.
Also check for memory quotas.

Revamp storage management so that line tables and character data are
taken from the same buffer.  Line tables are now in reverse order,
since they grow down while the character data grow up.

(<sys/resource.h>): Include if HAVE_SYS_RESOURCE_H.
(struct rlimit, getrlimit): Define a replacement if RLIMIT_DATA
is not defined.
(RLIMIT_AS): Define to RLIMIT_DATA if not defined.
(struct lines): Remove.
(struct buffer): New members nlines, line_bytes, eof.
Remove member newline_free; no longer needed, since the code no longer
runs out of line table space.
(SORTALLOC_MIN, SORTALLOC_DEFAULT_MIN): Remove.
(sort_size): Renamed from sortalloc; now applies to the sum of the
character data and the line table, not just the character data.
(MIN_SORT_SIZE, INPUT_FILE_SIZE_GUESS): New macros.
(linelength): remove.
(specify_sort_size): Don't worry about the distinction between the
character data and the line table; that is now the caller's
responsibility.
(default_sort_size): Return the value, instead of being executed for
side effect.  Return half of available memory, or 1/16 of total memory,
whichever is greater; except do not exceed 1/2 of quota.
(sort_buffer_size): New function.
(initbuf): New arg LINE_BYTES.  Ensure that the line array is properly
aligned.  Initialize the new set of struct buffer members.
(buffer_linelim): New function.
(fillbuf): Return int, not size_t, since the callers merely care
whether the result is nonzero.  New arg FILE so that error messages
can report the file name.  Keep track of eof.  Initialize the line
table too, taking its memory from the input buffer's memory; this
subsumes the old findlines function and removes the need for worrying
about running out of line table entries.
(checkfp, mergefps, sortlines, merge, sort): Adjust to the new storage
management regime, in particular the fact that line tables are now
filled in by fillbuf and are in reverse order.
(checkfp): Now takes char *, not const char *, since subroutines
require that now.  Rewrite to avoid lint and duplicate code.
If line length alloc calculation overflows,
simply allocate enough memory to hold the line.
(mergefps): New arg FILES, used for buffer size calculation and error
messages.  Rewrite to avoid lint.  Do not loop if savealloc*2
overflows.
(mergefps, merge): Zap temporary files eagerly rather than lazily;
this is needed because we now pass FILES to mergefps.
(sortlines): Args now point at end of arrays, not at beginnings.
(sort): Do not allocate temporary line array for sortlines;
instead, take the space from the same buffer.
(main): Adjust to sort_size and default_sort_size changes.
2001-02-19 08:50:12 +00:00
Jim Meyering 9de8c30c25 *** empty log message *** 2001-02-19 08:46:00 +00:00
Jim Meyering e4db8d3b54 (wc): Rename innermost `buf' to avoid shadowing warning.
(wc): Rename local `wc' to avoid shadowing function name.
2001-02-19 08:42:25 +00:00
Jim Meyering ba74efc7c6 *** empty log message *** 2001-02-18 19:39:38 +00:00
Jim Meyering 2307570c3e (TESTS): Add isatty. 2001-02-18 19:39:33 +00:00
Jim Meyering e9fd7152ff New test, for the bug fixed below. 2001-02-18 19:39:17 +00:00
Jim Meyering be9f2f6ef6 *** empty log message *** FILEUTILS-4_0_41 2001-02-18 16:56:57 +00:00
Jim Meyering 320475d619 *** empty log message *** 2001-02-18 16:27:16 +00:00
Jim Meyering 025068df27 *** empty log message *** 2001-02-18 16:25:57 +00:00
Jim Meyering b7f166b3fd *** empty log message *** 2001-02-18 16:24:26 +00:00
Jim Meyering 57e7dc4cda `chmod 0 file; rm file' would no longer prompt before removal.
(remove_file): Revert last change.
2001-02-18 16:24:21 +00:00
Jim Meyering 325680aae4 *** empty log message *** 2001-02-18 08:50:35 +00:00
Jim Meyering 7446097d1a rename test input files to avoid conflicts on case-insensitive file systems 2001-02-18 08:50:29 +00:00
Jim Meyering 96bbda7216 Update file names to reflect renamings. 2001-02-18 08:49:52 +00:00
Jim Meyering 7f77515e02 *** empty log message *** 2001-02-18 08:49:07 +00:00
Jim Meyering 2714dd0ed2 . 2001-02-18 08:07:42 +00:00
Jim Meyering 7dfaaf5bf1 fix typo FILEUTILS-4_0_40 2001-02-17 18:50:17 +00:00
Jim Meyering 4d30007986 *** empty log message *** 2001-02-17 16:56:27 +00:00
Jim Meyering d07a45be2b Sync from GNU libc. Use double quotes, not <...>
around included file name.
2001-02-17 16:56:20 +00:00
Jim Meyering 438636be9b *** empty log message *** 2001-02-17 16:53:38 +00:00
Jim Meyering ff7797f6e2 (__strnlen): Merge in a change from GNU libc. 2001-02-17 16:53:33 +00:00
Jim Meyering d81e0e6f97 *** empty log message *** 2001-02-17 16:51:03 +00:00
Jim Meyering 787a2cf49f update comments from libc 2001-02-17 16:50:27 +00:00
Jim Meyering 9676083a22 *** empty log message *** 2001-02-17 14:23:54 +00:00
Jim Meyering 8d509a79da (main): `quote' the offending argument. 2001-02-17 14:23:43 +00:00
Jim Meyering 1de5de8401 *** empty log message *** 2001-02-17 13:20:31 +00:00
Jim Meyering e7a4ab5efa (mbrtowc, mbsinit):
Remove workaround macros for hosts that have mbrtowc but not
mbstate_t, as we now insist on proper declarations for both
before using mbrtowc.
2001-02-17 13:18:56 +00:00
Jim Meyering c2223ba418 . 2001-02-17 13:18:17 +00:00
Jim Meyering 5bc2860579 . 2001-02-17 13:17:49 +00:00
Jim Meyering 0c2cd33ac8 *** empty log message *** 2001-02-17 13:17:40 +00:00
Jim Meyering 198a0609cf *** empty log message *** 2001-02-17 13:11:22 +00:00
Jim Meyering 8270c52b6b *** empty log message *** 2001-02-17 13:11:12 +00:00
Jim Meyering 5d223fd617 *** empty log message *** 2001-02-17 12:53:40 +00:00
Jim Meyering a256689440 (jm_LIST_MOUNTED_FILESYSTEMS): Don't check for
getmntent via AC_CHECK_FUNCS, since that would get a `no' and disrupt
further attempts by AC_FUNC_GETMNTENT to check with e.g., -lgen on
UnixWare 7.1.1.
2001-02-17 12:53:36 +00:00
Jim Meyering 557c8b8ae8 *** empty log message *** 2001-02-17 12:44:04 +00:00
Jim Meyering 22bdd77f67 (mbswidth): Also define as macro, to avoid prototype clash. 2001-02-17 12:43:57 +00:00
Jim Meyering fba069f78c . 2001-02-17 11:51:48 +00:00
Jim Meyering 2f4ff2ce9f *** empty log message *** 2001-02-17 10:39:50 +00:00
Jim Meyering ad177f456c (mbrtowc, mbsinit):
Remove workaround macros for hosts that have mbrtowc but not
mbstate_t, as we now insist on proper declarations for both
before using mbrtowc.
2001-02-17 10:39:43 +00:00
Jim Meyering 1f7a13e62e (mbrtowc, mbsinit):
Remove workaround macros for hosts that have mbrtowc but not
mbstate_t, as we now insist on proper declarations for both
before using mbrtowc.
2001-02-17 10:39:17 +00:00
Jim Meyering 78d17132eb *** empty log message *** 2001-02-17 10:37:10 +00:00
Jim Meyering 2a1afebeb4 *** empty log message *** 2001-02-17 10:36:42 +00:00
Jim Meyering 8ec9cd1836 (jm_FUNC_MBRTOWC): Adapt to use AC_CACHE_CHECK etc., rather than AC_CACHE_VAL. 2001-02-17 10:36:33 +00:00
Jim Meyering 11038c572e bump serial number 2001-02-17 09:35:50 +00:00