summaryrefslogtreecommitdiffstats
path: root/usr.bin/sort/sort.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Add parentheses to suppress compiler warning.brad2014-10-261-3/+3
| | | | | | sort.c:295:35: warning: '&&' within '||' [-Wlogical-op-parentheses] ok guenther@
* Userland reallocarray() audit.doug2014-10-111-3/+3
| | | | | | | Avoid potential integer overflow in the size argument of malloc() and realloc() by using reallocarray() to avoid unchecked multiplication. ok deraadt@
* repair buffer resizing "undershoot", and some minor issues withderaadt2013-11-131-3/+4
| | | | | math on void * assistance from guenther, ok millert
* fdopen(3) return a FILE * not an int, so compare against NULL.gsoares2012-10-301-2/+2
| | | | | | no functional change OK millert@
* implement -C (silent -c), required by POSIX.1-2008;schwarze2009-12-221-6/+12
| | | | | patch from Daniel Dickman <didickman at gmail dot com> tweaked by me; "looks ok" millert@, manual help and ok jmc@
* Don't catch a signal if we inherited it as ignored. Instigated byguenther2009-10-281-3/+6
| | | | | | comments from Matt Fisher (mfisher_ix at maine.rr.com). ok otto@
* rcsid[] and sccsid[] and copyright[] are essentially unmaintained (andderaadt2009-10-271-15/+1
| | | | | | | unmaintainable). these days, people use source. these id's do not provide any benefit, and do hurt the small install media (the 33,000 line diff is essentially mechanical) ok with the idea millert, ok dms
* sort usage();jmc2007-08-221-3/+3
|
* Add a -s option to make the radix sort be a stable sort. Based onmillert2007-08-211-5/+8
| | | | a diff from Eric Gouyer. Closes PR 5553. OK deraadt@
* Use separate buffers in fsort.c and msort.c. Fixes a problem withmillert2007-03-131-6/+3
| | | | | buffer corruptions for some very large files. Also fixes some TRECHEADER vs. RECHEADER mismatches. Back in after unlock.
* some bug (in sort? or compiler) gets hit too late in the release cycle.deraadt2007-03-111-3/+6
| | | | please try again right after release.
* Use separate buffers in fsort.c and msort.c. Fixes a problem withmillert2007-03-071-6/+3
| | | | | buffer corruptions for some very large files. Also fixes some TRECHEADER vs. RECHEADER mismatches. OK deraadt@ otto@ ray@
* Remove useless code that can cause a SEGV if a buffer is realloc()ed.millert2006-10-291-2/+10
| | | | | | Allocate buffers early and in one place instead of two. Make bufend global so it can be updated along with buffer. OK deraadt@
* revert previous change; causes segfault when called fromnaddy2006-10-281-9/+2
| | | | pkg_mklocatedb/locate.mklocatedb
* Remove useless code that can cause a SEGV if a buffer is realloc()ed.millert2006-10-181-2/+9
| | | | | Allocate buffers early and in one place instead of two. Fixes PR 5252; OK deraadt
* remove ellipsis from -k in usage();jmc2005-10-041-3/+3
|
* sort options and sync usage();jmc2005-09-281-4/+5
| | | | some help from dlg@
* add a -z option that allows you to split records on the nul characterdlg2005-09-271-4/+11
| | | | | | | ('\0'). useful in combination with things like "find . -print0" and "xargs -0". for dewi, a chump. ok deraadt@
* remove silly optimization which should eventually savemoritz2005-04-111-5/+3
| | | | a syscall, when it were not broken. ok otto@
* ARGSUSED before signal handler with unused signoderaadt2004-09-141-2/+3
|
* do not init SINGL_FLD, SEP_FLAG twice; from robert nagymickey2004-03-171-3/+2
|
* protosderaadt2003-06-261-3/+3
|
* mostly ansi cleanup; pval okderaadt2003-06-101-10/+6
|
* Remove the advertising clause in the UCB license which Berkeleymillert2003-06-031-7/+3
| | | | rescinded 22 July 1999. Proofed by myself and Theo.
* Use PATH_MAX, not _POSIX_PATH_MAX for filename buffers.millert2003-03-301-4/+4
|
* Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.millert2002-02-161-5/+5
|
* Repair brain-damaged struct sigaction initialization.millert2001-11-171-4/+6
| | | | Noticed by Theo.
* Bring in some recent fixup's from NetBSD. This allows lines longer than 65522ericj2001-02-041-3/+6
| | | | | to be properly sorted. Many other cleanup's done, and depreciate register. millert@ and deraadt@ ok.
* mark remaining signal races which are difficult to fix, and fix a few partiallyderaadt2001-01-191-3/+3
|
* warnx?/errx? paranoia (use "%s" not a bare string unless it is amillert2000-06-301-8/+8
| | | | | | | | | constant). These are not security holes but it is worth fixing them anyway both for robustness and so folks looking for examples in the tree are not misled into doing something potentially dangerous. Furthermore, it is a bad idea to assume that pathnames will not include '%' in them and that error routines don't return strings with '%' in them (especially in light of the possibility of locales).
* Using mkstemp to create permanent files is possible, but thenespie1999-11-301-3/+11
| | | | | | the file mode needs tweaking to look like normal file creation. Approved by millert@, noticed by my students at Epita. Thanks guys !
* Dynamically allocate memory for structures whose sizes are based on themillert1999-05-241-9/+21
| | | | number of keys given. Closes PR #825.
* put -H in synopsis; aaron@ug.cs.dal.caderaadt1998-07-241-3/+3
|
* use warnx()mickey1998-07-201-3/+4
|
* indentderaadt1998-07-201-3/+3
|
* fix usage correctlyderaadt1998-07-201-5/+7
|
* consolidate printfsmickey1998-07-201-4/+4
|
* 64bit fixes. Some of these are a bit bogus as there were "long"smillert1997-06-301-3/+3
| | | | | meant to be file offsets for fseek(3). However, those values could never be > an int anyay so it is not a problem.
* Normalize treatment of -n option. Don't know why it was ever special-casedmillert1997-06-161-11/+5
| | | | (since it was broken that way). Fixes PR user/220.
* Cosmetic cleanup, mostly KNF.millert1997-06-161-9/+28
|
* for implied stdin, do not corrupt argv[0]deraadt1997-01-261-5/+11
|
* Fix some err(3) usage and usage string.millert1997-01-221-7/+7
|
* sort(1) from 4.4BSD-lite2 with minor tweaks and bug fixes by me.millert1997-01-201-0/+297