summaryrefslogtreecommitdiff
path: root/usr.bin/sort
AgeCommit message (Collapse)Author
2015-04-05Document that some sorts uses -b w/o key fields.Todd C. Miller
2015-04-05For the -g flag, treat non-floating point keys as 0, similar to -n.Todd C. Miller
This makes "sort -gu" and "sort -nu" behave similarly and passes our sort regress tests.
2015-04-05The -b flag should only apply when key fields are specified.Todd C. Miller
If -b follows -k it has no effect.
2015-04-05Do not permute command line arguments but still support theTodd C. Miller
obsolescent "-o outfile" after input files syntax.
2015-04-03Only one input file is allowed with the -c/-C flags.Todd C. Miller
2015-04-03The combination of -c and -o is not specified by POSIX. In fact, the callTobias Stoeckmann
"sort -o file -c file" has unspecified behavior and would leave an empty file behind if it was sorted, the original file it was not. If -c (or -C) has been specified, only perform that action and ignore -o among other arguments. While at it, clean up check() internals. with input by and ok millert@
2015-04-03If -S has been supplied multiple times, only take last one into account.Tobias Stoeckmann
Without this patch, multiple -S arguments influence each other. spotted by and ok millert@
2015-04-02murder excessive whitespaceTheo de Raadt
2015-04-02Prevent integer overflow when parsing -S argument as percentage.Tobias Stoeckmann
Also make sure that the parsed memory amount, stored in a long long, won't be larger than SIZE_MAX to properly support 32 bit systems. with input by and ok millert@
2015-04-02Global variable free_memory is only used in sort.c's set_hw_params,Tobias Stoeckmann
so turn it into a local one. ok millert@
2015-04-02Fixed whitespace issues.Tobias Stoeckmann
ok millert@
2015-04-02Zap some more NULL checks in front of free.Tobias Stoeckmann
ok millert@
2015-04-02No need to strdup environment variable or command line arguments here.Tobias Stoeckmann
ok millert@
2015-04-02Add signal name instead of array index (which is not the signal number)Tobias Stoeckmann
to sigaction error message. with input by and ok millert@
2015-04-02Don't need to include stdint.hTodd C. Miller
2015-04-02No need for the umask() dance now that temp files are createdTodd C. Miller
with mkstemp(). Also remove useless else after a return.
2015-04-02Don't install signal handlers for SIGQUIT, SIGVTALRM, SIGPROF.Todd C. Miller
2015-04-02When using mmap() we don't need to keep the open fd around, closingTodd C. Miller
the fd does not unmap the region.
2015-04-02closefile() already checks for stdin so no need to check in the caller.Todd C. Miller
2015-04-01Check for overflow when handling buffer size suffixes.Todd C. Miller
2015-04-01Block signals during tmp_files insertion, so that the signal handlerTheo de Raadt
cannot encounter an incoherent list. It was an absolutely tiny signal race. ok millert
2015-04-01Use reallocarray instead of malloc.Todd C. Miller
2015-04-01Just use sort_reallocarray() everywhere.Todd C. Miller
2015-04-01Revert unintentional commit. This will be revisited shortly.Todd C. Miller
2015-04-01Style nits, remove whitespace at the start of a function.Todd C. Miller
2015-04-01Remove some unneeded NULL checks that don't really help anything.Todd C. Miller
It is better to crash when given bad input rather than producing a wrong result. None of the checks can actually be triggered.
2015-04-01Use exit value 2 for mutually exclusive option errors.Todd C. Miller
2015-04-01Fix typo in revision 1.55Todd C. Miller
2015-04-01Remove some unneeded NULL checks that don't really help anything.Todd C. Miller
It is better to crash when given bad input rather than producing a wrong result. None of the checks can actually be triggered.
2015-04-01Let reallocarray do the multiplication for us.Todd C. Miller
2015-04-01Use reallocarray.Todd C. Miller
2015-04-01Fix last instance of malloc(n * sizeof(char)) idiom.Todd C. Miller
2015-04-01The argument to --sort is not optional so no need to check for NULL optarg.Todd C. Miller
2015-04-01No need for if (x) free(x) style checks, this is not K&R.Todd C. Miller
2015-04-01No need for an else clause after a continue, it just makes theTodd C. Miller
code harder to read.
2015-04-01Style nits, remove whitespace at the start of a function.Todd C. Miller
2015-04-01If strtoul() fails to parse the argument to -k, just pass theTodd C. Miller
error back to the caller instead of calling err() directly. The user gets a more useful error message this way.
2015-04-01Use memcpy() not strncpy() when dynamically allocating and copyingTodd C. Miller
a substring.
2015-04-01Pass size of sopts buffer in to parse_pos_obs() for a length check andTodd C. Miller
use size_t not int for column and field vars.
2015-04-01Use mkstemp to generate a new temporary file name.Tobias Stoeckmann
ok millert
2015-04-01Better range checking for "sort -S" memory size.Todd C. Miller
2015-04-01Use strtonum() to parse argument to --batch-size and document theTodd C. Miller
minimum value in the manual.
2015-04-01Remove unused len variable.Todd C. Miller
2015-03-31Remove a useless use of cat.Tobias Stoeckmann
ok millert
2015-03-31Ignore TMPDIR environment variable if setuid or setgid.Todd C. Miller
2015-03-31There's no good reason to make -m and -c mutually exclusive.Todd C. Miller
Other sorts don't care and our regress uses this.
2015-03-31Add missing call to atexit() to clean up temp files on error.Todd C. Miller
Use mkstemp() to create the temp file when "sort -o" specifies the same name as an input file and preserve the original file mode on the temp file. Check for write access on the original file before creating the temporary. Based on a diff from and OK bluhm@
2015-03-30Use _exit() from signal handler so we don't call atexit handlers orTodd C. Miller
flush stdio.
2015-03-30Do not install signal handlers for SIGABRT, SIGBUS or SIGSEGV. AlsoTodd C. Miller
install signal handlers for SIGPIPE, SIGXCPU, SIGXFSZ, SIGVTALRM, and SIGPROF to match the old sort.
2015-03-30Use sort_asprintf()Todd C. Miller