projects
/
oweals
/
musl.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
yet another ugly legacy syscall rename...
[oweals/musl.git]
/
src
/
unistd
/
gethostname.c
1
#include <unistd.h>
2
#include <sys/utsname.h>
3
#include <string.h>
4
5
int gethostname(char *name, size_t len)
6
{
7
size_t i;
8
struct utsname uts;
9
if (uname(&uts)) return -1;
10
if (len > sizeof uts.nodename) len = sizeof uts.nodename;
11
for (i=0; i<len && (name[i] = uts.nodename[i]); i++);
12
if (i==len) name[i-1] = 0;
13
return 0;
14
}