Use while loop when processing input data in klunk_process_input.
Better return values in klunk_write, klunk_write_error and klunk_finish.
Use 1 as state bit also.
Extended test to include operations on file descriptors.
More checks for error results from functions.