2 #include <sys/socket.h>
3 #include <netinet/in.h>
7 static void test(const char *);
22 test(const char *input) {
24 u_char temp[sizeof (struct in_addr)];
25 char output[sizeof "255.255.255.255/32"];
27 memset(temp, 0x5e, sizeof temp);
28 if (inet_cidr_pton(AF_INET, input, temp, &bits) < 0) {
32 if (inet_cidr_ntop(AF_INET, temp, bits, output, sizeof output)==NULL){
33 perror("inet_cidr_ntop");
36 printf("input '%s', temp '%x %x %x %x', bits %d, output '%s'\n",
37 input, temp[0], temp[1], temp[2], temp[3], bits, output);