mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2025-02-20 11:43:27 +08:00
commit
cec38b9501
21
.github/stale.yml
vendored
Normal file
21
.github/stale.yml
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
# Number of days of inactivity before an issue becomes stale
|
||||
daysUntilStale: 60
|
||||
|
||||
# Number of days of inactivity before a stale issue is closed
|
||||
daysUntilClose: 7
|
||||
|
||||
# Issues with these labels will never be considered stale
|
||||
exemptLabels:
|
||||
- keepalive
|
||||
|
||||
# Label to use when marking an issue as stale
|
||||
staleLabel: stale
|
||||
|
||||
# Comment to post when marking an issue as stale. Set to `false` to disable
|
||||
markComment: >
|
||||
This issue has been automatically marked as stale because it has not had
|
||||
recent activity. It will be closed if no further activity occurs. Thank you
|
||||
for your contributions.
|
||||
|
||||
# Comment to post when closing a stale issue. Set to `false` to disable
|
||||
closeComment: false
|
1
.github/workflows/ci.yml
vendored
1
.github/workflows/ci.yml
vendored
@ -375,7 +375,6 @@ jobs:
|
||||
- name: checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
- name: run VM
|
||||
uses: vmactions/omnios-vm@v1
|
||||
with:
|
||||
|
24
CHANGELOG.md
24
CHANGELOG.md
@ -1,3 +1,21 @@
|
||||
# 2.17.2
|
||||
|
||||
Changes:
|
||||
* Flatpak package count no longer takes runtime packages into account (Packages, Linux)
|
||||
|
||||
Bugfixes:
|
||||
* Fix formattion with multiple batteries (Battery)
|
||||
* Fix incorrect size value for large memory sticks (PhysicalMemory)
|
||||
* Fix spelling of `Qt` and `LXQt`
|
||||
* Fix building on SunOS if imagemagick support is enabled (Logo, SunOS)
|
||||
* Fix typos
|
||||
|
||||
Features:
|
||||
* Support Ptyxis terminal version and font detection (Terminal / TerminalFont, Linux)
|
||||
* Improve Cinnamon version detection (DE)
|
||||
* Support `cinnamon-wayland` (WMTheme)
|
||||
* `--ts-version false` will disable editor version detection (Editor)
|
||||
|
||||
# 2.17.1
|
||||
|
||||
Hotfix for a regression that breaks Qt font detection
|
||||
@ -1061,7 +1079,7 @@ Bugfixes:
|
||||
This release backports some changes from dev branch, and fixes 2 crashing issues
|
||||
|
||||
Features:
|
||||
* Support KDE / LXQT / MATE / Cinnamon wallpaper detection (Wallpaper, Linux)
|
||||
* Support KDE / LXQt / MATE / Cinnamon wallpaper detection (Wallpaper, Linux)
|
||||
* Support QTerminal version & terminal font detection
|
||||
* Support MATE Terminal version & terminal font detection
|
||||
* Set `--pipe true` automatically if stdout is not a tty
|
||||
@ -1107,7 +1125,7 @@ Bugfixes:
|
||||
* Fix Windows drives detection in WSL (Disk)
|
||||
|
||||
Changes:
|
||||
* In order to make Icons module consistent between different platforms, `--icons-format` no longer supports individual GTK / QT icon params.
|
||||
* In order to make Icons module consistent between different platforms, `--icons-format` no longer supports individual GTK / Qt icon params.
|
||||
* `--theme-format` no longer supports individual GTK / plasma theme params.
|
||||
* `--local-ip-*` and `--public-ip-*` have been changed to `--localip-*` and `--publicip-*`
|
||||
* `--localip-compact-type` is no longer supported. Fastfetch now display IPs as `--localip-compat-type multiline` by default, with `--local-compact true` can be set as an alias of `--localip-compact-type oneline`
|
||||
@ -1481,7 +1499,7 @@ Fixes build on android (#205)
|
||||
# 1.6.0
|
||||
|
||||
Features:
|
||||
* Detect QT on more DEs than just KDE Plasma. The [Plasma] category was therefore renamed to [QT]
|
||||
* Detect Qt on more DEs than just KDE Plasma. The [Plasma] category was therefore renamed to [Qt]
|
||||
* Alacritty font detection
|
||||
* Load `/etc/fastfetch/config.conf` before user config
|
||||
* Disk: print one decimal point if size < 100GB
|
||||
|
@ -1,7 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage url
|
||||
|
||||
project(fastfetch
|
||||
VERSION 2.17.1
|
||||
VERSION 2.17.2
|
||||
LANGUAGES C
|
||||
DESCRIPTION "Fast neofetch-like system information tool"
|
||||
HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch"
|
||||
@ -74,6 +74,7 @@ cmake_dependent_option(ENABLE_THREADS "Enable multithreading" ON "Threads_FOUND"
|
||||
|
||||
option(ENABLE_SYSTEM_YYJSON "Use system provided (instead of fastfetch embedded) yyjson library" OFF)
|
||||
option(ENABLE_ASAN "Build fastfetch with ASAN (address sanitizer)" OFF)
|
||||
option(ENABLE_LTO "Enable link-time optimization in release mode if supported" ON)
|
||||
option(BUILD_TESTS "Build tests" OFF) # Also create test executables
|
||||
option(SET_TWEAK "Add tweak to project version" ON) # This is set to off by github actions for release builds
|
||||
option(IS_MUSL "Build with musl libc" OFF) # Used by Github Actions
|
||||
@ -139,7 +140,7 @@ if(NOT WIN32)
|
||||
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -rdynamic")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
if(ENABLE_LTO AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
message(STATUS "Enabling LTO")
|
||||
include(CheckIPOSupported)
|
||||
check_ipo_supported(RESULT IPO_SUPPORTED)
|
||||
@ -1322,12 +1323,17 @@ if(LINUX)
|
||||
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
|
||||
|
||||
if(NOT IS_MUSL)
|
||||
EXECUTE_PROCESS (
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND getconf GNU_LIBC_VERSION
|
||||
OUTPUT_VARIABLE GLIBC_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
STRING (REPLACE "glibc " "" GLIBC_VERSION ${GLIBC_VERSION})
|
||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= ${GLIBC_VERSION})")
|
||||
if(GLIBC_VERSION)
|
||||
STRING(REPLACE "glibc " "" GLIBC_VERSION ${GLIBC_VERSION})
|
||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= ${GLIBC_VERSION})")
|
||||
message(STATUS "found glibc ${GLIBC_VERSION}")
|
||||
else()
|
||||
message(WARNING "Could not determine glibc version. If `musl` is used, `-DIS_MUSL=ON` should be set")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
3
LICENSE
3
LICENSE
@ -1,6 +1,7 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021 Linus Dierheimer
|
||||
Copyright (c) 2021-2023 Linus Dierheimer
|
||||
Copyright (c) 2022-2024 Carter Li
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
28
README.md
28
README.md
@ -11,7 +11,7 @@
|
||||
[](https://repology.org/project/fastfetch/versions)
|
||||
[](https://repology.org/project/fastfetch/versions)
|
||||
|
||||
Fastfetch is a [neofetch](https://github.com/dylanaraps/neofetch)-like tool for fetching system information and displaying them in a pretty way. It is written mainly in C, with performance and customizability in mind. Currently, Linux, Android, FreeBSD, macOS, SunOS and Windows 7+ are supported.
|
||||
Fastfetch is a [neofetch](https://github.com/dylanaraps/neofetch)-like tool for fetching system information and displaying it prettily. It is written mainly in C, with performance and customizability in mind. Currently, Linux, Android, FreeBSD, macOS, SunOS and Windows 7+ are supported.
|
||||
|
||||
<img src="screenshots/example1.png" width="49%" align="left" />
|
||||
<img src="https://upload.wikimedia.org/wikipedia/commons/2/24/Transparent_Square_Tiles_Texture.png" width="49%" height="16px" align="left" />
|
||||
@ -21,13 +21,13 @@ Fastfetch is a [neofetch](https://github.com/dylanaraps/neofetch)-like tool for
|
||||
<img src="screenshots/example3.png" width="48%" align="top" />
|
||||
<img src="screenshots/example5.png" height="15%" align="top" />
|
||||
|
||||
There are [screenshots on different platforms](https://github.com/fastfetch-cli/fastfetch/wiki)
|
||||
There are [screenshots on different platforms](https://github.com/fastfetch-cli/fastfetch/wiki).
|
||||
|
||||
## Installation
|
||||
|
||||
### Linux
|
||||
|
||||
Some distros packaged an outdated fastfetch version. Older version is not supported, please always ensure that the latest version is used.
|
||||
Some distros packaged an outdated fastfetch version. Older version receive no support, so please try always to use the latest version.
|
||||
|
||||
* Ubuntu: [`ppa:zhangsongcui3371/fastfetch`](https://launchpad.net/~zhangsongcui3371/+archive/ubuntu/fastfetch) (for Ubuntu 22.04 or newer)
|
||||
* Debian: `sudo apt install fastfetch` (for Debian 13 or newer)
|
||||
@ -57,7 +57,7 @@ If fastfetch is not packaged for your distro or an outdated version is packaged,
|
||||
* [winget](https://github.com/microsoft/winget-pkgs/tree/master/manifests/f/Fastfetch-cli/Fastfetch): `winget install fastfetch`
|
||||
* [MSYS2 MinGW](https://github.com/msys2/MINGW-packages/tree/master/mingw-w64-fastfetch): `pacman -S mingw-w64-<subsystem>-<arch>-fastfetch`
|
||||
|
||||
You may also download it directly from [GitHub releases page](https://github.com/fastfetch-cli/fastfetch/releases/latest) and extract the archive.
|
||||
You may also download the program directly from [the GitHub releases page](https://github.com/fastfetch-cli/fastfetch/releases/latest) in the form of an archive file.
|
||||
|
||||
### FreeBSD
|
||||
|
||||
@ -81,7 +81,7 @@ See Wiki: https://github.com/fastfetch-cli/fastfetch/wiki/Building
|
||||
|
||||
## Customization
|
||||
|
||||
Fastfetch uses the JSONC (or JSON with comments) for configuration. [See Wiki for detail](https://github.com/fastfetch-cli/fastfetch/wiki/Configuration). There are some premade config files in [`presets`](presets), including the ones used for the screenshots above. You can load them using `-c <filename>`. They may also serve as a good example for format arguments.
|
||||
Fastfetch uses the JSONC (or JSON with comments) for configuration. [See Wiki for detail](https://github.com/fastfetch-cli/fastfetch/wiki/Configuration). There are some premade config files in [`presets`](presets), including the ones used for the screenshots above. You can load them using `-c <filename>`. Those files can serve as examples of the configuration syntax.
|
||||
|
||||
Logos can be heavily customized too; see the [logo documentation](https://github.com/fastfetch-cli/fastfetch/wiki/Logo-options) for more information.
|
||||
|
||||
@ -103,10 +103,10 @@ Logos can be heavily customized too; see the [logo documentation](https://github
|
||||
|
||||
1. Fastfetch is actively maintained.
|
||||
2. Fastfetch is faster. As the name suggests.
|
||||
3. Fastfetch is more feature-rich. By default fastfetch only has a few modules enabled. Use `fastfetch -c all` to find what you want.
|
||||
4. Fastfetch is more configurable. You can find more information in the Wiki: <https://github.com/fastfetch-cli/fastfetch/wiki/Configuration>
|
||||
5. Fastfetch is more polished. For example, neofetch prints `555MiB` in `Memory` module and `23G` in `Disk` module (notibily the difference of `MiB` and `G`), while fastfetch prints `555.00 MiB` and `22.97 GiB` respectively.
|
||||
6. Fastfetch is more accurate. For example, [neofetch never actually supports Wayland protocol](https://github.com/dylanaraps/neofetch/pull/2395).
|
||||
3. Fastfetch has a greater number of features, though by default fastfetch only has a few modules enabled; use `fastfetch -c all` to find what you want.
|
||||
4. Fastfetch is more configurable. You can find more information in the Wiki: <https://github.com/fastfetch-cli/fastfetch/wiki/Configuration>.
|
||||
5. Fastfetch is more polished. For example, neofetch prints `555MiB` in `Memory` module and `23G` in `Disk` module, whereas fastfetch prints `555.00 MiB` and `22.97 GiB` respectively.
|
||||
6. Fastfetch is more accurate. For example, [neofetch never actually supports the Wayland protocol](https://github.com/dylanaraps/neofetch/pull/2395).
|
||||
|
||||
### Q: Fastfetch shows my local IP address. It leaks my privacy!
|
||||
|
||||
@ -118,7 +118,7 @@ If you really don't like it, you can disable the `Local IP` module in `config.js
|
||||
|
||||
### Q: Where is the config file? I can't find it.
|
||||
|
||||
`Fastfetch` don't generate config file automatically. You can use `fastfetch --gen-config` to generate one. The config file will be saved in `~/.config/fastfetch/config.jsonc` by default. See [Wiki for detail](https://github.com/fastfetch-cli/fastfetch/wiki/Configuration).
|
||||
`Fastfetch` does not generate config file automatically. You can use `fastfetch --gen-config` to generate one. The config file will be saved in `~/.config/fastfetch/config.jsonc` by default. See [Wiki for detail](https://github.com/fastfetch-cli/fastfetch/wiki/Configuration).
|
||||
|
||||
### Q: The configuration is so complex. Where is the documentation?
|
||||
|
||||
@ -132,7 +132,7 @@ Alternatively, you can refer to the presets in [`presets` directory](https://git
|
||||
|
||||
### Q: How can I customize the module output?
|
||||
|
||||
Fastfetch uses `format` to generate output. For example to make `GPU` module show GPU name only and ignore other information, you can use
|
||||
Fastfetch uses `format` to generate output. For example, to make the `GPU` module show only the GPU name (leaving other information undisplayed), you can use
|
||||
|
||||
```jsonc
|
||||
{
|
||||
@ -145,15 +145,15 @@ Fastfetch uses `format` to generate output. For example to make `GPU` module sho
|
||||
}
|
||||
```
|
||||
|
||||
which is equivalent to `fastfetch -s gpu --gpu-format '{2}'`
|
||||
. . which is equivalent to `fastfetch -s gpu --gpu-format '{2}'`
|
||||
|
||||
See `fastfetch -h format` for basic usage. For module specific formattion, see `fastfetch -h <module>-format`
|
||||
See `fastfetch -h format` for information on basic usage. For module specific formattion, see `fastfetch -h <module>-format`
|
||||
|
||||
### Q: I have my own ascii-art / image file. How can I show it with fastfetch?
|
||||
|
||||
Try `fastfetch -l /path/to/logo`. See [logo documentation](https://github.com/fastfetch-cli/fastfetch/wiki/Logo-options) for detail.
|
||||
|
||||
If you just want to display distro name in [FIGlet text](https://github.com/pwaller/pyfiglet)
|
||||
If you just want to display distro name in [FIGlet text](https://github.com/pwaller/pyfiglet):
|
||||
|
||||
```bash
|
||||
# install pyfiglet and jq first
|
||||
|
12
debian/changelog
vendored
12
debian/changelog
vendored
@ -1,3 +1,15 @@
|
||||
fastfetch (2.17.1) jammy; urgency=medium
|
||||
|
||||
* Update to 2.17.1
|
||||
|
||||
-- Carter Li <zhangsongcui@live.cn> Mon, 01 Jul 2024 08:56:29 +0800
|
||||
|
||||
fastfetch (2.17.0) jammy; urgency=medium
|
||||
|
||||
* Update to 2.17.0
|
||||
|
||||
-- Carter Li <zhangsongcui@live.cn> Fri, 28 Jun 2024 13:43:18 +0800
|
||||
|
||||
fastfetch (2.16.0) jammy; urgency=medium
|
||||
|
||||
* Update to 2.16.0
|
||||
|
2
debian/files
vendored
2
debian/files
vendored
@ -1 +1 @@
|
||||
fastfetch_2.16.0_source.buildinfo universe/utils optional
|
||||
fastfetch_2.17.1_source.buildinfo universe/utils optional
|
||||
|
@ -576,7 +576,7 @@
|
||||
},
|
||||
"tsVersion": {
|
||||
"type": "boolean",
|
||||
"description": "Whether to detect and display the version of terminal and shell. Mainly for benchmarking",
|
||||
"description": "Whether to detect and display the version of terminal, shell and editor. Mainly for benchmarking",
|
||||
"default": true
|
||||
}
|
||||
}
|
||||
@ -1145,6 +1145,21 @@
|
||||
"type": "boolean",
|
||||
"description": "Display CPU usage per CPU logical core, instead of an average result",
|
||||
"default": false
|
||||
},
|
||||
"key": {
|
||||
"$ref": "#/$defs/key"
|
||||
},
|
||||
"keyColor": {
|
||||
"$ref": "#/$defs/keyColor"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
},
|
||||
"keyWidth": {
|
||||
"$ref": "#/$defs/keyWidth"
|
||||
},
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -147,7 +147,7 @@
|
||||
{
|
||||
"type": "font",
|
||||
"key": "FONT",
|
||||
"format": "{?1}{1} [QT]{?}{/1}Unknown", // Remove "[QT]" if not using Qt
|
||||
"format": "{?1}{1} [Qt]{?}{/1}Unknown", // Remove "[Qt]" if not using Qt
|
||||
"keyColor": "yellow"
|
||||
},
|
||||
{
|
||||
|
@ -148,6 +148,14 @@ bool ffOptionParseBoolean(const char* str)
|
||||
|
||||
void ffOptionParseColorNoClear(const char* value, FFstrbuf* buffer)
|
||||
{
|
||||
// If value is already an ANSI escape code, use it
|
||||
if (value[0] == '\e' && value[1] == '[')
|
||||
{
|
||||
ffStrbufAppendS(buffer, value + 2);
|
||||
ffStrbufTrimRight(buffer, 'm');
|
||||
return;
|
||||
}
|
||||
|
||||
ffStrbufEnsureFree(buffer, 63);
|
||||
|
||||
while(*value != '\0')
|
||||
|
@ -154,7 +154,7 @@
|
||||
{
|
||||
"short": "l",
|
||||
"long": "logo",
|
||||
"desc": "Set the logo source",
|
||||
"desc": "Set the logo source. Use \"none\" to disable the logo",
|
||||
"remark": "Should be the name of a builtin logo, or a path to an image file. See also https://github.com/fastfetch-cli/fastfetch/wiki/Logo-options",
|
||||
"arg": {
|
||||
"type": "logo"
|
||||
@ -441,7 +441,7 @@
|
||||
},
|
||||
{
|
||||
"long": "pipe",
|
||||
"desc": "Disable logo and all escape sequences",
|
||||
"desc": "Disable colors",
|
||||
"remark": "Auto detection based on isatty(1)",
|
||||
"arg": {
|
||||
"type": "bool",
|
||||
@ -728,7 +728,7 @@
|
||||
},
|
||||
{
|
||||
"long": "ts-version",
|
||||
"desc": "Whether to detect and display the version of terminal and shell",
|
||||
"desc": "Whether to detect and display the version of terminal, shell and editor",
|
||||
"remark": "Mainly for benchmarking",
|
||||
"arg": {
|
||||
"type": "bool",
|
||||
|
@ -74,7 +74,20 @@ static void getGnome(FFstrbuf* result, FF_MAYBE_UNUSED FFDEOptions* options)
|
||||
|
||||
static void getCinnamon(FFstrbuf* result, FF_MAYBE_UNUSED FFDEOptions* options)
|
||||
{
|
||||
ffParsePropFileData("applications/cinnamon.desktop", "X-GNOME-Bugzilla-Version =", result);
|
||||
ffStrbufSetS(result, getenv("CINNAMON_VERSION"));
|
||||
|
||||
if (result->length == 0)
|
||||
ffParsePropFileData("applications/cinnamon.desktop", "X-GNOME-Bugzilla-Version =", result);
|
||||
|
||||
if (result->length == 0 && options->slowVersionDetection)
|
||||
{
|
||||
if (ffProcessAppendStdOut(result, (char* const[]){
|
||||
"cinnamon",
|
||||
"--version",
|
||||
NULL
|
||||
}) == NULL) // Cinnamon 6.2.2
|
||||
ffStrbufSubstrAfterLastC(result, ' ');
|
||||
}
|
||||
}
|
||||
|
||||
static void getMate(FFstrbuf* result, FFDEOptions* options)
|
||||
|
@ -9,7 +9,7 @@
|
||||
#define FF_DE_PRETTY_CINNAMON "Cinnamon"
|
||||
#define FF_DE_PRETTY_MATE "Mate"
|
||||
#define FF_DE_PRETTY_LXDE "LXDE"
|
||||
#define FF_DE_PRETTY_LXQT "LXQT"
|
||||
#define FF_DE_PRETTY_LXQT "LXQt"
|
||||
#define FF_DE_PRETTY_BUDGIE "Budgie"
|
||||
#define FF_DE_PRETTY_CDE "CDE"
|
||||
#define FF_DE_PRETTY_UNITY "Unity"
|
||||
|
@ -23,7 +23,6 @@ static void waylandDetectWM(int fd, FFDisplayServerResult* result)
|
||||
FF_STRBUF_AUTO_DESTROY procPath = ffStrbufCreate();
|
||||
ffStrbufAppendF(&procPath, "/proc/%d/cmdline", ucred.pid); //We check the cmdline for the process name, because it is not trimmed.
|
||||
ffReadFileBuffer(procPath.chars, &result->wmProcessName);
|
||||
ffStrbufTrimRightSpace(&result->wmProcessName);
|
||||
ffStrbufSubstrBeforeFirstC(&result->wmProcessName, '\0'); //Trim the arguments
|
||||
ffStrbufSubstrAfterLastC(&result->wmProcessName, '/'); //Trim the path
|
||||
}
|
||||
|
@ -71,11 +71,8 @@ static void applyPrettyNameIfWM(FFDisplayServerResult* result, const char* name)
|
||||
return;
|
||||
|
||||
if(
|
||||
ffStrEqualsIgnCase(name, "kwin_wayland") ||
|
||||
ffStrEqualsIgnCase(name, "kwin_wayland_wrapper") ||
|
||||
ffStrEqualsIgnCase(name, "kwin_x11") ||
|
||||
ffStrEqualsIgnCase(name, "kwin_x11_wrapper") ||
|
||||
ffStrEqualsIgnCase(name, "kwin") ||
|
||||
ffStrStartsWithIgnCase(name, "kwin_") ||
|
||||
ffStrEndsWithIgnCase(name, "-kwin_wayland") ||
|
||||
ffStrEndsWithIgnCase(name, "-kwin_x11")
|
||||
) ffStrbufSetS(&result->wmPrettyName, FF_WM_PRETTY_KWIN);
|
||||
@ -86,7 +83,8 @@ static void applyPrettyNameIfWM(FFDisplayServerResult* result, const char* name)
|
||||
ffStrEqualsIgnCase(name, "Mutter")
|
||||
) ffStrbufSetS(&result->wmPrettyName, FF_WM_PRETTY_MUTTER);
|
||||
else if(
|
||||
ffStrEqualsIgnCase(name, "cinnamon-session") ||
|
||||
ffStrEqualsIgnCase(name, "cinnamon") ||
|
||||
ffStrStartsWithIgnCase(name, "cinnamon-") ||
|
||||
ffStrEqualsIgnCase(name, "Muffin") ||
|
||||
ffStrEqualsIgnCase(name, "Mutter (Muffin)")
|
||||
) ffStrbufSetS(&result->wmPrettyName, FF_WM_PRETTY_MUFFIN);
|
||||
@ -207,7 +205,7 @@ static void applyPrettyNameIfDE(FFDisplayServerResult* result, const char* name)
|
||||
|
||||
else if(
|
||||
ffStrEqualsIgnCase(name, "LXQt") ||
|
||||
ffStrEqualsIgnCase(name, "X-LXQT") ||
|
||||
ffStrEqualsIgnCase(name, "X-LXQt") ||
|
||||
ffStrEqualsIgnCase(name, "lxqt-session")
|
||||
) {
|
||||
ffStrbufSetS(&result->deProcessName, "lxqt-session");
|
||||
|
@ -26,6 +26,8 @@ const char* ffDetectEditor(FFEditorResult* result)
|
||||
return "$VISUAL or $EDITOR not set";
|
||||
}
|
||||
|
||||
if (!instance.config.display.tsVersion) return NULL;
|
||||
|
||||
#ifndef _WIN32
|
||||
if (result->name.chars[0] != '/')
|
||||
{
|
||||
|
@ -7,7 +7,7 @@
|
||||
typedef struct FFFontResult
|
||||
{
|
||||
/**
|
||||
* Linux / BSD: QT, GTK2, GTK3, GTK4
|
||||
* Linux / BSD: Qt, GTK2, GTK3, GTK4
|
||||
* MacOS: System, User, System Mono, User Mono
|
||||
* Windows: Caption, Menu, Message, Status
|
||||
* Other: Unset, Unset, Unset, Unset
|
||||
|
@ -9,7 +9,7 @@ static void generateString(FFFontResult* font)
|
||||
if(font->fonts[0].length > 0)
|
||||
{
|
||||
ffStrbufAppend(&font->display, &font->fonts[0]);
|
||||
ffStrbufAppendS(&font->display, " [QT]");
|
||||
ffStrbufAppendS(&font->display, " [Qt]");
|
||||
|
||||
for(uint8_t i = 1; i < sizeof(font->fonts) / sizeof(font->fonts[0]); i++)
|
||||
{
|
||||
|
@ -23,7 +23,7 @@ const char* ffDetectIcons(FFIconsResult* result)
|
||||
if(plasma->length > 0)
|
||||
{
|
||||
ffStrbufAppend(&result->icons1, plasma);
|
||||
ffStrbufAppendS(&result->icons1, " [QT]");
|
||||
ffStrbufAppendS(&result->icons1, " [Qt]");
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
@ -95,7 +95,7 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results)
|
||||
continue;
|
||||
|
||||
struct sockaddr_in* ipv4 = (struct sockaddr_in*) ifa->ifa_addr;
|
||||
char addressBuffer[INET_ADDRSTRLEN + 4];
|
||||
char addressBuffer[INET_ADDRSTRLEN + 16];
|
||||
inet_ntop(AF_INET, &ipv4->sin_addr, addressBuffer, INET_ADDRSTRLEN);
|
||||
|
||||
if (options->showType & FF_LOCALIP_TYPE_PREFIX_LEN_BIT)
|
||||
@ -105,7 +105,7 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results)
|
||||
if (cidr != 0)
|
||||
{
|
||||
size_t len = strlen(addressBuffer);
|
||||
snprintf(addressBuffer + len, 4, "/%d", cidr);
|
||||
snprintf(addressBuffer + len, 16, "/%d", cidr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -117,7 +117,7 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results)
|
||||
continue;
|
||||
|
||||
struct sockaddr_in6* ipv6 = (struct sockaddr_in6 *)ifa->ifa_addr;
|
||||
char addressBuffer[INET6_ADDRSTRLEN + 4];
|
||||
char addressBuffer[INET6_ADDRSTRLEN + 16];
|
||||
inet_ntop(AF_INET6, &ipv6->sin6_addr, addressBuffer, INET6_ADDRSTRLEN);
|
||||
|
||||
if (options->showType & FF_LOCALIP_TYPE_PREFIX_LEN_BIT)
|
||||
@ -130,7 +130,7 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results)
|
||||
if (cidr != 0)
|
||||
{
|
||||
size_t len = strlen(addressBuffer);
|
||||
snprintf(addressBuffer + len, 4, "/%d", cidr);
|
||||
snprintf(addressBuffer + len, 16, "/%d", cidr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ const char* ffDetectMemory(FFMemoryResult* ram)
|
||||
+ vmstat.compressor_page_count
|
||||
- vmstat.purgeable_count
|
||||
- vmstat.external_page_count
|
||||
) * instance.state.platform.pageSize;
|
||||
) * instance.state.platform.sysinfo.pageSize;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ const char* ffDetectMemory(FFMemoryResult* ram)
|
||||
+ ffSysctlGetInt("vm.stats.vm.v_inactive_count", 0)
|
||||
+ ffSysctlGetInt("vm.stats.vm.v_cache_count", 0);
|
||||
|
||||
ram->bytesUsed = ram->bytesTotal - (uint64_t) pagesFree * instance.state.platform.pageSize;
|
||||
ram->bytesUsed = ram->bytesTotal - (uint64_t) pagesFree * instance.state.platform.sysinfo.pageSize;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -23,11 +23,11 @@ const char* ffDetectMemory(FFMemoryResult* ram)
|
||||
|
||||
{
|
||||
kstat_named_t* kn = kstat_data_lookup(ks, "pagestotal");
|
||||
ram->bytesTotal = kn->value.ui64 * instance.state.platform.pageSize;
|
||||
ram->bytesTotal = kn->value.ui64 * instance.state.platform.sysinfo.pageSize;
|
||||
}
|
||||
{
|
||||
kstat_named_t* kn = kstat_data_lookup(ks, "pagesfree");
|
||||
ram->bytesUsed = ram->bytesTotal - kn->value.ui64 * instance.state.platform.pageSize;
|
||||
ram->bytesUsed = ram->bytesTotal - kn->value.ui64 * instance.state.platform.sysinfo.pageSize;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
@ -313,19 +313,6 @@ static uint32_t getSnap(FFstrbuf* baseDir)
|
||||
return result > 0 ? result - 1 : 0;
|
||||
}
|
||||
|
||||
static uint32_t getFlatpak(FFstrbuf* baseDir, const char* dirname)
|
||||
{
|
||||
uint32_t baseDirLength = baseDir->length;
|
||||
ffStrbufAppendS(baseDir, dirname);
|
||||
|
||||
uint32_t result =
|
||||
getNumElements(baseDir, "/app", DT_DIR) +
|
||||
getNumElements(baseDir, "/runtime", DT_DIR);
|
||||
|
||||
ffStrbufSubstrBefore(baseDir, baseDirLength);
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef FF_HAVE_RPM
|
||||
#include "common/library.h"
|
||||
#include <rpm/rpmlib.h>
|
||||
@ -459,7 +446,7 @@ static void getPackageCounts(FFstrbuf* baseDir, FFPackagesResult* packageCounts,
|
||||
if (!(options->disabled & FF_PACKAGES_FLAG_LPKG_BIT)) packageCounts->lpkg += getNumStrings(baseDir, "/opt/Loc-OS-LPKG/installed-lpkg/Listinstalled-lpkg.list", "\n");
|
||||
if (!(options->disabled & FF_PACKAGES_FLAG_EMERGE_BIT)) packageCounts->emerge += countFilesRecursive(baseDir, "/var/db/pkg", "SIZE");
|
||||
if (!(options->disabled & FF_PACKAGES_FLAG_EOPKG_BIT)) packageCounts->eopkg += getNumElements(baseDir, "/var/lib/eopkg/package", DT_DIR);
|
||||
if (!(options->disabled & FF_PACKAGES_FLAG_FLATPAK_BIT)) packageCounts->flatpakSystem += getFlatpak(baseDir, "/var/lib/flatpak");
|
||||
if (!(options->disabled & FF_PACKAGES_FLAG_FLATPAK_BIT)) packageCounts->flatpakSystem += getNumElements(baseDir, "/var/lib/flatpak/app", DT_DIR);
|
||||
if (!(options->disabled & FF_PACKAGES_FLAG_NIX_BIT))
|
||||
{
|
||||
packageCounts->nixDefault += getNixPackages(baseDir, "/nix/var/nix/profiles/default");
|
||||
@ -587,5 +574,5 @@ void ffDetectPackagesImpl(FFPackagesResult* result, FFPackagesOptions* options)
|
||||
}
|
||||
|
||||
if (!(options->disabled & FF_PACKAGES_FLAG_FLATPAK_BIT))
|
||||
result->flatpakUser = getFlatpak(&baseDir, "/.local/share/flatpak");
|
||||
result->flatpakUser = getNumElements(&baseDir, "/.local/share/flatpak/app", DT_DIR);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "physicaldisk.h"
|
||||
|
||||
const char* ffDetectPhysicalDisk(FFlist* result, FFPhysicalDiskOptions* options)
|
||||
const char* ffDetectPhysicalDisk(FF_MAYBE_UNUSED FFlist* result, FF_MAYBE_UNUSED FFPhysicalDiskOptions* options)
|
||||
{
|
||||
return "Not supported on this platform";
|
||||
}
|
||||
|
@ -100,11 +100,11 @@ const char* ffDetectPhysicalMemory(FFlist* result)
|
||||
if (data->Size != 0xFFFF)
|
||||
{
|
||||
if (data->Size == 0x7FFF)
|
||||
device->size = (data->ExtendedSize & ~(1 << 31)) * 1024 * 1024;
|
||||
device->size = (data->ExtendedSize & ~(1ULL << 31)) * 1024ULL * 1024ULL;
|
||||
else if (data->Size & (1 << 15))
|
||||
{
|
||||
// in kB
|
||||
device->size = (data->Size & ~(1u << 15)) * 1024ULL;
|
||||
device->size = (data->Size & ~(1ULL << 15)) * 1024ULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -25,8 +25,8 @@ const char* ffDetectSwap(FFSwapResult* swap)
|
||||
swap->bytesTotal += (uint64_t) xsw.xsw_nblks;
|
||||
}
|
||||
|
||||
swap->bytesUsed *= instance.state.platform.pageSize;
|
||||
swap->bytesTotal *= instance.state.platform.pageSize;
|
||||
swap->bytesUsed *= instance.state.platform.sysinfo.pageSize;
|
||||
swap->bytesTotal *= instance.state.platform.sysinfo.pageSize;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -26,8 +26,8 @@ const char* ffDetectSwap(FFSwapResult* swap)
|
||||
swap->bytesUsed += (uint64_t) table->swt_ent[i].ste_free;
|
||||
}
|
||||
swap->bytesUsed = swap->bytesTotal - swap->bytesUsed;
|
||||
swap->bytesTotal *= instance.state.platform.pageSize;
|
||||
swap->bytesUsed *= instance.state.platform.pageSize;
|
||||
swap->bytesTotal *= instance.state.platform.sysinfo.pageSize;
|
||||
swap->bytesUsed *= instance.state.platform.sysinfo.pageSize;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ const char* ffDetectSwap(FFSwapResult* swap)
|
||||
if(!NT_SUCCESS(NtQuerySystemInformation(SystemPagefileInformation, pstart, size, &size)))
|
||||
return "NtQuerySystemInformation(SystemPagefileInformation, size) failed";
|
||||
|
||||
uint32_t pageSize = instance.state.platform.pageSize;
|
||||
uint32_t pageSize = instance.state.platform.sysinfo.pageSize;
|
||||
swap->bytesUsed = (uint64_t)pstart->TotalUsed * pageSize;
|
||||
swap->bytesTotal = (uint64_t)pstart->CurrentSize * pageSize;
|
||||
|
||||
|
@ -50,6 +50,26 @@ static void detectKgx(FFTerminalFontResult* terminalFont)
|
||||
}
|
||||
}
|
||||
|
||||
static void detectPtyxis(FFTerminalFontResult* terminalFont)
|
||||
{
|
||||
if(!ffSettingsGet("/org/gnome/Ptyxis/use-system-font", "org.gnome.Ptyxis", NULL, "use-system-font", FF_VARIANT_TYPE_BOOL).boolValue)
|
||||
{
|
||||
FF_AUTO_FREE const char* fontName = ffSettingsGet("/org/gnome/Ptyxis/font-name", "org.gnome.Ptyxis", NULL, "font-name", FF_VARIANT_TYPE_STRING).strValue;
|
||||
if(ffStrSet(fontName))
|
||||
ffFontInitPango(&terminalFont->font, fontName);
|
||||
else
|
||||
ffStrbufAppendF(&terminalFont->error, "Couldn't get terminal font from GSettings (org.gnome.Ptyxis::font-name)");
|
||||
}
|
||||
else
|
||||
{
|
||||
FF_AUTO_FREE const char* fontName = getSystemMonospaceFont();
|
||||
if(ffStrSet(fontName))
|
||||
ffFontInitPango(&terminalFont->font, fontName);
|
||||
else
|
||||
ffStrbufAppendS(&terminalFont->error, "Couldn't get system monospace font name from GSettings / DConf");
|
||||
}
|
||||
}
|
||||
|
||||
static void detectFromGSettings(const char* profilePath, const char* profileList, const char* profile, const char* defaultProfileKey, FFTerminalFontResult* terminalFont)
|
||||
{
|
||||
FF_AUTO_FREE const char* defaultProfile = ffSettingsGetGSettings(profileList, NULL, defaultProfileKey, FF_VARIANT_TYPE_STRING).strValue;
|
||||
@ -386,6 +406,8 @@ void ffDetectTerminalFontPlatform(const FFTerminalResult* terminal, FFTerminalFo
|
||||
detectFromGSettings("/com/gexperts/Tilix/profiles/", "com.gexperts.Tilix.ProfilesList", "com.gexperts.Tilix.Profile", "default", terminalFont);
|
||||
else if(ffStrbufStartsWithIgnCaseS(&terminal->processName, "gnome-terminal"))
|
||||
detectFromGSettings("/org/gnome/terminal/legacy/profiles:/:", "org.gnome.Terminal.ProfilesList", "org.gnome.Terminal.Legacy.Profile", "default", terminalFont);
|
||||
else if(ffStrbufStartsWithIgnCaseS(&terminal->processName, "ptyxis-agent"))
|
||||
detectPtyxis(terminalFont);
|
||||
else if(ffStrbufIgnCaseEqualS(&terminal->processName, "kgx"))
|
||||
detectKgx(terminalFont);
|
||||
else if(ffStrbufIgnCaseEqualS(&terminal->processName, "mate-terminal"))
|
||||
|
@ -499,6 +499,20 @@ static bool getTerminalVersionKitty(FFstrbuf* exe, FFstrbuf* version)
|
||||
//kitty 0.21.2 created by Kovid Goyal
|
||||
return getExeVersionGeneral(exe, version);
|
||||
}
|
||||
|
||||
FF_MAYBE_UNUSED static bool getTerminalVersionPtyxis(FF_MAYBE_UNUSED FFstrbuf* exe, FFstrbuf* version)
|
||||
{
|
||||
if(ffProcessAppendStdOut(version, (char* const[]) {
|
||||
"ptyxis",
|
||||
"--version",
|
||||
NULL
|
||||
}) != NULL)
|
||||
return false;
|
||||
|
||||
ffStrbufSubstrBeforeFirstC(version, '\n');
|
||||
ffStrbufSubstrAfterFirstC(version, ' ');
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
@ -595,6 +609,9 @@ bool fftsGetTerminalVersion(FFstrbuf* processName, FF_MAYBE_UNUSED FFstrbuf* exe
|
||||
)
|
||||
return getTerminalVersionUrxvt(exe, version);
|
||||
|
||||
if(ffStrbufIgnCaseEqualS(processName, "ptyxis-agent"))
|
||||
return getTerminalVersionPtyxis(exe, version);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -331,6 +331,8 @@ static void setTerminalInfoDetails(FFTerminalResult* result)
|
||||
ffStrbufEqualS(&result->processName, "rxvt")
|
||||
)
|
||||
ffStrbufInitStatic(&result->prettyName, "rxvt-unicode");
|
||||
else if(ffStrbufStartsWithS(&result->processName, "ptyxis-agent"))
|
||||
ffStrbufInitStatic(&result->prettyName, "Ptyxis");
|
||||
|
||||
#elif defined(__APPLE__)
|
||||
|
||||
|
@ -53,7 +53,7 @@ const char* ffDetectTheme(FFThemeResult* result)
|
||||
}
|
||||
|
||||
if(plasma->widgetStyle.length > 0 || plasma->colorScheme.length > 0)
|
||||
ffStrbufAppendS(&result->theme1, " [QT]");
|
||||
ffStrbufAppendS(&result->theme1, " [Qt]");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -20,43 +20,61 @@
|
||||
#define FF_ARCHITECTURE "unknown"
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__linux__)
|
||||
#define FF_SYSNAME "Linux"
|
||||
#elif defined(__FreeBSD__)
|
||||
#define FF_SYSNAME "FreeBSD"
|
||||
#elif defined(__APPLE__)
|
||||
#define FF_SYSNAME "Darwin"
|
||||
#elif defined(_WIN32)
|
||||
#define FF_SYSNAME "WIN32"
|
||||
#elif defined(__sun)
|
||||
#define FF_SYSNAME "SunOS"
|
||||
#else
|
||||
#define FF_SYSNAME "unknown"
|
||||
#endif
|
||||
|
||||
#define FF_STR_INDIR(x) #x
|
||||
#define FF_STR(x) FF_STR_INDIR(x)
|
||||
|
||||
void ffDetectVersion(FFVersionResult* version)
|
||||
{
|
||||
version->projectName = FASTFETCH_PROJECT_NAME;
|
||||
version->architecture = FF_ARCHITECTURE;
|
||||
version->version = FASTFETCH_PROJECT_VERSION;
|
||||
version->versionTweak = FASTFETCH_PROJECT_VERSION_TWEAK;
|
||||
version->cmakeBuiltType = FASTFETCH_PROJECT_CMAKE_BUILD_TYPE;
|
||||
version->compileTime = __DATE__ ", " __TIME__;
|
||||
FFVersionResult ffVersionResult = {
|
||||
.projectName = FASTFETCH_PROJECT_NAME,
|
||||
.sysName = FF_SYSNAME,
|
||||
.architecture = FF_ARCHITECTURE,
|
||||
.version = FASTFETCH_PROJECT_VERSION,
|
||||
.versionTweak = FASTFETCH_PROJECT_VERSION_TWEAK,
|
||||
.cmakeBuiltType = FASTFETCH_PROJECT_CMAKE_BUILD_TYPE,
|
||||
.compileTime = __DATE__ ", " __TIME__,
|
||||
.compiler =
|
||||
|
||||
#ifdef __clang__
|
||||
version->compiler =
|
||||
#ifdef _MSC_VER
|
||||
"clang-cl " ;
|
||||
#elif defined(__APPLE__) && defined(__apple_build_version__)
|
||||
"Apple clang "
|
||||
#else
|
||||
"clang "
|
||||
#endif
|
||||
#ifdef _MSC_VER
|
||||
"clang-cl " ;
|
||||
#elif defined(__APPLE__) && defined(__apple_build_version__)
|
||||
"Apple clang "
|
||||
#else
|
||||
"clang "
|
||||
#endif
|
||||
|
||||
FF_STR(__clang_major__) "." FF_STR(__clang_minor__) "." FF_STR(__clang_patchlevel__)
|
||||
FF_STR(__clang_major__) "." FF_STR(__clang_minor__) "." FF_STR(__clang_patchlevel__)
|
||||
|
||||
#if defined(__APPLE__) && defined(__apple_build_version__)
|
||||
" (" FF_STR(__apple_build_version__) ")"
|
||||
#endif
|
||||
;
|
||||
#if defined(__APPLE__) && defined(__apple_build_version__)
|
||||
" (" FF_STR(__apple_build_version__) ")"
|
||||
#endif
|
||||
,
|
||||
#elif defined(__GNUC__)
|
||||
version->compiler = "gcc " FF_STR(__GNUC__) "." FF_STR(__GNUC_MINOR__) "." FF_STR(__GNUC_PATCHLEVEL__);
|
||||
"gcc " FF_STR(__GNUC__) "." FF_STR(__GNUC_MINOR__) "." FF_STR(__GNUC_PATCHLEVEL__),
|
||||
#elif defined(_MSC_VER)
|
||||
version->compiler = "msvc " FF_STR(_MSC_VER);
|
||||
"msvc " FF_STR(_MSC_VER),
|
||||
#else
|
||||
version->compiler = "unknown";
|
||||
"unknown",
|
||||
#endif
|
||||
|
||||
.debugMode =
|
||||
#ifndef NDEBUG
|
||||
version->debugMode = true;
|
||||
true,
|
||||
#else
|
||||
version->debugMode = false;
|
||||
false,
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
@ -5,6 +5,7 @@
|
||||
typedef struct FFVersionResult
|
||||
{
|
||||
const char* projectName;
|
||||
const char* sysName;
|
||||
const char* architecture;
|
||||
const char* version;
|
||||
const char* versionTweak;
|
||||
@ -14,4 +15,4 @@ typedef struct FFVersionResult
|
||||
bool debugMode;
|
||||
} FFVersionResult;
|
||||
|
||||
void ffDetectVersion(FFVersionResult* version);
|
||||
extern FFVersionResult ffVersionResult;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "wifi.h"
|
||||
|
||||
const char* ffDetectWifi(FFlist* result)
|
||||
const char* ffDetectWifi(FF_MAYBE_UNUSED FFlist* result)
|
||||
{
|
||||
return "Not support on this platform";
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ static bool detectOpenbox(const FFstrbuf* dePrettyName, FFstrbuf* themeOrError)
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY absolutePath = ffStrbufCreateA(64);
|
||||
const char *configFileSubpath = "openbox/rc.xml";
|
||||
if (ffStrbufIgnCaseCompS(dePrettyName, "LXQT") == 0)
|
||||
if (ffStrbufIgnCaseCompS(dePrettyName, "LXQt") == 0)
|
||||
configFileSubpath = "openbox/lxqt-rc.xml";
|
||||
else if (ffStrbufIgnCaseCompS(dePrettyName, "LXDE") == 0)
|
||||
configFileSubpath = "openbox/lxde-rc.xml";
|
||||
|
@ -501,9 +501,8 @@ static void optionParseConfigFile(FFdata* data, const char* key, const char* val
|
||||
|
||||
static void printVersion()
|
||||
{
|
||||
FFVersionResult result = {};
|
||||
ffDetectVersion(&result);
|
||||
printf("%s %s%s%s (%s)\n", result.projectName, result.version, result.versionTweak, result.debugMode ? "-debug" : "", result.architecture);
|
||||
FFVersionResult* result = &ffVersionResult;
|
||||
printf("%s %s%s%s (%s)\n", result->projectName, result->version, result->versionTweak, result->debugMode ? "-debug" : "", result->architecture);
|
||||
}
|
||||
|
||||
static void parseCommand(FFdata* data, char* key, char* value)
|
||||
|
@ -12,6 +12,8 @@
|
||||
#include <windows.h>
|
||||
#elif __linux__
|
||||
#include <sys/sendfile.h>
|
||||
#elif __sun
|
||||
#include <sys/termios.h>
|
||||
#endif
|
||||
|
||||
// https://github.com/kostya/benchmarks/blob/master/base64/test-nolib.c#L145
|
||||
|
@ -340,7 +340,7 @@ static const FFlogo* logoGetBuiltinDetected(FFLogoSize size)
|
||||
if(logo != NULL)
|
||||
return logo;
|
||||
|
||||
logo = logoGetBuiltin(&instance.state.platform.systemName, size);
|
||||
logo = logoGetBuiltin(&instance.state.platform.sysinfo.name, size);
|
||||
if(logo != NULL)
|
||||
return logo;
|
||||
|
||||
|
@ -94,8 +94,8 @@ void ffPrintBattery(FFBatteryOptions* options)
|
||||
|
||||
for(uint32_t i = 0; i < results.length; i++)
|
||||
{
|
||||
FFBatteryResult* result = ffListGet(&results, i);
|
||||
printBattery(options, result, (uint8_t) i);
|
||||
FFBatteryResult* result = FF_LIST_GET(FFBatteryResult, results, i);
|
||||
printBattery(options, result, results.length == 1 ? 0 : (uint8_t) (i + 1));
|
||||
}
|
||||
|
||||
FF_LIST_FOR_EACH(FFBatteryResult, result, results)
|
||||
|
@ -3,29 +3,32 @@
|
||||
#include "modules/kernel/kernel.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_KERNEL_NUM_FORMAT_ARGS 5
|
||||
#define FF_KERNEL_NUM_FORMAT_ARGS 6
|
||||
|
||||
void ffPrintKernel(FFKernelOptions* options)
|
||||
{
|
||||
const FFPlatform* platform = &instance.state.platform;
|
||||
const FFPlatformSysinfo* info = &instance.state.platform.sysinfo;
|
||||
if(options->moduleArgs.outputFormat.length == 0)
|
||||
{
|
||||
ffPrintLogoAndKey(FF_KERNEL_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT);
|
||||
printf("%s %s", platform->systemName.chars, platform->systemRelease.chars);
|
||||
printf("%s %s", info->name.chars, info->release.chars);
|
||||
|
||||
if(platform->systemDisplayVersion.length > 0)
|
||||
printf(" (%s)\n", platform->systemDisplayVersion.chars);
|
||||
if(info->displayVersion.length > 0)
|
||||
printf(" (%s)\n", info->displayVersion.chars);
|
||||
else
|
||||
putchar('\n');
|
||||
}
|
||||
else
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY str = ffStrbufCreate();
|
||||
ffParseSize(info->pageSize, &str);
|
||||
FF_PRINT_FORMAT_CHECKED(FF_KERNEL_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_KERNEL_NUM_FORMAT_ARGS, ((FFformatarg[]){
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &platform->systemName, "sysname"},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &platform->systemRelease, "release"},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &platform->systemVersion, "version"},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &platform->systemArchitecture, "arch"},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &platform->systemDisplayVersion, "display-version"},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &info->name, "sysname"},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &info->release, "release"},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &info->version, "version"},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &info->architecture, "arch"},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &info->displayVersion, "display-version"},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &str, "page-size"},
|
||||
}));
|
||||
}
|
||||
}
|
||||
@ -67,12 +70,15 @@ void ffGenerateKernelJsonConfig(FFKernelOptions* options, yyjson_mut_doc* doc, y
|
||||
|
||||
void ffGenerateKernelJsonResult(FF_MAYBE_UNUSED FFKernelOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module)
|
||||
{
|
||||
const FFPlatformSysinfo* info = &instance.state.platform.sysinfo;
|
||||
|
||||
yyjson_mut_val* obj = yyjson_mut_obj_add_obj(doc, module, "result");
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "architecture", &instance.state.platform.systemArchitecture);
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "name", &instance.state.platform.systemName);
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "release", &instance.state.platform.systemRelease);
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "version", &instance.state.platform.systemVersion);
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "displayVersion", &instance.state.platform.systemDisplayVersion);
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "architecture", &info->architecture);
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "name", &info->name);
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "release", &info->release);
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "version", &info->version);
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "displayVersion", &info->displayVersion);
|
||||
yyjson_mut_obj_add_uint(doc, obj, "pageSize", info->pageSize);
|
||||
}
|
||||
|
||||
void ffPrintKernelHelpFormat(void)
|
||||
@ -83,6 +89,7 @@ void ffPrintKernelHelpFormat(void)
|
||||
"Version - version",
|
||||
"Architecture - arch",
|
||||
"Display version - display-version",
|
||||
"Page size - page-size",
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ static void buildOutputDefault(const FFOSResult* os, FFstrbuf* result)
|
||||
else if(os->id.length > 0)
|
||||
ffStrbufAppend(result, &os->id);
|
||||
else
|
||||
ffStrbufAppend(result, &instance.state.platform.systemName);
|
||||
ffStrbufAppend(result, &instance.state.platform.sysinfo.name);
|
||||
|
||||
//Append code name if it is missing
|
||||
if(os->codename.length > 0 && !ffStrbufContainIgnCase(result, &os->codename))
|
||||
@ -55,10 +55,10 @@ static void buildOutputDefault(const FFOSResult* os, FFstrbuf* result)
|
||||
}
|
||||
|
||||
//Append architecture if it is missing
|
||||
if(!ffStrbufContainIgnCase(result, &instance.state.platform.systemArchitecture))
|
||||
if(!ffStrbufContainIgnCase(result, &instance.state.platform.sysinfo.architecture))
|
||||
{
|
||||
ffStrbufAppendC(result, ' ');
|
||||
ffStrbufAppend(result, &instance.state.platform.systemArchitecture);
|
||||
ffStrbufAppend(result, &instance.state.platform.sysinfo.architecture);
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,10 +80,10 @@ static void buildOutputNixOS(const FFOSResult* os, FFstrbuf* result)
|
||||
ffStrbufAppendC(result, ')');
|
||||
}
|
||||
|
||||
if(instance.state.platform.systemArchitecture.length > 0)
|
||||
if(instance.state.platform.sysinfo.architecture.length > 0)
|
||||
{
|
||||
ffStrbufAppendC(result, ' ');
|
||||
ffStrbufAppend(result, &instance.state.platform.systemArchitecture);
|
||||
ffStrbufAppend(result, &instance.state.platform.sysinfo.architecture);
|
||||
}
|
||||
}
|
||||
|
||||
@ -112,7 +112,7 @@ void ffPrintOS(FFOSOptions* options)
|
||||
else
|
||||
{
|
||||
FF_PRINT_FORMAT_CHECKED(FF_OS_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_OS_NUM_FORMAT_ARGS, ((FFformatarg[]){
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &instance.state.platform.systemName, "sysname"},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &instance.state.platform.sysinfo.name, "sysname"},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &os->name, "name"},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &os->prettyName, "pretty-name"},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &os->id, "id"},
|
||||
@ -123,7 +123,7 @@ void ffPrintOS(FFOSOptions* options)
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &os->versionID, "version-id"},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &os->codename, "codename"},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &os->buildID, "build-id"},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &instance.state.platform.systemArchitecture, "arch"}
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &instance.state.platform.sysinfo.architecture, "arch"}
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
@ -425,8 +425,8 @@ void ffPrintPackagesHelpFormat(void)
|
||||
"Number of nix-default packages - nix-default",
|
||||
"Number of apk packages - apk",
|
||||
"Number of pkg packages - pkg",
|
||||
"Number of flatpak-system packages - flatpak-system",
|
||||
"Number of flatpak-user packages - flatpak-user",
|
||||
"Number of flatpak-system app packages - flatpak-system",
|
||||
"Number of flatpak-user app packages - flatpak-user",
|
||||
"Number of snap packages - snap",
|
||||
"Number of brew packages - brew",
|
||||
"Number of brew-cask packages - brew-cask",
|
||||
@ -445,7 +445,7 @@ void ffPrintPackagesHelpFormat(void)
|
||||
"Number of guix-user packages - guix-user",
|
||||
"Number of guix-home packages - guix-home",
|
||||
"Total number of all nix packages - nix-all",
|
||||
"Total number of all flatpak packages - flatpak-all",
|
||||
"Total number of all flatpak app packages - flatpak-all",
|
||||
"Total number of all brew packages - brew-all",
|
||||
"Total number of all guix packages - guix-all",
|
||||
}));
|
||||
|
@ -21,7 +21,6 @@ void ffPrintPhysicalMemory(FFPhysicalMemoryOptions* options)
|
||||
}
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY prettySize = ffStrbufCreate();
|
||||
FF_STRBUF_AUTO_DESTROY key = ffStrbufCreate();
|
||||
|
||||
uint32_t i = 0;
|
||||
FF_LIST_FOR_EACH(FFPhysicalMemoryResult, device, result)
|
||||
|
@ -176,7 +176,6 @@ void ffGenerateTitleJsonResult(FF_MAYBE_UNUSED FFTitleOptions* options, yyjson_m
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "homeDir", &instance.state.platform.homeDir);
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "exePath", &instance.state.platform.exePath);
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "userShell", &instance.state.platform.userShell);
|
||||
yyjson_mut_obj_add_uint(doc, obj, "pageSize", instance.state.platform.pageSize);
|
||||
}
|
||||
|
||||
void ffPrintTitleHelpFormat(void)
|
||||
|
@ -5,17 +5,16 @@
|
||||
#include "modules/version/version.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_VERSION_NUM_FORMAT_ARGS 9
|
||||
#define FF_VERSION_NUM_FORMAT_ARGS 10
|
||||
|
||||
void ffPrintVersion(FFVersionOptions* options)
|
||||
{
|
||||
FFVersionResult result;
|
||||
ffDetectVersion(&result);
|
||||
FFVersionResult* result = &ffVersionResult;
|
||||
|
||||
if(options->moduleArgs.outputFormat.length == 0)
|
||||
{
|
||||
ffPrintLogoAndKey(FF_VERSION_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT);
|
||||
printf("%s %s%s%s (%s)\n", result.projectName, result.version, result.versionTweak, result.debugMode ? "-debug" : "", result.architecture);
|
||||
printf("%s %s%s%s (%s)\n", result->projectName, result->version, result->versionTweak, result->debugMode ? "-debug" : "", result->architecture);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -32,14 +31,15 @@ void ffPrintVersion(FFVersionOptions* options)
|
||||
}
|
||||
|
||||
FF_PRINT_FORMAT_CHECKED(FF_VERSION_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_VERSION_NUM_FORMAT_ARGS, ((FFformatarg[]){
|
||||
{FF_FORMAT_ARG_TYPE_STRING, result.projectName, "project-name"},
|
||||
{FF_FORMAT_ARG_TYPE_STRING, result.version, "version"},
|
||||
{FF_FORMAT_ARG_TYPE_STRING, result.versionTweak, "version-tweak"},
|
||||
{FF_FORMAT_ARG_TYPE_STRING, result.debugMode ? "debug" : "release", "build-type"},
|
||||
{FF_FORMAT_ARG_TYPE_STRING, result.architecture, "arch"},
|
||||
{FF_FORMAT_ARG_TYPE_STRING, result.cmakeBuiltType, "cmake-built-type"},
|
||||
{FF_FORMAT_ARG_TYPE_STRING, result.compileTime, "compile-time"},
|
||||
{FF_FORMAT_ARG_TYPE_STRING, result.compiler, "compiler"},
|
||||
{FF_FORMAT_ARG_TYPE_STRING, result->projectName, "project-name"},
|
||||
{FF_FORMAT_ARG_TYPE_STRING, result->version, "version"},
|
||||
{FF_FORMAT_ARG_TYPE_STRING, result->versionTweak, "version-tweak"},
|
||||
{FF_FORMAT_ARG_TYPE_STRING, result->debugMode ? "debug" : "release", "build-type"},
|
||||
{FF_FORMAT_ARG_TYPE_STRING, result->sysName, "sysname"},
|
||||
{FF_FORMAT_ARG_TYPE_STRING, result->architecture, "arch"},
|
||||
{FF_FORMAT_ARG_TYPE_STRING, result->cmakeBuiltType, "cmake-built-type"},
|
||||
{FF_FORMAT_ARG_TYPE_STRING, result->compileTime, "compile-time"},
|
||||
{FF_FORMAT_ARG_TYPE_STRING, result->compiler, "compiler"},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &buf, "libc-used"},
|
||||
}));
|
||||
}
|
||||
@ -82,18 +82,18 @@ void ffGenerateVersionJsonConfig(FFVersionOptions* options, yyjson_mut_doc* doc,
|
||||
|
||||
void ffGenerateVersionJsonResult(FF_MAYBE_UNUSED FFVersionOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module)
|
||||
{
|
||||
FFVersionResult result;
|
||||
ffDetectVersion(&result);
|
||||
FFVersionResult* result = &ffVersionResult;
|
||||
|
||||
yyjson_mut_val* obj = yyjson_mut_obj_add_obj(doc, module, "result");
|
||||
yyjson_mut_obj_add_str(doc, obj, "projectName", result.projectName);
|
||||
yyjson_mut_obj_add_str(doc, obj, "architecture", result.architecture);
|
||||
yyjson_mut_obj_add_str(doc, obj, "version", result.version);
|
||||
yyjson_mut_obj_add_str(doc, obj, "versionTweak", result.versionTweak);
|
||||
yyjson_mut_obj_add_str(doc, obj, "cmakeBuiltType", result.cmakeBuiltType);
|
||||
yyjson_mut_obj_add_str(doc, obj, "compileTime", result.compileTime);
|
||||
yyjson_mut_obj_add_str(doc, obj, "compiler", result.compiler);
|
||||
yyjson_mut_obj_add_bool(doc, obj, "debugMode", result.debugMode);
|
||||
yyjson_mut_obj_add_str(doc, obj, "projectName", result->projectName);
|
||||
yyjson_mut_obj_add_str(doc, obj, "sysName", result->sysName);
|
||||
yyjson_mut_obj_add_str(doc, obj, "architecture", result->architecture);
|
||||
yyjson_mut_obj_add_str(doc, obj, "version", result->version);
|
||||
yyjson_mut_obj_add_str(doc, obj, "versionTweak", result->versionTweak);
|
||||
yyjson_mut_obj_add_str(doc, obj, "cmakeBuiltType", result->cmakeBuiltType);
|
||||
yyjson_mut_obj_add_str(doc, obj, "compileTime", result->compileTime);
|
||||
yyjson_mut_obj_add_str(doc, obj, "compiler", result->compiler);
|
||||
yyjson_mut_obj_add_bool(doc, obj, "debugMode", result->debugMode);
|
||||
|
||||
FFLibcResult libcResult;
|
||||
if (ffDetectLibc(&libcResult))
|
||||
@ -119,6 +119,7 @@ void ffPrintVersionHelpFormat(void)
|
||||
"Version - version",
|
||||
"Version tweak - version-tweak",
|
||||
"Build type (debug or release) - build-type",
|
||||
"System name - sysname",
|
||||
"Architecture - arch",
|
||||
"CMake build type when compiling (Debug, Release, RelWithDebInfo, MinSizeRel) - cmake-built-type",
|
||||
"Date time when compiling - compile-time",
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "FFPlatform_private.h"
|
||||
#include "util/stringUtils.h"
|
||||
#include "common/io/io.h"
|
||||
#include "detection/version/version.h"
|
||||
|
||||
void ffPlatformInit(FFPlatform* platform)
|
||||
{
|
||||
@ -14,30 +15,20 @@ void ffPlatformInit(FFPlatform* platform)
|
||||
ffStrbufInit(&platform->hostName);
|
||||
ffStrbufInit(&platform->userShell);
|
||||
|
||||
ffStrbufInit(&platform->systemName);
|
||||
ffStrbufInit(&platform->systemRelease);
|
||||
ffStrbufInit(&platform->systemVersion);
|
||||
ffStrbufInit(&platform->systemArchitecture);
|
||||
FFPlatformSysinfo* info = &platform->sysinfo;
|
||||
|
||||
ffStrbufInit(&info->name);
|
||||
ffStrbufInit(&info->release);
|
||||
ffStrbufInit(&info->version);
|
||||
ffStrbufInit(&info->architecture);
|
||||
|
||||
ffPlatformInitImpl(platform);
|
||||
|
||||
if(platform->systemName.length == 0)
|
||||
{
|
||||
#if defined(__linux__)
|
||||
ffStrbufAppendS(&platform->systemName, "Linux");
|
||||
#elif defined(__FreeBSD__)
|
||||
ffStrbufAppendS(&platform->systemName, "FreeBSD");
|
||||
#elif defined(__APPLE__)
|
||||
ffStrbufAppendS(&platform->systemName, "Darwin");
|
||||
#elif defined(_WIN32)
|
||||
ffStrbufAppendS(&platform->systemName, "Windows_NT");
|
||||
#else
|
||||
ffStrbufAppendS(&platform->systemName, "Unknown");
|
||||
#endif
|
||||
}
|
||||
if(info->name.length == 0)
|
||||
ffStrbufSetStatic(&info->name, ffVersionResult.sysName);
|
||||
|
||||
if(platform->systemArchitecture.length == 0)
|
||||
ffStrbufAppendS(&platform->systemArchitecture, "Unknown");
|
||||
if(info->architecture.length == 0)
|
||||
ffStrbufSetStatic(&info->architecture, ffVersionResult.architecture);
|
||||
}
|
||||
|
||||
void ffPlatformDestroy(FFPlatform* platform)
|
||||
@ -58,11 +49,12 @@ void ffPlatformDestroy(FFPlatform* platform)
|
||||
ffStrbufDestroy(&platform->hostName);
|
||||
ffStrbufDestroy(&platform->userShell);
|
||||
|
||||
ffStrbufDestroy(&platform->systemArchitecture);
|
||||
ffStrbufDestroy(&platform->systemName);
|
||||
ffStrbufDestroy(&platform->systemRelease);
|
||||
ffStrbufDestroy(&platform->systemVersion);
|
||||
ffStrbufDestroy(&platform->systemDisplayVersion);
|
||||
FFPlatformSysinfo* info = &platform->sysinfo;
|
||||
ffStrbufDestroy(&info->architecture);
|
||||
ffStrbufDestroy(&info->name);
|
||||
ffStrbufDestroy(&info->release);
|
||||
ffStrbufDestroy(&info->version);
|
||||
ffStrbufDestroy(&info->displayVersion);
|
||||
}
|
||||
|
||||
void ffPlatformPathAddAbsolute(FFlist* dirs, const char* path)
|
||||
|
@ -3,7 +3,18 @@
|
||||
#include "util/FFstrbuf.h"
|
||||
#include "util/FFlist.h"
|
||||
|
||||
typedef struct FFPlatform {
|
||||
typedef struct FFPlatformSysinfo
|
||||
{
|
||||
FFstrbuf name;
|
||||
FFstrbuf release;
|
||||
FFstrbuf version;
|
||||
FFstrbuf architecture;
|
||||
FFstrbuf displayVersion;
|
||||
uint32_t pageSize;
|
||||
} FFPlatformSysinfo;
|
||||
|
||||
typedef struct FFPlatform
|
||||
{
|
||||
FFstrbuf homeDir; // Trailing slash included
|
||||
FFstrbuf cacheDir; // Trailing slash included
|
||||
FFlist configDirs; // List of FFstrbuf, trailing slash included
|
||||
@ -14,13 +25,7 @@ typedef struct FFPlatform {
|
||||
FFstrbuf hostName;
|
||||
FFstrbuf userShell;
|
||||
|
||||
FFstrbuf systemName;
|
||||
FFstrbuf systemRelease;
|
||||
FFstrbuf systemVersion;
|
||||
FFstrbuf systemArchitecture;
|
||||
FFstrbuf systemDisplayVersion;
|
||||
|
||||
uint32_t pageSize;
|
||||
FFPlatformSysinfo sysinfo;
|
||||
} FFPlatform;
|
||||
|
||||
void ffPlatformInit(FFPlatform* platform);
|
||||
|
@ -169,13 +169,19 @@ static void getUserShell(FFPlatform* platform, const struct passwd* pwd)
|
||||
ffStrbufAppendS(&platform->userShell, shell);
|
||||
}
|
||||
|
||||
static void getPageSize(FFPlatform* platform)
|
||||
static void getSysinfo(FFPlatformSysinfo* info, const struct utsname* uts)
|
||||
{
|
||||
ffStrbufAppendS(&info->name, uts->sysname);
|
||||
ffStrbufAppendS(&info->release, uts->release);
|
||||
ffStrbufAppendS(&info->version, uts->version);
|
||||
ffStrbufAppendS(&info->architecture, uts->machine);
|
||||
ffStrbufInit(&info->displayVersion);
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__APPLE__)
|
||||
size_t length = sizeof(platform->pageSize);
|
||||
sysctl((int[]){ CTL_HW, HW_PAGESIZE }, 2, &platform->pageSize, &length, NULL, 0);
|
||||
size_t length = sizeof(info->pageSize);
|
||||
sysctl((int[]){ CTL_HW, HW_PAGESIZE }, 2, &info->pageSize, &length, NULL, 0);
|
||||
#else
|
||||
platform->pageSize = (uint32_t) sysconf(_SC_PAGESIZE);
|
||||
info->pageSize = (uint32_t) sysconf(_SC_PAGESIZE);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -197,11 +203,5 @@ void ffPlatformInitImpl(FFPlatform* platform)
|
||||
getHostName(platform, &uts);
|
||||
getUserShell(platform, pwd);
|
||||
|
||||
ffStrbufAppendS(&platform->systemName, uts.sysname);
|
||||
ffStrbufAppendS(&platform->systemRelease, uts.release);
|
||||
ffStrbufAppendS(&platform->systemVersion, uts.version);
|
||||
ffStrbufAppendS(&platform->systemArchitecture, uts.machine);
|
||||
ffStrbufInit(&platform->systemDisplayVersion);
|
||||
|
||||
getPageSize(platform);
|
||||
getSysinfo(&platform->sysinfo, &uts);
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ static void getUserShell(FFPlatform* platform)
|
||||
ffStrbufReplaceAllC(&platform->userShell, '\\', '/');
|
||||
}
|
||||
|
||||
static void getSystemReleaseAndVersion(FFPlatform* platform)
|
||||
static void getSystemReleaseAndVersion(FFPlatformSysinfo* info)
|
||||
{
|
||||
RTL_OSVERSIONINFOW osVersion = { .dwOSVersionInfoSize = sizeof(osVersion) };
|
||||
if (!NT_SUCCESS(RtlGetVersion(&osVersion)))
|
||||
@ -172,39 +172,39 @@ static void getSystemReleaseAndVersion(FFPlatform* platform)
|
||||
uint32_t ubr = 0;
|
||||
ffRegReadUint(hKey, L"UBR", &ubr, NULL);
|
||||
|
||||
ffStrbufAppendF(&platform->systemRelease,
|
||||
ffStrbufAppendF(&info->release,
|
||||
"%u.%u.%u.%u",
|
||||
(unsigned) osVersion.dwMajorVersion,
|
||||
(unsigned) osVersion.dwMinorVersion,
|
||||
(unsigned) osVersion.dwBuildNumber,
|
||||
(unsigned) ubr);
|
||||
|
||||
ffStrbufInit(&platform->systemDisplayVersion);
|
||||
if(!ffRegReadStrbuf(hKey, L"DisplayVersion", &platform->systemDisplayVersion, NULL))
|
||||
ffStrbufInit(&info->displayVersion);
|
||||
if(!ffRegReadStrbuf(hKey, L"DisplayVersion", &info->displayVersion, NULL))
|
||||
{
|
||||
if (osVersion.szCSDVersion[0])
|
||||
ffStrbufSetWS(&platform->systemDisplayVersion, osVersion.szCSDVersion);
|
||||
ffStrbufSetWS(&info->displayVersion, osVersion.szCSDVersion);
|
||||
else
|
||||
ffRegReadStrbuf(hKey, L"ReleaseId", &platform->systemDisplayVersion, NULL); // For old Windows 10
|
||||
ffRegReadStrbuf(hKey, L"ReleaseId", &info->displayVersion, NULL); // For old Windows 10
|
||||
}
|
||||
|
||||
ffRegReadStrbuf(hKey, L"BuildLabEx", &platform->systemVersion, NULL);
|
||||
ffRegReadStrbuf(hKey, L"BuildLabEx", &info->version, NULL);
|
||||
|
||||
switch (osVersion.dwPlatformId)
|
||||
{
|
||||
case VER_PLATFORM_WIN32s:
|
||||
ffStrbufSetStatic(&platform->systemName, "WIN32s");
|
||||
ffStrbufSetStatic(&info->name, "WIN32s");
|
||||
break;
|
||||
case VER_PLATFORM_WIN32_WINDOWS:
|
||||
ffStrbufSetStatic(&platform->systemName, "WIN32_WINDOWS");
|
||||
ffStrbufSetStatic(&info->name, "WIN32_WINDOWS");
|
||||
break;
|
||||
case VER_PLATFORM_WIN32_NT:
|
||||
ffStrbufSetStatic(&platform->systemName, "WIN32_NT");
|
||||
ffStrbufSetStatic(&info->name, "WIN32_NT");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void getSystemArchitectureAndPageSize(FFPlatform* platform)
|
||||
static void getSystemArchitectureAndPageSize(FFPlatformSysinfo* info)
|
||||
{
|
||||
SYSTEM_INFO sysInfo;
|
||||
GetNativeSystemInfo(&sysInfo);
|
||||
@ -212,52 +212,53 @@ static void getSystemArchitectureAndPageSize(FFPlatform* platform)
|
||||
switch(sysInfo.wProcessorArchitecture)
|
||||
{
|
||||
case PROCESSOR_ARCHITECTURE_AMD64:
|
||||
ffStrbufSetStatic(&platform->systemArchitecture, "x86_64");
|
||||
ffStrbufSetStatic(&info->architecture, "x86_64");
|
||||
break;
|
||||
case PROCESSOR_ARCHITECTURE_IA64:
|
||||
ffStrbufSetStatic(&platform->systemArchitecture, "ia64");
|
||||
ffStrbufSetStatic(&info->architecture, "ia64");
|
||||
break;
|
||||
case PROCESSOR_ARCHITECTURE_INTEL:
|
||||
switch (sysInfo.wProcessorLevel)
|
||||
{
|
||||
case 4:
|
||||
ffStrbufSetStatic(&platform->systemArchitecture, "i486");
|
||||
ffStrbufSetStatic(&info->architecture, "i486");
|
||||
break;
|
||||
case 5:
|
||||
ffStrbufSetStatic(&platform->systemArchitecture, "i586");
|
||||
ffStrbufSetStatic(&info->architecture, "i586");
|
||||
break;
|
||||
case 6:
|
||||
ffStrbufSetStatic(&platform->systemArchitecture, "i686");
|
||||
ffStrbufSetStatic(&info->architecture, "i686");
|
||||
break;
|
||||
default:
|
||||
ffStrbufSetStatic(&platform->systemArchitecture, "i386");
|
||||
ffStrbufSetStatic(&info->architecture, "i386");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case PROCESSOR_ARCHITECTURE_ARM64:
|
||||
ffStrbufSetStatic(&platform->systemArchitecture, "aarch64");
|
||||
ffStrbufSetStatic(&info->architecture, "aarch64");
|
||||
break;
|
||||
case PROCESSOR_ARCHITECTURE_ARM:
|
||||
ffStrbufSetStatic(&platform->systemArchitecture, "arm");
|
||||
ffStrbufSetStatic(&info->architecture, "arm");
|
||||
break;
|
||||
case PROCESSOR_ARCHITECTURE_PPC:
|
||||
ffStrbufSetStatic(&platform->systemArchitecture, "ppc");
|
||||
ffStrbufSetStatic(&info->architecture, "ppc");
|
||||
break;
|
||||
case PROCESSOR_ARCHITECTURE_MIPS:
|
||||
ffStrbufSetStatic(&platform->systemArchitecture, "mips");
|
||||
ffStrbufSetStatic(&info->architecture, "mips");
|
||||
break;
|
||||
case PROCESSOR_ARCHITECTURE_ALPHA:
|
||||
ffStrbufSetStatic(&platform->systemArchitecture, "alpha");
|
||||
ffStrbufSetStatic(&info->architecture, "alpha");
|
||||
break;
|
||||
case PROCESSOR_ARCHITECTURE_ALPHA64:
|
||||
ffStrbufSetStatic(&platform->systemArchitecture, "alpha64");
|
||||
ffStrbufSetStatic(&info->architecture, "alpha64");
|
||||
break;
|
||||
case PROCESSOR_ARCHITECTURE_UNKNOWN:
|
||||
default:
|
||||
ffStrbufSetStatic(&info->architecture, "unknown");
|
||||
break;
|
||||
}
|
||||
|
||||
platform->pageSize = sysInfo.dwPageSize;
|
||||
info->pageSize = sysInfo.dwPageSize;
|
||||
}
|
||||
|
||||
void ffPlatformInitImpl(FFPlatform* platform)
|
||||
@ -272,6 +273,6 @@ void ffPlatformInitImpl(FFPlatform* platform)
|
||||
getHostName(platform);
|
||||
getUserShell(platform);
|
||||
|
||||
getSystemReleaseAndVersion(platform);
|
||||
getSystemArchitectureAndPageSize(platform);
|
||||
getSystemReleaseAndVersion(&platform->sysinfo);
|
||||
getSystemArchitectureAndPageSize(&platform->sysinfo);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user