File: gethostname.c

package info (click to toggle)
vigor 0.016-34
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,288 kB
  • sloc: ansic: 44,609; tcl: 1,544; sh: 1,453; makefile: 754; perl: 269; awk: 24; csh: 13
file content (22 lines) | stat: -rw-r--r-- 382 bytes parent folder | download | duplicates (29)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "config.h"

/*
 * Solaris doesn't include the gethostname call by default.
 */
#include <sys/utsname.h>
#include <sys/systeminfo.h>

#include <netdb.h>

/*
 * PUBLIC: #ifndef HAVE_GETHOSTNAME
 * PUBLIC: int gethostname __P((char *, int));
 * PUBLIC: #endif
 */
int
gethostname(host, len)
	char *host;
	int len;
{
	return (sysinfo(SI_HOSTNAME, host, len) == -1 ? -1 : 0);
}