1 /* gethostname(2) system call emulation */
8 #include <net/gen/netdb.h>
10 #define HOSTNAME_FILE "/etc/hostname.file"
12 int gethostname(char *buf
, size_t len
)
18 if ((fd
= open(HOSTNAME_FILE
, O_RDONLY
)) < 0) return -1;
20 r
= read(fd
, buf
, len
);
22 if (r
== -1) return -1;
25 if ((nl
= strchr(buf
, '\n')) != NULL
) *nl
= '\0';