hostalias(3) — Subroutines
NAME
hostalias − Searches for host aliases
SYNOPSIS
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h> char ∗hostalias(
char ∗name); int hostalias_r(
char ∗name,
char ∗buf,
int len);
PARAMETERS
namePoints to the name of the host to retrieve aliases for.
bufSpecifies the buffer for the host alias.
lenSpecifies the length of buf.
DESCRIPTION
The hostalias() function searches for the alias associated with the name. The HOSTALIASES environment variable defines the name of a file in which aliases are kept, in the form:
hostalias
The hostalias_r() function is the reentrant version of the hostalias() function. The difference is that the found name(s) are put in the buffer pointed at by buf. This buffer should be at least MAXDNAME characters.
RETURN VALUES
Upon successful completion, the hostalias() function returns the host alias. Otherwise, a null pointer is returned.
Upon successful completion, the hostalias_r() function returns a value of 0 (zero). Otherwise, a value of -1 is returned, and errno may be set.
ERRORS
If the following condition occurs, the hostalias_r() function sets errno to the corresponding value.
[ESRCH]Host alias could not be found.
[EINVAL]The buf parameter is invalid or too small.
RELATED INFORMATION
Functions: res_mkquery(3), getenv(3).