X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=util%2Futil.c;fp=util%2Futil.c;h=06659b3506b1f384a4affa58560cff8acbca779d;hp=0000000000000000000000000000000000000000;hb=85d9219a62c23c3ff58b42a63b65390526b89b6b;hpb=3c13bc0321baaf340663779d6fce2b1f34c1c2c3 diff --git a/util/util.c b/util/util.c new file mode 100644 index 00000000..06659b35 --- /dev/null +++ b/util/util.c @@ -0,0 +1,24 @@ +#include "util.h" +#include "error_util.h" +#include +#include + +const char * +util_error_string (util_status_t errnum) +{ + switch (errnum) { + case UTIL_SUCCESS: + return "success"; + case UTIL_OUT_OF_MEMORY: + return "out of memory"; + case UTIL_EOF: + return "end of file"; + case UTIL_ERRNO: + return strerror (errno); + case UTIL_GZERROR: + /* we lack context to be more informative here */ + return "zlib error"; + default: + INTERNAL_ERROR("unexpected error status %d", errnum); + } +}