aboutsummaryrefslogtreecommitdiff
path: root/lib/strerror.c
blob: ac72214bf1fc0322512337c303a996abcf7cd232 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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
}