---- qsort.3.orig 2009-05-12 11:21:33.000000000 -0700
-+++ qsort.3 2009-05-20 15:00:21.000000000 -0700
-@@ -40,41 +40,78 @@
+--- qsort.3.orig 2010-10-07 21:23:04.000000000 -0700
++++ qsort.3 2010-10-07 21:24:45.000000000 -0700
+@@ -36,41 +36,78 @@
.Dt QSORT 3
.Os
.Sh NAME
.Ft int
-.Fo mergesort
+.Fo mergesort_b
- .Fa "void *base"
--.Fa "size_t nmemb"
--.Fa "size_t size"
++.Fa "void *base"
+.Fa "size_t nel"
+.Fa "size_t width"
+.Fa "int \*[lp]^compar\*[rp]\*[lp]const void *, const void *\*[rp]"
+#endif
+.Ft void
+.Fo qsort
-+.Fa "void *base"
+ .Fa "void *base"
+-.Fa "size_t nmemb"
+-.Fa "size_t size"
+.Fa "size_t nel"
+.Fa "size_t width"
.Fa "int \*[lp]*compar\*[rp]\*[lp]const void *, const void *\*[rp]"
.Sh DESCRIPTION
The
.Fn qsort
-@@ -84,7 +121,7 @@
+@@ -80,7 +117,7 @@
function is a modified selection sort.
The
.Fn mergesort
intended for sorting data with pre-existing order.
.Pp
The
-@@ -92,19 +129,19 @@
+@@ -88,19 +125,19 @@
and
.Fn heapsort
functions sort an array of
.Dq "sizeof(void *) / 2" .
.Pp
The contents of the array
-@@ -139,7 +176,7 @@
+@@ -135,7 +172,7 @@
.Fn heapsort
are
.Em not
the sorted array is undefined.
The
.Fn mergesort
-@@ -183,8 +220,8 @@
+@@ -179,8 +216,8 @@
The function
.Fn mergesort
requires additional memory of size
bytes; it should be used only when space is not at a premium.
The
.Fn mergesort
-@@ -195,42 +232,83 @@
- Normally,
+@@ -192,19 +229,40 @@
.Fn qsort
is faster than
--.Fn mergesort
+ .Fn mergesort
-is faster than
-+.Fn mergesort ,
+which is faster than
.Fn heapsort .
Memory availability and pre-existing order in the data can make this
+.ds MERGESORT_B mergesort_b
+#endif
+.Rv -std heapsort \*[HEAPSORT_B] mergesort \*[MERGESORT_B]
+ .Sh COMPATIBILITY
+ Previous versions of
+ .Fn qsort
+@@ -213,26 +271,46 @@
+ This is no longer true.
.Sh ERRORS
The
+#ifdef UNIFDEF_BLOCKS
+.Fn heapsort ,
+.Fn heapsort_b ,
-+.Fn mergesort
++.Fn mergesort ,
+and
+.Fn mergesort_b
+#else
+#ifdef UNIFDEF_BLOCKS
+.Fn heapsort ,
+.Fn heapsort_b ,
-+.Fn mergesort
-+and
++.Fn mergesort ,
++or
+.Fn mergesort_b
+#else
.Fn heapsort
--or
-+and
+ or
.Fn mergesort
+#endif
functions