1 /* Reads a 128 kB file onto the stack and "sorts" the bytes in
2 it, using quick sort, a multi-pass divide and conquer
3 algorithm. The sorted data is written back to the same file
9 #include "tests/main.h"
10 #include "tests/vm/qsort.h"
12 const char *test_name = "child-qsort";
15 main (int argc UNUSED, char *argv[])
18 unsigned char buf[128 * 1024];
23 CHECK ((handle = open (argv[1])) > 1, "open \"%s\"", argv[1]);
25 size = read (handle, buf, sizeof buf);
26 qsort_bytes (buf, sizeof buf);
28 write (handle, buf, size);