blob: f33ca87c72c0e0239fde1d37f8a9816b6f9aac1e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
#include <LibC/unistd.h>
#include <LibC/stdio.h>
#include <LibC/errno.h>
#include <LibC/string.h>
int main(int c, char** v)
{
char buffer[HOST_NAME_MAX];
int rc = gethostname(buffer, sizeof(buffer));
if (rc < 0) {
printf("gethostname() error: %s\n", strerror(errno));
return 1;
}
printf("%s\n", buffer);
return 0;
}
|