blob: b9dcbafc1e3eadd552c9f7cf0115cd35a1623f7a [file] [log] [blame]
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <stdio.h>
#include <sys/types.h>
int main( void )
{
char hostname[512];
int ret;
ret = gethostname(hostname, sizeof(hostname));
if (ret < 0) {
printf("gethostname() returned error %d: %s\n", errno, strerror(errno));
return 1;
}
printf("gethostname() returned '%s'\n", hostname);
return 0;
}