hostname.c 365 B

123456789101112131415161718
  1. /*
  2. htop - generic/hostname.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 "generic/hostname.h"
  9. #include <unistd.h>
  10. void Generic_hostname(char* buffer, size_t size) {
  11. gethostname(buffer, size - 1);
  12. buffer[size - 1] = '\0';
  13. }