]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - contrib/nvi/clib/gethostname.c
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.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 }