[uClibc] inet_aton

Erik Andersen andersen at codepoet.org
Mon Aug 4 19:03:57 UTC 2003


On Mon Aug 04, 2003 at 05:40:39PM +0200, Clement MOREAU wrote:
> Hi, 
> 
> I am using uclibc 0.9.19, and i wonder why inet_aton has a different
> behaviour from the glibc version : 
> 
> int inet_aton(cp, inp) 
> 
> if inp is NULL, the uClibc version returns at the immediately with
> status 0, whereas the glibc version check if cp is a valid address, and
> returns status code non zero if it is a valid address.

uClibc uses different code than glibc in many places, which
sometimes results in different behavior.

This function, sadly, is not defined byt the Single UNIX spec,
which is what we follow..  However, this function is documented
by W. Richard Stevens in his book UNIX Network Programming,
Volume 1, second edition.  On page 71 it says:

    int inet_aton(const char *strptr, struct in_addr *addrptr) ;

    ...

    converts the C character string pointed to by strptr into its
    32-bit binary network byte ordered value, which is stored
    through the pointer addrptr.  If sucessful, 1 is returned;
    otherwise 0 is returned.

    An undocumented feature of inet_aton is that if addrptr is
    a null pointer, the function still performs it validation
    of the input string, but does not store the result.

I have just updated inet_aton() to support this undocumented
feature,

 -Erik

--
Erik B. Andersen             http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--



More information about the uClibc mailing list