curl-library
Re: NI_WITHSCOPEID (was Re: Debugging test cases) (fwd)
From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Mon, 29 Mar 2004 08:49:26 +0200 (CEST)
Date: Mon, 29 Mar 2004 08:49:26 +0200 (CEST)
Ok, I updated the test to compile better!
#include <sys/socket.h>
#include <netdb.h>
int main()
{
#ifdef NI_WITHSCOPEID
struct sockaddr ss;
int sslen;
int rc;
char hbuf[NI_MAXHOST];
int fd = socket(AF_INET, SOCK_STREAM, 0);
if(fd < 0)
return 4;
rc = getsockname(fd, (struct sockaddr *)&ss, &sslen);
if(rc)
return 1;
rc = getnameinfo((struct sockaddr *)&ss, sslen, hbuf, sizeof(hbuf),
NULL, 0,
NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID);
if(rc)
return 2;
return 0; /* all is fine, use NI_WITHSCOPEID */
#else
return 3; /* don't use NI_WITHSCOPEID, we don't have it! */
#endif
}
-- Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se Dedicated custom curl help for hire: http://haxx.se/curl.htmlReceived on 2004-03-29