macOSでOS情報の修正

このコミットが含まれているのは:
守矢諏訪子 2024-07-16 21:50:04 +09:00
コミット b8da1256e9
3個のファイルの変更27行の追加3行の削除

ファイルの表示

@ -1,3 +1,6 @@
# 0.3.0
* macOSでOS情報の修正
# 0.2.0 # 0.2.0
* Manjaroのロゴの追加 * Manjaroのロゴの追加
* OpenSUSEのロゴの追加 * OpenSUSEのロゴの追加

2
main.c
ファイルの表示

@ -27,7 +27,7 @@
#include "src/config.h" #include "src/config.h"
const char *sofname = "farfetch"; const char *sofname = "farfetch";
const char *version = "0.2.0"; const char *version = "0.3.0";
#if defined(__linux__) || defined(__sun) #if defined(__linux__) || defined(__sun)
const char *avalopt = "ls"; const char *avalopt = "ls";
#else #else

ファイルの表示

@ -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;
} }