On Linux HAVE_INET_NTOP is defined, i assume on OpenBSD not and
the part with the union is not working

char *
ns_inet_ntoa(struct in_addr addr)
{
    Tls *tlsPtr = GetTls();
#if defined(HAVE_INET_NTOP)
    inet_ntop(AF_INET, &addr, tlsPtr->nabuf, sizeof(tlsPtr->nabuf));
#else
    union {
        unsigned long l;
        unsigned char b[4];
    } u;

    u.l = (unsigned long) addr.s_addr;
    sprintf(tlsPtr->nabuf, "%u.%u.%u.%u", u.b[0], u.b[1], u.b[2], u.b[3]);
#endif
    return tlsPtr->nabuf;
}


Michael A. Cleverly wrote:
On 2/6/07, Vlad Seryakov <[EMAIL PROTECTED]> wrote:
Try to compile this and see if you get 127.0.0.1 printed

#include <ns.h>

main()
{
    struct in_addr addr;
    addr.s_addr = inet_addr("127.0.0.1");
    printf("%s\n", ns_inet_ntoa(addr));
}

gcc -I /usr/local/ns/include -o a a.c /usr/local/ns/lib/libnsthread.so

[EMAIL PROTECTED]:~$ ./a
0.0.0.0

:-/

Michael

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


--
Vlad Seryakov
571 262-8608 office
[EMAIL PROTECTED]
http://www.crystalballinc.com/vlad/


Reply via email to