xref: /minix3/external/bsd/nvi/dist/clib/gethostname.c (revision 84d9c625bfea59e274550651111ae9edfdc40fbd)
1*84d9c625SLionel Sambuc #include "config.h"
2*84d9c625SLionel Sambuc 
3*84d9c625SLionel Sambuc /*
4*84d9c625SLionel Sambuc  * Solaris doesn't include the gethostname call by default.
5*84d9c625SLionel Sambuc  */
6*84d9c625SLionel Sambuc #include <sys/utsname.h>
7*84d9c625SLionel Sambuc #include <sys/systeminfo.h>
8*84d9c625SLionel Sambuc 
9*84d9c625SLionel Sambuc #include <netdb.h>
10*84d9c625SLionel Sambuc 
11*84d9c625SLionel Sambuc /*
12*84d9c625SLionel Sambuc  * PUBLIC: #ifndef HAVE_GETHOSTNAME
13*84d9c625SLionel Sambuc  * PUBLIC: int gethostname __P((char *, int));
14*84d9c625SLionel Sambuc  * PUBLIC: #endif
15*84d9c625SLionel Sambuc  */
16*84d9c625SLionel Sambuc int
gethostname(host,len)17*84d9c625SLionel Sambuc gethostname(host, len)
18*84d9c625SLionel Sambuc 	char *host;
19*84d9c625SLionel Sambuc 	int len;
20*84d9c625SLionel Sambuc {
21*84d9c625SLionel Sambuc 	return (sysinfo(SI_HOSTNAME, host, len) == -1 ? -1 : 0);
22*84d9c625SLionel Sambuc }
23