xref: /netbsd-src/external/bsd/nvi/dist/clib/gethostname.c (revision dbd550ed1a6686d6600f748306f9cc03d8cd4c94)
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
gethostname(host,len)17 gethostname(host, len)
18 	char *host;
19 	int len;
20 {
21 	return (sysinfo(SI_HOSTNAME, host, len) == -1 ? -1 : 0);
22 }
23