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"
13 main (int argc UNUSED, char *argv[])
16 unsigned char buf[128 * 1024];
19 test_name = "child-qsort";
22 CHECK ((handle = open (argv[1])) > 1, "open \"%s\"", argv[1]);
24 size = read (handle, buf, sizeof buf);
25 qsort_bytes (buf, sizeof buf);
27 write (handle, buf, size);