SysArchMeter.c 988 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. htop - SysArchMeter.c
  3. (C) 2021 htop dev team
  4. Released under the GNU GPLv2+, see the COPYING file
  5. in the source distribution for its full text.
  6. */
  7. #include "config.h" // IWYU pragma: keep
  8. #include "SysArchMeter.h"
  9. #include <stddef.h>
  10. #include "CRT.h"
  11. #include "Object.h"
  12. #include "Platform.h"
  13. #include "XUtils.h"
  14. static const int SysArchMeter_attributes[] = {HOSTNAME};
  15. static void SysArchMeter_updateValues(Meter* this) {
  16. static char* string;
  17. if (string == NULL)
  18. Platform_getRelease(&string);
  19. String_safeStrncpy(this->txtBuffer, string, sizeof(this->txtBuffer));
  20. }
  21. const MeterClass SysArchMeter_class = {
  22. .super = {
  23. .extends = Class(Meter),
  24. .delete = Meter_delete
  25. },
  26. .updateValues = SysArchMeter_updateValues,
  27. .defaultMode = TEXT_METERMODE,
  28. .supportedModes = (1 << TEXT_METERMODE),
  29. .maxItems = 0,
  30. .total = 0.0,
  31. .attributes = SysArchMeter_attributes,
  32. .name = "System",
  33. .uiName = "System",
  34. .caption = "System: ",
  35. };