2009-02-17 18:33:32 +00:00
|
|
|
/*
|
2011-12-26 21:35:57 +00:00
|
|
|
htop - HostnameMeter.c
|
2011-05-26 16:35:07 +00:00
|
|
|
(C) 2004-2011 Hisham H. Muhammad
|
2020-10-05 07:51:32 +00:00
|
|
|
Released under the GNU GPLv2, see the COPYING file
|
2009-02-17 18:33:32 +00:00
|
|
|
in the source distribution for its full text.
|
|
|
|
*/
|
|
|
|
|
2020-09-19 11:55:23 +00:00
|
|
|
#include "config.h" // IWYU pragma: keep
|
2011-12-26 21:35:57 +00:00
|
|
|
|
2020-09-19 11:55:23 +00:00
|
|
|
#include "HostnameMeter.h"
|
2009-02-17 18:33:32 +00:00
|
|
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
2020-09-19 11:55:23 +00:00
|
|
|
#include "CRT.h"
|
|
|
|
#include "Object.h"
|
|
|
|
|
2009-02-17 18:33:32 +00:00
|
|
|
|
2020-09-28 10:23:07 +00:00
|
|
|
static const int HostnameMeter_attributes[] = {
|
2009-02-17 18:33:32 +00:00
|
|
|
HOSTNAME
|
|
|
|
};
|
|
|
|
|
2020-11-24 17:31:03 +00:00
|
|
|
static void HostnameMeter_updateValues(Meter* this, char* buffer, size_t size) {
|
2010-02-25 01:43:18 +00:00
|
|
|
(void) this;
|
2020-10-31 22:28:02 +00:00
|
|
|
gethostname(buffer, size - 1);
|
2009-02-17 18:33:32 +00:00
|
|
|
}
|
|
|
|
|
2020-10-05 11:19:50 +00:00
|
|
|
const MeterClass HostnameMeter_class = {
|
2012-12-05 15:12:20 +00:00
|
|
|
.super = {
|
|
|
|
.extends = Class(Meter),
|
|
|
|
.delete = Meter_delete
|
|
|
|
},
|
2016-05-04 05:39:26 +00:00
|
|
|
.updateValues = HostnameMeter_updateValues,
|
2012-12-05 15:12:20 +00:00
|
|
|
.defaultMode = TEXT_METERMODE,
|
2016-03-11 02:54:34 +00:00
|
|
|
.maxItems = 0,
|
2009-02-17 18:33:32 +00:00
|
|
|
.total = 100.0,
|
|
|
|
.attributes = HostnameMeter_attributes,
|
|
|
|
.name = "Hostname",
|
|
|
|
.uiName = "Hostname",
|
|
|
|
.caption = "Hostname: ",
|
|
|
|
};
|