summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2001-03-03(main): When fclose (stdin) fails, do not mentionJim Meyering
the output file in the error message; mention "-" instead.
2001-03-03(xfopen): Set have_read_stdin to 1 only if file is "-".Jim Meyering
Use fopen_safer, not fopen, to avoid subtle bugs when fopen returns stdin, stdout, or stderr. (xfclose): stdout is no longer a special case. (main): Close output file, don't just flush it; there might be an error on the close.
2001-03-03(initbuf): If the desired size cannot beJim Meyering
allocated, repeatedly halve it until allocation succeeds.
2001-03-03(parse_field_count): Comment fix.Jim Meyering
2001-03-03Tune allocation and comparison of nodesJim Meyering
representing temp files. This improved CPU performance of 'sort -S 1 *.[ch]' by 17% on my host. (struct tempnode): name member now uses struct hack. (temphead): Now a pointer, not a structure. All uses changed. (create_temp_file): Allocate node using struct hack. (zaptemp): Free node using struct hack. Use pointer comparison, not string comparison.
2001-03-02(eolchar, trim_trailing_blanks): Now static.Jim Meyering
2001-03-02'sort' race condition fixes.Jim Meyering
Defend against a DoS attack where someone else creates a temporary file with the same name as ours. Use mkstemp to do this, supplying our own mkstemp if the system doesn't have one. Also, fix a race condition during cleanup on hosts without sigaction. (NAME_MAX_IN_DIR): Remove. (sigprocmask, sigset_t): New macros, defined only on older hosts. (caught_signals): New var. (xtmpfopen, tempname): Removed. (create_temp_file): New function, combining the functions of the old xtmpfopen and tempname. All callers changed. Use mkstemp to create the file. (sighandler): On hosts without sigaction, ignore signals while cleaning up, instead of letting them interrupt cleanup. (main): Initialize caught_signals. On hosts with sigaction, block all caught signals while handling one. Remove duplicate code.
2001-02-22(keycompare): Move declarations of locals, lena and lenb,Jim Meyering
into the inner scope where they are used.
2001-02-21(main): Remove assignment-in-if-expression.Jim Meyering
In fact, remove t_errno altogether.
2001-02-20(FULL_TIME_OPTION): Renamed from FULL_TIME, forJim Meyering
consistency with the other enum values.
2001-02-20(SI_OPTION): New enum value.Jim Meyering
(long_options): Use it instead of 'H' for --si. (decode_switches): Warn that -H will change soon. (usage): Likewise.
2001-02-20revert last change, until after the releaseJim Meyering
2001-02-20`ls -Fd symlink-to-directory' would print a trailing `/'Jim Meyering
Now it prints a trailing `@'. (gobble_file): Don't clobber lstat stats of command line arguments when using -d and -F (--directory and --classify) options.
2001-02-19(AUTHORS): Add Paul Eggert.Jim Meyering
2001-02-19Fix a race condition: freed storage accessed during a signal handler.Jim Meyering
(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-19Check for input size, and do not overallocate memory.Jim Meyering
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(wc): Rename innermost `buf' to avoid shadowing warning.Jim Meyering
(wc): Rename local `wc' to avoid shadowing function name.
2001-02-18`chmod 0 file; rm file' would no longer prompt before removal.Jim Meyering
(remove_file): Revert last change.
2001-02-17(main): `quote' the offending argument.Jim Meyering
2001-02-17(mbrtowc, mbsinit):Jim Meyering
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-06require 1 argumentJim Meyering
2001-02-06better commentJim Meyering
2001-02-06emit a comment, print numbers one per lineJim Meyering
2001-02-06remove parensJim Meyering
2001-02-06move decl of q into loopJim Meyering
2001-02-06remove n0Jim Meyering
2001-02-04remove --help --version, etcJim Meyering
2001-02-04(usage): Tweak --help output: it prints the _prime_Jim Meyering
factors, not just any factors.
2001-02-04(is_prime): Remove function.Jim Meyering
2001-02-04*** empty log message ***Jim Meyering
2001-02-04*** empty log message ***Jim Meyering
2001-02-04*** empty log message ***Jim Meyering
2001-02-03(main): Change type of index variable to `unsigned int' to avoid a warning.Jim Meyering
2001-02-03(long_opts): Use `strip-trailing-slashes',Jim Meyering
per the documetation, not `strip-trailing-slash'.
2001-02-03(long_options): Use `strip-trailing-slashes',Jim Meyering
per the documetation, not `strip-trailing-slash'.
2001-02-03Improve the performance of `factor' (more than 2x speed-up for large N).Jim Meyering
(wheel_tab): New global table. (WHEEL_START, WHEEL_END): Define. (factor): Remove the loop that special-cased `2'. Instead of incrementing by `2', use the offsets from the wheel table. From Michael Steffens.
2001-01-28(main): Remove decl of unused local, `len'.Jim Meyering
2001-01-28(gobble_file): Add a FIXME comment.Jim Meyering
2001-01-28[FULL_TIME]: Define.Jim Meyering
(long_options): Use it. (decode_switches): Make --full-time imply -l.
2001-01-26(main): Declare local result as non-const, now that it's freed.Jim Meyering
2001-01-22(remove_file): Correct an expression to avoid makingJim Meyering
an unnecessary call to euidaccess for each file.
2001-01-17(main): Likewise.Jim Meyering
2001-01-17(PACKAGE): Likewise.Jim Meyering
2001-01-17(main): Likewise.Jim Meyering
2001-01-17(case_GETOPT_VERSION_CHAR): Use PACKAGE, not GNU_PACKAGE.Jim Meyering
2001-01-17(main): Use PACKAGE, not GNU_PACKAGE.Jim Meyering
2001-01-17(usage): Convert each TAB in --help output to a sequence of 8 spaces.Jim Meyering
2001-01-17(main): Use PACKAGE, not GNU_PACKAGE.Jim Meyering
2001-01-14(UINT_MAX_32_BITS): Define.Jim Meyering
Use UINT_MAX_32_BITS in the cpp conditions that determine the `word32' typedef. Using a literal `0xffffffff' failed with HPUX10.20's /bin/cc.
2001-01-14[RENAME_TRAILING_SLASH_BUG]: Use the rename wrapper.Jim Meyering