summaryrefslogtreecommitdiffstats
path: root/generic/hostname.c
diff options
context:
space:
mode:
authorNathan Scott <nathans@redhat.com>2021-03-03 10:59:28 +1100
committerNathan Scott <nathans@redhat.com>2021-03-04 13:40:59 +1100
commit61ef1134d97dbcf8b4ee069b36addf3c706ff55c (patch)
tree2cc478d92938b01f1d861350538742df6cea7e9e /generic/hostname.c
parent5b50ae3aa3a418f3f84ff2fdb172ab447753814f (diff)
Move generic (shared) code into its own sub-directory
Code that is shared across some (but not all) platforms is moved into a 'generic' home. Makefile.am cleanups to match plus some minor alphabetic reordering/formatting. As discussed in https://github.com/htop-dev/htop/pull/553
Diffstat (limited to 'generic/hostname.c')
-rw-r--r--generic/hostname.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/generic/hostname.c b/generic/hostname.c
new file mode 100644
index 00000000..78404e43
--- /dev/null
+++ b/generic/hostname.c
@@ -0,0 +1,16 @@
+/*
+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);
+}

© 2014-2024 Faster IT GmbH | imprint | privacy policy