Files
fastfetch/src/detection/host/host_nbsd.c
T

26 lines
862 B
C
Raw Normal View History

2024-10-27 11:43:36 +08:00
#include "host.h"
2026-01-06 09:48:38 +08:00
#include "common/sysctl.h"
2026-03-31 20:01:25 +08:00
#include "common/smbios.h"
2024-10-27 11:43:36 +08:00
2026-03-29 09:28:49 +08:00
const char* ffDetectHost(FFHostResult* host) {
2026-07-10 18:08:04 +08:00
const char* error = nullptr;
2026-03-29 09:28:49 +08:00
if ((error = ffSysctlGetString("machdep.dmi.system-product", &host->name))) {
2024-10-27 11:43:36 +08:00
return error;
2026-03-29 09:28:49 +08:00
}
2024-10-27 11:43:36 +08:00
ffCleanUpSmbiosValue(&host->name);
2026-07-10 18:08:04 +08:00
if (ffSysctlGetString("machdep.dmi.system-vendor", &host->vendor) == nullptr) {
2024-10-27 11:43:36 +08:00
ffCleanUpSmbiosValue(&host->vendor);
2026-03-29 09:28:49 +08:00
}
2026-07-10 18:08:04 +08:00
if (ffSysctlGetString("machdep.dmi.system-version", &host->version) == nullptr) {
2024-10-27 11:43:36 +08:00
ffCleanUpSmbiosValue(&host->version);
2026-03-29 09:28:49 +08:00
}
2026-07-10 18:08:04 +08:00
if (ffSysctlGetString("machdep.dmi.system-serial", &host->serial) == nullptr) {
2024-12-21 18:38:54 +08:00
ffCleanUpSmbiosValue(&host->serial);
2026-03-29 09:28:49 +08:00
}
2026-07-10 18:08:04 +08:00
if (ffSysctlGetString("machdep.dmi.system-uuid", &host->uuid) == nullptr) {
2024-12-21 18:38:54 +08:00
ffCleanUpSmbiosValue(&host->uuid);
2026-03-29 09:28:49 +08:00
}
2024-10-27 11:43:36 +08:00
2026-07-10 18:08:04 +08:00
return nullptr;
2024-10-27 11:43:36 +08:00
}