On 2004-08-12 02:06, Nicolas B?rard Nault <[EMAIL PROTECTED]> wrote: > > I wondered, why does inet_ntop() returns addresses in the format > x:x:x:x:x:x:x.x.x.x ? This can be very annoying if that's not what you > want. Is there another standard function, other than inet_ntop(), to do > the same work ?
Can you show us a minimal program that exhibits this behavior? The function seems to work as expected here. The only case where the format you describe is used is with AF_INET6 addresses, which is not a bug AFAIK. For instance, the following program: #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <err.h> #include <stdio.h> #include <stdlib.h> #define BUFLEN 100 int main(void) { struct in_addr ia; char buf[BUFLEN]; ia.s_addr = htonl(0x7f000001); if (inet_ntop(AF_INET, &ia, buf, BUFLEN - 1) == NULL) err(1, "inet_ntop"); printf("inet: %s\n", buf); return EXIT_SUCCESS; } Prints the following output (note that the inet6 address output is probably an invalid address but still gets printed in the usual format): $ ./foo inet: 127.0.0.1 $ Are you sure you're calling inet_ntop() as you should? - Giorgos _______________________________________________ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"