18 unsigned char buf[128 * 1024];
23 CHECK ((handle =
open (argv[1])) > 1,
"open \"%s\"", argv[1]);
int main(int argc UNUSED, char *argv[])
const char * test_name
Reads a 128 kB file onto the stack and "sorts" the bytes in it, using quick sort, a multi-pass divide...
static char buf[BUF_SIZE]
#define UNUSED
GCC lets us add "attributes" to functions, function parameters, etc.
int open(const char *file)
int write(int fd, const void *buffer, unsigned size)
void seek(int fd, unsigned position)
int read(int fd, void *buffer, unsigned size)
#define CHECK(SUCCESS,...)
Takes an expression to test for SUCCESS and a message, which may include printf-style arguments.
void qsort_bytes(unsigned char *buf, size_t size)
Sorts the SIZE bytes in BUF into nondecreasing order, using the quick-sort algorithm.