summaryrefslogtreecommitdiffstats
path: root/generic/hostname.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/hostname.c')
-rw-r--r--generic/hostname.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/generic/hostname.c b/generic/hostname.c
new file mode 100644
index 0000000..69a4146
--- /dev/null
+++ b/generic/hostname.c
@@ -0,0 +1,17 @@
+/*
+htop - generic/hostname.c
+(C) 2021 htop dev team
+Released under the GNU GPLv2+, see the COPYING file
+in the source distribution for its full text.
+*/
+#include "config.h" // IWYU pragma: keep
+
+#include "generic/hostname.h"
+
+#include <unistd.h>
+
+
+void Generic_hostname(char* buffer, size_t size) {
+ gethostname(buffer, size - 1);
+ buffer[size - 1] = '\0';
+}