Age | Commit message (Collapse) | Author |
|
|
|
|
|
|
|
Rather than this: error (..., "...`%s'...", arg);
do this: error (..., "...%s...", quote (arg));
|
|
|
|
|
|
comparison functions.
Include "strnumcmp.h".
(NEGATION_SIGN, NUMERIC_ZERO, fraccompare):
Remove; moved to strnumcmp.
(decimal_point): Now int, to simplify converison overhead with
new API. All uses changed.
(thousands_sep): Now -1 if there isn't one, as per new API.
All uses changed.
(numcompare): Move contents to strnumcmp module, except for
skipping blanks.
|
|
|
|
|
|
|
|
(short_options): New constant, which always supports -y arg.
(COMMON_SHORT_OPTIONS): Remove.
|
|
(create_temp_file): Use fd_safer.
(xfclose): Don't assume fileno (stdin) == STDIN_FILENO, etc.
|
|
All uses changed.
(siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
(main) [! SA_NOCLDSTOP]: Use it.
|
|
|
|
|
|
when comparing new line to lines already in main memory.
|
|
Assume setlocale exists.
(thousands_sep): Renamed from th_sep.
(IS_THOUSANDS_SEP): Remove. All uses replaced by comparisons.
(NONZERO): Parenthesize use of arg.
(numcompare): Avoid duplicate loads. Use ISDIGIT as boolean, for
consistency. Avoid unnecessary negation by reversing
fraccompare args.
(main): Rewrite localeconv call to match seq.c.
|
|
|
|
Prune unnecessary accesses to volatile locations, and take some
code out of the critical section that didn't need to be in it.
|
|
|
|
(temptail): New variable, so that we can easily append to list.
(create_temp_file): Create new files at end of list, so that
searching the list has O(N**NMERGE) behavior instead of O(N**2).
(zaptemp): Update temptail if needed.
(mergefps, merge): Accept new arg that counts temp files, and keep it
up to date as we create and remove temporaries. This is for
efficiency, so that we don't call zaptemp so often.
All callers changed.
(sort): Don't create array in reverse order, since the list of
temporaries is now in the correct order.
(zaptemp): Protect against race condition: if 'sort' is
interrupted in the middle of zaptemp, it might unlink the
temporary file twice, and the second time this happens the file
might already have been created by some other process.
(create_temp_file): Use offsetof for clarity.
(die): Move it up earlier, to clean up the code a bit.
|
|
|
|
(avoid_trashing_input): New function.
(merge): Avoid some silly merges, e.g., copying a single file to
a temporary file when there are exactly 17 input files to merge.
Take a count of temporary files rather than a max_merge arg.
All uses changed.
|
|
since close_stdout now closes stdout unconditionally.
|
|
first_same_file, merge, sort, main): Use size_t for indexes into arrays.
This fixes some unlikely havoc-wreaking bugs (e.g., more than INT_MAX
temporary files).
(getmonth, keycompare, compare): Rewrite to avoid need for alloca,
thus avoiding unchecked stack overflow in some cases. As a side
effect this improve the performance of "sort -M" by a factor of 4
on my benchmarks.
|
|
|
|
"sort -y abc" is like "sort abc" whereas "sort -y 100" is like
plain "sort".
|
|
A null file arg means standard output.
(main): "-o -" means to write to a file named "-",
not to standard output.
|
|
|
|
(IS_THOUSANDS_SEP): Use bool when appropriate.
(numcompare, main): Use char, not int, when the value is always a char.
(numcompare): Remove "register"; compilers are smart enough these days.
|
|
too few operands ("missing operand after `xxx'") or
too many operands ("extra operand `xxx'").
Include "quote.h" and/or "error.h" if it wasn't already being included.
|
|
|
|
|
|
making some contrived examples unsafe. POSIX allows this
optimization. Performance problem reported by Jonathan Baker in
<http://mail.gnu.org/archive/html/bug-coreutils/2004-05/msg00071.html>.
(first_same_file): Do not treat input pipes
differently from other files.
|
|
|
|
leading blanks when computing the location of the field end;
it is not supposed to skip trailing blanks. Solaris 8 "sort"
does conform to POSIX. Also fix the documentation to clarify
this and related issues.
(limfield): Use skipeblanks, not skipsblanks, to
decode whether to skip leading blanks.
(trailing_blanks): Remove.
(fillbuf, getmonth, keycompare): Don't trim trailing blanks.
|
|
similar to other coreutils programs. When processing signals,
block all signals that we catch, but do not block signals that we
don't catch. Avoid problems with unsigned int warnings.
(sighandler) [defined SA_NOCLDSTOP]:
Use simpler "signal (sig, SIG_DFL)" rather than sigaction equivalent.
|
|
the help2man-generated (line-joined) man page is more readable.
Reported by Tim Waugh.
[-T]: Add a semicolon, for the same reason.
|
|
(main): Use initialize_exit_failure rather than
setting exit_failure directly; this optimizes away redundant
assignments.
Don't include <assert.h>.
(SORT_OUT_OF_ORDER, SORT_FAILURE): Now enums, not macros.
(usage): Don't use 'assert'.
(main): Remove redundant assignment to exit_failure.
|
|
(fillbuf): Use x2nrealloc rather than xrealloc.
(sort): Use xnmalloc rather than xmalloc.
(main): Likewise.
|
|
|
|
The former is more maintainable and usually shorter.
(sort): Split a long line.
|
|
of 2003-09-19. Now, AUTHORS is a comma-separated list of strings.
Update the call to parse_long_options so that `AUTHORS, NULL' are the
last parameters.
* src/true.c (main): Append NULL to version_etc argument list.
* src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
|
|
and invalid suffix char are both reported.
|
|
|
|
Begin each WRITTEN_BY string with `Written by ' and end it with `.'.
Mark each WRITTEN_BY string as translatable.
|
|
|
|
the call to parse_long_options so that `AUTHORS, NULL' are the last parameters.
|
|
shadowing the math function name. Also rename loga to log_a.
|
|
<http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00008.html>.
(sort_buffer_size): Omit SIZE_BOUND arg. Compute the
size_bound ourselves. if an input file is a pipe and the user
specified a size, use that size instead of trying to guess the
pipe size. This has the beneficial side effect of avoiding the
overhead of default_sort_size in that case. All callers changed.
(sort): Remove static var size; now done by sort_buffer_size.
|