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