suckless/slstatus

components/hostname.c in master
Repositories | Summary | Log | Files | README | LICENSE

hostname.c (291B) download


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