i would second doug's comment.
a technique i have found useful (but not usable all the time) is for
routines to return a char *. on success this is 0, on error it is the actual
error message. simple to use, e.g.
if(e = poot(args)){
fprintf(stderr, "%s\n", e);
exit(1);
}