mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-12 20:24:35 +03:00
Separate display from sampling in SysArch and Hostname Meters
Several of our newer meters have merged coding concerns in terms of extracting values and displaying those values. This commit rectifies that for the SysArch and Hostname meters, allowing use of this code with alternative front/back ends. The SysArch code is also refined to detect whether the platform has an os-release file at all and/or the sys/utsname.h header via configure.ac.
This commit is contained in:
@ -64,6 +64,8 @@ const MeterClass* const Platform_meterTypes[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
static const char Platform_unsupported[] = "unsupported";
|
||||
|
||||
void Platform_init(void) {
|
||||
/* no platform-specific setup needed */
|
||||
}
|
||||
@ -146,3 +148,11 @@ void Platform_getBattery(double* percent, ACPresence* isOnAC) {
|
||||
*percent = NAN;
|
||||
*isOnAC = AC_ERROR;
|
||||
}
|
||||
|
||||
void Platform_getHostname(char* buffer, size_t size) {
|
||||
String_safeStrncpy(buffer, Platform_unsupported, size);
|
||||
}
|
||||
|
||||
void Platform_getRelease(char** string) {
|
||||
*string = xStrdup(Platform_unsupported);
|
||||
}
|
||||
|
Reference in New Issue
Block a user