mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-30 09:33:39 +01:00
Host: split Bios module; init support for Windows
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
#include "fastfetch.h"
|
||||
#include "common/printing.h"
|
||||
#include "common/caching.h"
|
||||
#include "detection/bios/bios.h"
|
||||
|
||||
#define FF_BIOS_MODULE_NAME "Bios"
|
||||
#define FF_BIOS_NUM_FORMAT_ARGS 4
|
||||
|
||||
void ffPrintBios(FFinstance* instance)
|
||||
{
|
||||
if(ffPrintFromCache(instance, FF_BIOS_MODULE_NAME, &instance->config.bios, FF_BIOS_NUM_FORMAT_ARGS))
|
||||
return;
|
||||
|
||||
FFBiosResult result;
|
||||
ffDetectBios(&result);
|
||||
|
||||
if(result.error.length > 0)
|
||||
{
|
||||
ffPrintError(instance, FF_BIOS_MODULE_NAME, 0, &instance->config.bios, "%*s", result.error.length, result.error.chars);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if(result.biosRelease.length == 0)
|
||||
{
|
||||
ffPrintError(instance, FF_BIOS_MODULE_NAME, 0, &instance->config.bios, "bios_release is not set.");
|
||||
goto exit;
|
||||
}
|
||||
|
||||
ffPrintAndWriteToCache(instance, FF_BIOS_MODULE_NAME, &instance->config.bios, &result.biosRelease, FF_BIOS_NUM_FORMAT_ARGS, (FFformatarg[]) {
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &result.biosDate},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &result.biosRelease},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &result.biosVendor},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &result.biosVersion},
|
||||
});
|
||||
|
||||
exit:
|
||||
ffStrbufDestroy(&result.biosDate);
|
||||
ffStrbufDestroy(&result.biosRelease);
|
||||
ffStrbufDestroy(&result.biosVendor);
|
||||
ffStrbufDestroy(&result.biosVersion);
|
||||
ffStrbufDestroy(&result.error);
|
||||
}
|
||||
+7
-5
@@ -4,7 +4,7 @@
|
||||
#include "detection/host/host.h"
|
||||
|
||||
#define FF_HOST_MODULE_NAME "Host"
|
||||
#define FF_HOST_NUM_FORMAT_ARGS 15
|
||||
#define FF_HOST_NUM_FORMAT_ARGS 11
|
||||
|
||||
void ffPrintHost(FFinstance* instance)
|
||||
{
|
||||
@@ -13,6 +13,12 @@ void ffPrintHost(FFinstance* instance)
|
||||
|
||||
const FFHostResult* host = ffDetectHost();
|
||||
|
||||
if(host->error.length > 0)
|
||||
{
|
||||
ffPrintError(instance, FF_HOST_MODULE_NAME, 0, &instance->config.host, "%*s", host->error.length, host->error.chars);
|
||||
return;
|
||||
}
|
||||
|
||||
if(host->productFamily.length == 0 && host->productName.length == 0)
|
||||
{
|
||||
ffPrintError(instance, FF_HOST_MODULE_NAME, 0, &instance->config.host, "neither product_family nor product_name is set by O.E.M.");
|
||||
@@ -38,10 +44,6 @@ void ffPrintHost(FFinstance* instance)
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &host->productName},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &host->productVersion},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &host->productSku},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &host->biosDate},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &host->biosRelease},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &host->biosVendor},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &host->biosVersion},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &host->boardName},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &host->boardVendor},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &host->boardVersion},
|
||||
|
||||
Reference in New Issue
Block a user