C code from the book "Linux Programming by Example"