cURL / Mailing Lists / curl-library / Single Mail

curl-library

Solaris 5.9 (intel)

From: Tor Arntsen <tor_at_spacetec.no>
Date: Tue, 9 Mar 2004 11:50:40 +0100

/* This mail can be compiled :-)

Joe,

The errors in your solaris 5.9 (intel) autobuilds seem to all be related
to ftp port w/ipv6, possibly this could be something similar to the aix
problem that we already solved. At least it could be an idea to check
out if getaddrinfo() works. Here's (slightly too big but it does the
job) test program.

cc -o getaddrinfo getaddrinfo.c
./getaddrinfo 127.0.0.1

and check what it prints out. On AIX ai_socktype is always 0 (which
is wrong).

-Tor

*/

#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>

int
main (int argc, char * argv[])
{
    struct addrinfo hints;
    struct addrinfo *res;
    int ret;

    if (argc != 2)
    {
        fprintf (stderr, "Usage: %s name\n", argv[0]);
        return (1);
    }

    memset (&hints, '\0', sizeof (hints));
    hints.ai_family |= AI_PASSIVE;
    hints.ai_family |= AI_CANONNAME;
    hints.ai_family = PF_UNSPEC;
    hints.ai_socktype = SOCK_STREAM;

    if ((ret = getaddrinfo (argv[1], NULL, NULL, &res)) != 0)
    {
        fprintf (stderr, "getaddrinfo failed for %s with %d: %s\n",
                 argv[1], ret, strerror (errno));
        return (1);
    }

    printf ("ok\n");
    do
    {
        printf ("res->ai_flags = %d\n", res->ai_flags);
        printf ("res->ai_family = %d\n", res->ai_family);
        printf ("res->ai_socktype = %d\n", res->ai_socktype);
        printf ("res->ai_addrlen = %d\n", (int) res->ai_addrlen);
        printf ("res->ai_canonname = %s\n",
                (res->ai_canonname? res->ai_canonname:"(NULL)"));
        printf ("res->ai_addr = 0x%0x\n", (unsigned int) res->ai_addr);
        printf ("res->ai_next = 0x%0x\n", (unsigned int) res->ai_next);
        printf ("---\n");
    } while ((res = res->ai_next));
    return (0);
}
    
Received on 2004-03-09