diff options
Diffstat (limited to 'src/os.c')
-rw-r--r-- | src/os.c | 53 |
1 files changed, 4 insertions, 49 deletions
@@ -1,52 +1,7 @@ #include "os.h" +#include "common.h" -#include <stdio.h> -#include <string.h> - -void display_os_name() { - char buf[64]; - FILE *p = popen("uname -s", "r"); - if (!p) { - fprintf(stderr, "「uname」コマンドを実効に失敗"); - return; - } - - while (fgets(buf, sizeof(buf), p) != NULL) { - buf[strcspn(buf, "\n")] = '\0'; - printf("%s", buf); - } - - pclose(p); -} - -void display_os_vers() { - char buf[16]; - FILE *p = popen("uname -r", "r"); - if (!p) { - fprintf(stderr, "「uname」コマンドを実効に失敗"); - return; - } - - while (fgets(buf, sizeof(buf), p) != NULL) { - buf[strcspn(buf, "\n")] = '\0'; - printf("%s", buf); - } - - pclose(p); -} - -void display_os_arch() { - char buf[16]; - FILE *p = popen("uname -m", "r"); - if (!p) { - fprintf(stderr, "「uname」コマンドを実効に失敗"); - return; - } - - while (fgets(buf, sizeof(buf), p) != NULL) { - buf[strcspn(buf, "\n")] = '\0'; - printf("%s", buf); - } - - pclose(p); +const char *display_os() { + return run_command_s("uname -s && echo \" \" && uname -r && " + "echo \" \" && uname -m"); } |