gethostbyname
Package: WA2L/edrc 1.5.57
Section: General Commands (1)
Updated: 29 July 2003
Index
Return to Main Contents
NAME
gethostbyname - host lookup using gethostbyname() system call
SYNOPSIS
edrc/bin/gethostbyname
AVAILABILITY
WA2L/edrc
DESCRIPTION
gethostbyname
is an interactive command using only the
gethostbyname system call to resolve the hostname(s) and IP address(s).
This ensures that the settings in the
/etc/nsswitch.conf
file are processed as the system does it.
gethostbyname
does not super-set the system settings in any kind like other resolving
tools sometimes do.
To exit
gethostbyname
type
exit
at the
gethostbyname
command prompt.
The source code of
gethostbyname
is available in
edrc/src/gethostbyname.c.
OPTIONS
-
OUTPUT INTERPRETATION
The output fields correspond to the
hostent
structure
as defined in
netdb.h.
- h_error
-
If the name server is not being used, the value of h_errno may not be
meaningful.
-
- 1: HOST_NOT_FOUND
-
Authoritative answer host not found.
This value is returned on successful queries (what is a bit weird, of course).
- 2: TRY_AGAIN
-
Non-Authoritative Host not found, or SERVERFAIL.
This is usually a temporary error. The local server did not receive a response
from an authoritative server. A retry at some later time may succeed.
Or the queried host simply does not exist.
- 3: NO_RECOVERY
-
Non recoverable errors, FORMERR, REFUSED, NOTIMP.
This is a non-recoverable error.
- 4: NO_DATA
-
Valid name, no data record of requested type.
- 4: NO_ADDRESS
-
no address, look for MX record. The requested name is valid but does not
have an IP address; this is not a temporary error. This means another type
of request to the name server will result in an answer.
- h_name
-
The official name of the host.
- h_aliases
-
An array of alternate names for the host.
- h_addrtype
-
The type of address being returned; always
AF_INET.
- h_length
-
The length, in bytes, of the address.
- h_addr_list
-
An array of network addresses for the host
EXIT STATUS
- 0
-
always
SEE ALSO
edrcintro(1),
gethostbyname(3N),
gethostent(3N),
nsswitch.conf(4),
resolve.conf(4),
resolver(4)
BUGS
IPv6 is not supported yet.
AUTHOR
gethostbyname was developed by Christian Walther. Send suggestions
and bug reports to wa2l@users.sourceforge.net .
COPYRIGHT
Copyright © 2008
Christian Walther
This is free software; see
edrc/doc/COPYING
for copying conditions. There is ABSOLUTELY NO WARRANTY; not
even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
This document was created by man2html
using the manual pages.
Time: 16:17:40 GMT, April 17, 2025