Update syscall lists for Linux 5.13
[glibc.git] / inet / tst-ntoa.c
blobef82d4d53753bcc621d57bc4a304650ba517fbe2
1 #include <stdio.h>
2 #include <string.h>
3 #include <arpa/inet.h>
4 #include <netinet/in.h>
7 static int
8 test (unsigned int inaddr, const char *expected)
10 struct in_addr addr;
11 char *res;
12 int fail;
14 addr.s_addr = htonl (inaddr);
15 res = inet_ntoa (addr);
16 fail = strcmp (res, expected);
18 printf ("%#010x -> \"%s\" -> %s%s\n", inaddr, res,
19 fail ? "fail, expected" : "ok", fail ? expected : "");
21 return fail;
25 static int
26 do_test (void)
28 int result = 0;
30 result |= test (INADDR_LOOPBACK, "127.0.0.1");
31 result |= test (INADDR_BROADCAST, "255.255.255.255");
32 result |= test (INADDR_ANY, "0.0.0.0");
33 result |= test (0xc0060746, "192.6.7.70");
35 return result;
38 #define TEST_FUNCTION do_test ()
39 #include "../test-skeleton.c"