Added some error handling functions to t_apue.c