macOSでOS情報の修正
このコミットが含まれているのは:
コミット
b8da1256e9
|
@ -1,3 +1,6 @@
|
||||||
|
# 0.3.0
|
||||||
|
* macOSでOS情報の修正
|
||||||
|
|
||||||
# 0.2.0
|
# 0.2.0
|
||||||
* Manjaroのロゴの追加
|
* Manjaroのロゴの追加
|
||||||
* OpenSUSEのロゴの追加
|
* OpenSUSEのロゴの追加
|
||||||
|
|
2
main.c
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
|
||||||
|
|
25
src/os.c
25
src/os.c
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
読み込み中…
新しいイシューから参照