elf: Handle non-directory name in search path (BZ 31035)
[glibc.git] / iconv / tst-iconv3.c
blob3eb74eb69fc3c4019d70639a0446b0f964889ac7
2 #include <iconv.h>
3 #include <errno.h>
4 #include <stddef.h>
5 #include <stdio.h>
7 #define BUFSIZE 10000
9 static int
10 do_test (void)
12 char inbuf[BUFSIZE];
13 wchar_t outbuf[BUFSIZE];
15 iconv_t cd;
16 int i;
17 char *inptr;
18 char *outptr;
19 size_t inbytes_left, outbytes_left;
20 int count;
21 int result = 0;
23 for (i=0; i < BUFSIZE; i++)
24 inbuf[i] = 'a';
26 cd = iconv_open ("UCS-4LE", "UTF-8");
28 inbytes_left = BUFSIZE;
29 outbytes_left = BUFSIZE * 4;
30 inptr = inbuf;
31 outptr = (char *) outbuf;
33 count = iconv (cd, &inptr, &inbytes_left, &outptr, &outbytes_left);
35 if (count < 0)
37 if (errno == E2BIG)
38 printf ("Received E2BIG\n");
39 else
40 printf ("Received something else\n");
42 printf ("inptr change: %td\n", inptr - inbuf);
43 printf ("inlen change: %zd\n", BUFSIZE - inbytes_left);
44 printf ("outptr change: %td\n", outptr - (char *) outbuf);
45 printf ("outlen change: %zd\n", BUFSIZE * 4 - outbytes_left);
46 result = 1;
48 else
49 printf ("Succeeded\n");
51 iconv_close (cd);
53 return result;
56 #define TEST_FUNCTION do_test ()
57 #include "../test-skeleton.c"