summaryrefslogtreecommitdiff
path: root/src/sort.c
AgeCommit message (Collapse)Author
2003-05-09fix off-by-one error in last changeJim Meyering
2003-05-09(main): Don't overrun array bound if argc is 0.Jim Meyering
That would happen when invoked via: execl ("/usr/bin/sort", NULL);
2003-04-11Remove anachronistic casts of xmalloc,Jim Meyering
xrealloc, and xcalloc return values and of xrealloc's first argument.
2002-12-15Remove all uses of `PARAMS'.Jim Meyering
2002-11-10(main): Also declare `i' to be unsigned, not int.Jim Meyering
2002-11-10(sighandler): Use raise, rather than kill+getpid.Jim Meyering
(main): Declare `nsigs' to be unsigned, not int.
2002-11-05(checkfp): Use primitives from inttostr.h, not human.h,Jim Meyering
to print large numbers simply.
2002-10-08(begfield, limfield): Don't advance the write pointer past theJim Meyering
end of the write buffer.
2002-09-28(begfield, limfield): Rearrange comparisons to avoid compiler warnings.Jim Meyering
(fillbuf, keycompare): Cast literal `-1' to size_t in comparisons, to avoid compiler warnings.
2002-08-08Guard inclusion of <langinfo.h> withJim Meyering
`#if HAVE_LANGINFO_CODESET', not `#if HAVE_LANGINFO_H'.
2002-07-29Adjust command examples in comments to use POSIX 1003.1-2001 option syntax.Jim Meyering
From Paul Eggert.
2002-07-02(usage): Use the PACKAGE_BUGREPORT e-mail address, rather than hard-coding it.Jim Meyering
2002-04-30(keycompare, compare): Replace #ifdef ENABLE_NLS with if (HAVE_SETLOCALE).Jim Meyering
(hard_LC_COLLATE): Define even if ! ENABLE_NLS. (main): Always initialize hard_LC_COLLATE. Put initialization next to other locale-related stuff. Include <langinfo.h> even if ! ENABLE_NLS. (decimal_point, th_sep): Depend on HAVE_SETLOCALE, not ENABLE_NLS. (main): Likewise. (MONTHTAB_CONST): Remove; all uses removed. (struct_month_cmp, inittables): Do not depend on ENABLE_NLS. (main): hard_LC_TIME locale does not depend on ENABLE_NLS.
2002-02-16Include posixver.h.Jim Meyering
(usage): Document only the intersection of the old and new behaviors, to encourage portability. (short_options): Remove; no longer needed. (COMMON_SHORT_OPTIONS): New macro. (main): Parse options using POSIX 1003.1-2001 rules if conforming to that standard. Do not warn of obsolete options.
2002-02-02Add more support for POSIX 1003.1-2001, which requires removal forJim Meyering
support of obsolete "-N" option syntax in expand, head, fold, split, tail, unexpand, uniq, and which prohibits options with optional arguments in od and pr. (main): Check for obsolete options. (short_options): New constant.
2002-01-22Include xmemcoll.h, not memcoll.h.Jim Meyering
Use xmemcoll instead of memcoll. (die): Do not invoke cleanup; atexit does this now. (main): Use atexit to invoke cleanup on exit. Set xmemcoll_exit_failure to SORT_FAILURE.
2002-01-21(CMP_WITH_IGNORE): Don't assume that the differenceJim Meyering
between two size_t values can be stored in an int; this doesn't work, for example, on 64-bit Solaris.
2002-01-21Don't include "xalloc.h", as system.h already does that via sys2.h.Jim Meyering
2002-01-18(main): Issue a warning for obsolete usage, unless POSIXLY_CORRECT.Jim Meyering
2002-01-16Add support for POSIX 1003.1-2001, which requires removal forJim Meyering
support of obsolete "+" option syntax in sort, tail, and uniq. (usage, main): Implement this.
2002-01-14(mergefps): Fix bug when eliminating empty files.Jim Meyering
2001-12-20(usage, specify_sort_size): Accept 'K' (which isJim Meyering
now preferred, as it connotes 1024) as well as 'k'.
2001-12-01Reflect renaming to, and new usage of these macros:Jim Meyering
HELP_OPTION_DESCRIPTION and VERSION_OPTION_DESCRIPTION.
2001-12-01(usage): Use new macros, EMIT_HELP_DESCRIPTION and EMIT_VERSION_DESCRIPTIONJim Meyering
instead of hard-coding --help and --version descriptions.
2001-11-23Factor out some common strings to make translation easier.Jim Meyering
Split usage strings so that --help and --version descriptions are alone in their own string. Likewise for the one that says: Mandatory arguments to long options are mandatory for short options too.
2001-11-11(usage): Fix typo in last change to usage.Jim Meyering
2001-11-11(struct_month_cmp): Guard definition with the sameJim Meyering
cpp directive that guards the use.
2001-11-11(usage): Split --help output into smaller pieces.Jim Meyering
Use fputs, not printf.
2001-11-05(usage): Don't recommend setting LC_COLLATE=C.Jim Meyering
That can cause problems (now documented in coreutils.texi).
2001-11-04(usage): Say thatJim Meyering
``Mandatory arguments to long options are mandatory for short options too.\n\''
2001-08-26(mergefps): Do not allocate at least sort_size bytes for each merge buffer.Jim Meyering
Instead, allocate at least sort_size bytes total.
2001-08-13(AUTHORS): Mark string for translation, since it contains the English word ↵Jim Meyering
`and'.
2001-07-01(usage): Suggest setting LC_COLLATE=C, rather than LC_ALL=C.Jim Meyering
2001-04-15(default_sort_size): Leave a 1/16 margin for RSS.Jim Meyering
2001-04-13(main): Add a comment justifying the use ofJim Meyering
`multi-character' rather than `multibyte' in a diagnostic.
2001-04-13(RLIMIT_AS): Do not define; just use conditionalJim Meyering
code, since RLIMIT_RSS is similar (and is not standardized). (default_sort_size): Don't allocate more than the RSS limit, if this host has such a limit.
2001-04-02Include <getopt.h>.Jim Meyering
(usage, main): Add support for long options, and check option syntax as POSIX requires, though (as usual for GNU apps) options can follow file names unless POSIXLY_CORRECT is set. Many diagnostic revamped. (long_options): New constant. (badfieldspec): New arg MSGID. Mark as noreturn. (parse_field_count): New arg MSGID; if null, just return null on error. (new_key): Renamed from key_init. All callers changed. Now allocates the new key.
2001-03-18(usage): Warn that the +N form will be withdrawn.Jim Meyering
2001-03-13(die): New message arg, to describe failuresJim Meyering
better. All callers changed.
2001-03-13Decrease buffer size when only merging or checking.Jim Meyering
(sort_size): Now the user-specified sort size. (MIN_MERGE_BUFFER_SIZE): New macro. (MIN_SORT_SIZE): Use it. (merge_buffer_size): New variable. (fillbuf): Increase merge_buffer_size if a longer line is encountered. (checkfp, mergefps): Do not allocate a buffer smaller than merge_buffer_size. (sort): Use the default_sort_size if sort_size is zero. (main): Do not set sort_size to default_sort_size.
2001-03-13(sort): If all the input files are empty, create an empty output file.Jim Meyering
2001-03-13(merge): Move declarations of local variables intoJim Meyering
the inner scope where they're used. (sort): Likewise.
2001-03-13Do not include closeout.h.Jim Meyering
(xfopen): Use stdout if *how != 'r'. (mergefps): Remove FPS arg. Open all input files, and close all files when done. If OFP is null, open the output file (but after opening input files). All callers changed. (first_same_file): New function. (sort, merge): Remove arg OFP; we now open the output file as needed. All callers changed. (merge): New arg MAX_MERGE. All callers changed. (sort): For "sort F -o F", close the input before opening the output. (main): Do not use close_stdout; 'sort' and 'merge' now close stdout. (This also fixes a close-stdout-twice bug.) Remove test for overlapping input and output files, as 'sort' no longer needs to worry about overlap, and 'merge' checks for overlap itself. Use first_same_file to inform 'merge' about how much to merge at the top level, to avoid overlap.
2001-03-03(die): New function.Jim Meyering
(create_temp_file, xfopen, xfclose, write_bytes, sort_buffer_size, fillbuf, main): Use it to regularize error messages. The only change in behavior is that write_bytes and the final close used to say "write error" but now give just the output file name, which should be enough.
2001-03-03(xfclose): Add FILE arg, and report the file nameJim Meyering
on error. All callers changed.
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.