Merge branch 'master' of gitler.moe:suwako/farfetch into macos-res

このコミットが含まれているのは:
守矢諏訪子 2024-07-17 20:44:23 +09:00
コミット 1ef76b5fdf
2個のファイルの変更24行の追加2行の削除

ファイルの表示

@ -1,4 +1,5 @@
# 0.3.0 # 0.3.0
* macOSでOS情報の修正
* macOS: 解像度の追加 * macOS: 解像度の追加
# 0.2.0 # 0.2.0

ファイルの表示

@ -1,7 +1,28 @@
#include "os.h" #include "os.h"
#include "common.h" #include "common.h"
#include <stdio.h>
#include <stdlib.h>
const char *display_os() { const char *display_os() {
return run_command_s("uname -s && echo \" \" && uname -r && " const char *osname = NULL;
"echo \" \" && uname -m"); const char *osversion = NULL;
const char *osarch = NULL;
#if defined(__APPLE__)
osname = run_command_s("sw_vers | grep \"ProductName\" | awk '{print $2}'");
osversion = run_command_s("sw_vers | grep \"ProductVersion\" | awk '{print $2}'");
#else
osname = run_command_s("uname -s");
osversion = run_command_s("uname -r");
#endif
osarch = run_command_s("uname -m");
char *cmd = (char *)malloc(128 * sizeof(char));
snprintf(cmd, 128, "%s %s %s", osname, osversion, osarch);
free((void *)osname);
free((void *)osversion);
free((void *)osarch);
return cmd;
} }