HostnameMeter.c 883 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. htop - HostnameMeter.c
  3. (C) 2004-2011 Hisham H. Muhammad
  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 "HostnameMeter.h"
  9. #include "CRT.h"
  10. #include "Object.h"
  11. #include "Platform.h"
  12. static const int HostnameMeter_attributes[] = {
  13. HOSTNAME
  14. };
  15. static void HostnameMeter_updateValues(Meter* this) {
  16. Platform_getHostname(this->txtBuffer, sizeof(this->txtBuffer));
  17. }
  18. const MeterClass HostnameMeter_class = {
  19. .super = {
  20. .extends = Class(Meter),
  21. .delete = Meter_delete
  22. },
  23. .updateValues = HostnameMeter_updateValues,
  24. .defaultMode = TEXT_METERMODE,
  25. .supportedModes = (1 << TEXT_METERMODE),
  26. .maxItems = 0,
  27. .total = 0.0,
  28. .attributes = HostnameMeter_attributes,
  29. .name = "Hostname",
  30. .uiName = "Hostname",
  31. .caption = "Hostname: ",
  32. };