A new sort utility

Tim Robbins tjr at FreeBSD.ORG
Mon Sep 15 03:54:01 PDT 2003


The recent thread about BSD-licensed replacements for GNU utilities in OpenBSD
has prompted me to share my reimplementation of the sort(1) utility.
Most of the code is new. sort.1 and obsolete.c came from 4.4BSD via NetBSD.
I've been using it instead of GNU sort on my systems for the past few months,
I've run a few test suites on it, and I think most of the bugs have been
ironed out now.  If anyone's interested, it's available here:
	http://people.freebsd.org/~tjr/sort1.tar.gz

It's not quite as fast as the GNU or 4.4BSD sort implementations, but it's
BSD-licensed, follows the normal BSD coding conventions, has better locale
support than 4.4BSD's (and perhaps GNU's, too), and I believe it's much less
buggy than the 4.4BSD sort (sort -n is horribly broken in 4.4BSD's, see the
NetBSD PR database for an example). It attempts to conform to the POSIX
standards; by default it follows 1003.2-1992, removing the CFLAGS+=-DOBSOLETE
line in the Makefile will make it follow 1003.1-2001.

Comments/patches are welcome. As the "History" suggestion of the manual page
suggests, my plan is to get this in to FreeBSD 6, along with replacements for
some other GNU tools. I have a diff(1) replacement (with sdiff support) in
the works, among other things.


Tim


More information about the freebsd-hackers mailing list