Initial import from FreeBSD RELENG_4:
[dragonfly.git] / contrib / nvi / clib / gethostname.c
1 #include "config.h"
2
3 /*
4  * Solaris doesn't include the gethostname call by default.
5  */
6 #include <sys/utsname.h>
7 #include <sys/systeminfo.h>
8
9 #include <netdb.h>
10
11 /*
12  * PUBLIC: #ifndef HAVE_GETHOSTNAME
13  * PUBLIC: int gethostname __P((char *, int));
14  * PUBLIC: #endif
15  */
16 int
17 gethostname(host, len)
18         char *host;
19         int len;
20 {
21         return (sysinfo(SI_HOSTNAME, host, len) == -1 ? -1 : 0);
22 }