diff options
author | Mitya Selivanov <automainint@guattari.tech> | 2023-09-02 20:59:29 +0200 |
---|---|---|
committer | Mitya Selivanov <automainint@guattari.tech> | 2023-09-02 20:59:29 +0200 |
commit | 835e1fcd131c63ee2b3b647e327b33a3bfb369e3 (patch) | |
tree | 9d6fb42d6296a7bbec4a6ea58358c0fdb5de7e05 /source/kit_test/shared.inl.h | |
parent | 34ba87d8c8cfef5ed249b34bd2d2b7e41a34d2f7 (diff) | |
download | kit-835e1fcd131c63ee2b3b647e327b33a3bfb369e3.zip |
[Linux] Change build system; Remove CMake
Diffstat (limited to 'source/kit_test/shared.inl.h')
-rw-r--r-- | source/kit_test/shared.inl.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/source/kit_test/shared.inl.h b/source/kit_test/shared.inl.h new file mode 100644 index 0000000..e31c9f3 --- /dev/null +++ b/source/kit_test/shared.inl.h @@ -0,0 +1,38 @@ +#ifndef KIT_TEST_SHARED_INL_H +#define KIT_TEST_SHARED_INL_H + +#ifndef _GNU_SOURCE +# define _GNU_SOURCE +#endif + +#include <setjmp.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> + +enum { white, blue, light, yellow, red, green }; + +static char const *const color_codes[] = { + [white] = "\x1b[38m", [blue] = "\x1b[34m", [light] = "\x1b[37m", + [yellow] = "\x1b[33m", [red] = "\x1b[31m", [green] = "\x1b[32m" +}; + +static int print_color(int c) { + return printf("%s", color_codes[c]); +} + +static int const signums[] = { SIGINT, SIGILL, SIGABRT, + SIGFPE, SIGSEGV, SIGTERM }; + +static char const *const signames[] = { + [SIGINT] = "Interactive attention signal", + [SIGILL] = "Illegal instruction", + [SIGABRT] = "Abnormal termination", + [SIGFPE] = "Erroneous arithmetic operation", + [SIGSEGV] = "Invalid access to storage", + [SIGTERM] = "Termination request" +}; + +#endif |