[AArch64] Use generic "mcount" routine for profiling.
[glibc.git] / localedata / show-ucs-data.c
blob85d26597416c72009c33077d7278ca479ba7df81
1 #include <ctype.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <sys/types.h>
6 int
7 main (int argc, char *argv[])
9 int n;
10 char *line = NULL;
11 size_t len = 0;
13 if (argc == 1)
15 static char *new_argv[] = { NULL, (char *) "/dev/stdin", NULL };
16 argv = new_argv;
17 argc = 2;
20 for (n = 1; n < argc; ++n)
22 FILE *fp = fopen (argv[n], "r");
23 if (fp == NULL)
24 continue;
26 while (! feof (fp))
28 ssize_t cnt = getline (&line, &len, fp);
29 char *runp;
30 if (cnt <= 0)
31 break;
33 runp = line;
36 if (runp[0] == '<' && runp[1] == 'U' && isxdigit (runp[2])
37 && isxdigit (runp[3]) && isxdigit (runp[4])
38 && isxdigit (runp[5]) && runp[6] == '>')
40 unsigned int val = strtoul (runp + 2, NULL, 16);
42 //putchar ('<');
43 if (val < 128)
44 putchar (val);
45 else if (val < 0x800)
47 putchar (0xc0 | (val >> 6));
48 putchar (0x80 | (val & 0x3f));
50 else
52 putchar (0xe0 | (val >> 12));
53 putchar (0x80 | ((val >> 6) & 0x3f));
54 putchar (0x80 | (val & 0x3f));
56 //putchar ('>');
57 runp += 7;
59 else
60 putchar (*runp++);
62 while (runp < &line[cnt]);
65 fclose (fp);
68 return 0;