atoa(3abz)

atoa3abz

Convert a string to an address

Usage

#include <abz/atop.h>

int atoa(in_addr_t *addr, const char *str);

Libraries

Abz Library (-labz), Debug Library (-ldebug)

Overview

The atoa() function converts a string to an address. The string may either be a hostname or an ip address.

The address is stored in network byte order.

Return value

The atoa() function returns 0 if successful or -1 if some error occurred. Check errno to see what error occurred.

Notes

None of the libabz routines are thread-safe. I'm not planning to change this either! For more information, please see http://threading.2038bug.com/

If the library was compiled without the GETHOSTBYNAME flag, only ip addresses may be specified.

At the time of writing, the glibc library gethostbyname() function had a bug which caused it to resolve some invalid hostnames. In order to detect those cases, the atoa() function also does a reverse lookup using gethostbyaddr() to see if the domain really exist.

Author

Written by Abraham vd Merwe <[email protected]>

From libabz0-dev 0.5.1 in Debian 3.1 (Sarge). Parsed by carta from the page's man source.