libcの情報
このコミットが含まれているのは:
コミット
27ae570d68
9
main.c
9
main.c
|
@ -16,6 +16,7 @@
|
|||
#include "src/resolution.h"
|
||||
#include "src/wm.h"
|
||||
#include "src/shell.h"
|
||||
#include "src/libc.h"
|
||||
#include "src/cpu.h"
|
||||
#include "src/gpu.h"
|
||||
#include "src/memory.h"
|
||||
|
@ -209,6 +210,13 @@ int main(int argc, char *argv[]) {
|
|||
lc++;
|
||||
}
|
||||
|
||||
const char *libc = display_libc();
|
||||
if (libc) {
|
||||
printf("%s ", LOGO[lc]);
|
||||
printf("%slibc%s: %s\n", color, reset, libc);
|
||||
lc++;
|
||||
}
|
||||
|
||||
const char *cpu = display_cpu();
|
||||
if (cpu) {
|
||||
printf("%s ", LOGO[lc]);
|
||||
|
@ -236,7 +244,6 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
|
||||
// TODO:
|
||||
// * libc
|
||||
// * 端末
|
||||
// * ストレージ
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
#ifndef LIBC_H
|
||||
#define LIBC_H
|
||||
|
||||
const char *display_libc();
|
||||
|
||||
#endif
|
読み込み中…
新しいイシューから参照