diff options
author | 諏訪子 <suwako@076.moe> | 2024-06-21 21:48:02 +0900 |
---|---|---|
committer | 諏訪子 <suwako@076.moe> | 2024-06-21 21:48:02 +0900 |
commit | 27ae570d688aedd40c3e175b746ee900d08b81d8 (patch) | |
tree | 49e1c75c7ca54bf3f54c603016f14307fc9aef9b /src | |
parent | 0556b433bf6f58d837dae4b74ddea25260ca64c8 (diff) |
libcの情報
Diffstat (limited to 'src')
-rw-r--r-- | src/libc.c | 24 | ||||
-rw-r--r-- | src/libc.h | 6 |
2 files changed, 30 insertions, 0 deletions
diff --git a/src/libc.c b/src/libc.c new file mode 100644 index 0000000..9b3a129 --- /dev/null +++ b/src/libc.c @@ -0,0 +1,24 @@ +#include "libc.h" +#include "common.h" + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +const char *display_libc() { +#if defined(__linux__) + const char *musl = run_command_s("ldd $(which ls) | grep libc | grep musl)"; + if (musl != NULL && strlen(musl) != 0) { + free((void *)musl); + return "musl"; + } + + const char *glibc = run_command_s("ldd $(which ls) | grep libc | grep gnu"); + if (glibc != NULL && strlen(glibc) != 0) { + free((void *)glibc); + return "glibc"; + } +#endif + + return NULL; +} diff --git a/src/libc.h b/src/libc.h new file mode 100644 index 0000000..0558a77 --- /dev/null +++ b/src/libc.h @@ -0,0 +1,6 @@ +#ifndef LIBC_H +#define LIBC_H + +const char *display_libc(); + +#endif |