summaryrefslogtreecommitdiff
path: root/src/os.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/os.c')
-rw-r--r--src/os.c53
1 files changed, 4 insertions, 49 deletions
diff --git a/src/os.c b/src/os.c
index 4662acd..e1c15f4 100644
--- a/src/os.c
+++ b/src/os.c
@@ -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");
}