hostname.c 291 B

123456789101112131415161718
  1. /* See LICENSE file for copyright and license details. */
  2. #include <stdio.h>
  3. #include <unistd.h>
  4. #include "../slstatus.h"
  5. #include "../util.h"
  6. const char *
  7. hostname(const char *unused)
  8. {
  9. if (gethostname(buf, sizeof(buf)) < 0) {
  10. warn("gethostbyname:");
  11. return NULL;
  12. }
  13. return buf;
  14. }