Research V4 development
[unix-history] / man / man3 / qsort.3
index 54ddebe..21f209b 100644 (file)
@@ -1,42 +1,50 @@
-.pa 1
-.he 'QSORT (III)'6/12/72'QSORT (III)'
-.ti 0
-NAME           qsort -- quicker sort
-.sp
-.ti 0
-SYNOPSIS       (base of data in r1)
-.br
+.th QSORT III 6/12/72
+.sh NAME
+qsort \*- quicker sort
+.sh SYNOPSIS
+.nf
 (end+1 of data in r2)
 (end+1 of data in r2)
-.br
 (element width in r3)
 (element width in r3)
-.br
+.ft B
 jsr pc,qsort
 jsr pc,qsort
-.sp
-.ti 0
-DESCRIPTION    qsort\b\b\b\b\b_____
+.s3
+qsort(base, nel, width, compar)
+char *base;
+int (*compar)( );
+.fi
+.ft R
+.sh DESCRIPTION
+.it Qsort
 is an implementation
 is an implementation
-of the quicker sort algorithm.
-It is designed to sort equal length
+of the quicker-sort algorithm.
+The assembly-language version
+is designed to sort equal length
 elements.
 Registers r1 and r2 delimit the region of
 core containing the array of byte strings to be sorted:
 r1 points to the start of the first string, r2 to the first
 location above the last string.
 Register r3 contains the length of each string.
 elements.
 Registers r1 and r2 delimit the region of
 core containing the array of byte strings to be sorted:
 r1 points to the start of the first string, r2 to the first
 location above the last string.
 Register r3 contains the length of each string.
-r2-r1 should be a multiple of r3.
-On return, r0, r1, r2, r3, r4 are destroyed.
-.sp
+r2\*-r1 should be a multiple of r3.
+On return, r0, r1, r2, r3 are destroyed.
+.s3
 The routine compar (q.v.) is called to compare elements
 and may be replaced by the user.
 The routine compar (q.v.) is called to compare elements
 and may be replaced by the user.
-.sp
-.ti 0
-FILES          kept in /lib/liba.a
-.sp
-.ti 0
-SEE ALSO       compar(III)
-.sp
-.ti 0
-DIAGNOSTICS    --
-.sp
-.ti 0
-BUGS           It scribbles on r4.
+.s3
+The C version has somewhat different arguments
+and the user must supply a comparison routine.
+The first argument is to the base of the data;
+the second is the number of elements;
+the third is the width of an element
+in bytes;
+the last is the name of the comparison routine.
+It is called with two arguments which are pointers
+to the elements being compared.
+The routine must return a negative integer if the
+first element is to be considered less than
+the second, a positive integer if the second
+element is smaller than the first, and 0
+if the elements are equal.
+.sh "SEE ALSO"
+compar (III)
+.sh BUGS