diff options
author | comex | 2015-01-21 17:12:04 -0500 |
---|---|---|
committer | comex | 2015-01-21 17:12:04 -0500 |
commit | 894c8c65ee8ad57e91ff1fa3b6b87202aee551f9 (patch) | |
tree | 5a84db882c60fb411215285f1e06201d9c89dd68 /lib/strerror.c | |
parent | minor cleanup - stop caring about thumb outside of arch-specific code (diff) | |
download | substitute-894c8c65ee8ad57e91ff1fa3b6b87202aee551f9.tar.gz |
add substitute_strerror
Diffstat (limited to 'lib/strerror.c')
-rw-r--r-- | lib/strerror.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/strerror.c b/lib/strerror.c new file mode 100644 index 0000000..ac72214 --- /dev/null +++ b/lib/strerror.c @@ -0,0 +1,22 @@ +#include "substitute.h" +#include "substitute-internal.h" + +EXPORT +const char *substitute_strerror(int err) { + #define CASE(code) case code: return #code + switch (err) { + CASE(SUBSTITUTE_OK); + CASE(SUBSTITUTE_ERR_FUNC_TOO_SHORT); + CASE(SUBSTITUTE_ERR_FUNC_BAD_INSN_AT_START); + CASE(SUBSTITUTE_ERR_FUNC_JUMPS_TO_START); + CASE(SUBSTITUTE_ERR_OOM); + CASE(SUBSTITUTE_ERR_VM); + CASE(SUBSTITUTE_ERR_UNKNOWN_RELOCATION_TYPE); + CASE(SUBSTITUTE_ERR_NO_SUCH_SELECTOR); + CASE(SUBSTITUTE_ERR_TASK_FOR_PID); + CASE(SUBSTITUTE_ERR_MISC); + default: + return "(unknown libsubstitute error)"; + } + #undef CASE +} |