gethostname(2) DG/UX 5.4.2 gethostname(2)
NAME
gethostname - get name of current host
SYNOPSIS
int gethostname (name, namelen)
char * name;
int namelen;
where:
name Buffer to receive hostname
namelen Buffer length in bytes
DESCRIPTION
Gethostname returns the standard hostname for the host system, as
previously set by sethostname. The parameter namelen specifies the
size of the name string. The returned name is null-terminated unless
insufficient space is provided. Insufficient space will truncate the
name.
Hostnames are limited to MAXHOSTNAMELEN characters, which is defined
in <sys/param.h>.
Calling gethostname before calling sethostname returns a zero-length
hostname.
ACCESS CONTROL
None.
RETURN VALUE
0 Completed successfully.
-1 An error occurred. errno is set to indicate the error.
DIAGNOSTICS
Errno may be set to the following error code:
EFAULT The name parameter gave an invalid address, or the namelen
parameter specified a length less than zero.
SEE ALSO
getdomainname(2), gethostid(2), sethostname(2).
Licensed material--property of copyright holder(s) 1