X-Git-Url: https://git.xinqibao.xyz/slstatus.git/blobdiff_plain/8e25af7dc33bdcc0df6f4f173da7a2f883141d70..6820631175868c277effa7cc05f9cb3197b72654:/hostname.c?ds=sidebyside diff --git a/hostname.c b/hostname.c new file mode 100644 index 0000000..23c5a16 --- /dev/null +++ b/hostname.c @@ -0,0 +1,15 @@ +#include +#include + +#include "util.h" + +const char * +hostname(void) +{ + if (gethostname(buf, sizeof(buf)) == -1) { + warn("hostname"); + return NULL; + } + + return buf; +}