Merge branch 'master' of gitler.moe:suwako/farfetch into macos-res
このコミットが含まれているのは:
コミット
1ef76b5fdf
|
@ -1,4 +1,5 @@
|
||||||
# 0.3.0
|
# 0.3.0
|
||||||
|
* macOSでOS情報の修正
|
||||||
* macOS: 解像度の追加
|
* macOS: 解像度の追加
|
||||||
|
|
||||||
# 0.2.0
|
# 0.2.0
|
||||||
|
|
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;
|
||||||
}
|
}
|
||||||
|
|
読み込み中…
新しいイシューから参照