diff options
author | Ulrich Drepper <drepper@redhat.com> | 2000-06-26 00:38:37 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2000-06-26 00:38:37 +0000 |
commit | 7475d01602e881e206a29ee30bc8c3e85c235379 (patch) | |
tree | 841acac97699c058c94e84216f702f091f360cd0 /localedata/show-ucs-data.c | |
parent | 8b682b9907ad1d60bdd45431e0e3bbdf358837ec (diff) | |
download | glibc-7475d01602e881e206a29ee30bc8c3e85c235379.tar.gz glibc-7475d01602e881e206a29ee30bc8c3e85c235379.tar.xz glibc-7475d01602e881e206a29ee30bc8c3e85c235379.zip |
Update.
2000-06-25 Greg McGary <greg@mcgary.org> * sysdeps/i386/i586/memcpy.S: Redefine memcpy as mempcpy, not as bcopy.
Diffstat (limited to 'localedata/show-ucs-data.c')
-rw-r--r-- | localedata/show-ucs-data.c | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/localedata/show-ucs-data.c b/localedata/show-ucs-data.c new file mode 100644 index 0000000000..84f20fc444 --- /dev/null +++ b/localedata/show-ucs-data.c @@ -0,0 +1,62 @@ +#include <ctype.h> +#include <stdio.h> +#include <stdlib.h> +#include <sys/types.h> + +int +main (int argc, char *argv[]) +{ + int n; + char *line = NULL; + size_t len = 0; + + for (n = 1; n < argc; ++n) + { + FILE *fp = fopen (argv[n], "r"); + if (fp == NULL) + continue; + + while (! feof (fp)) + { + ssize_t cnt = getline (&line, &len, fp); + char *runp; + if (cnt <= 0) + break; + + runp = line; + do + { + if (runp[0] == '<' && runp[1] == 'U' && isxdigit (runp[2]) + && isxdigit (runp[3]) && isxdigit (runp[4]) + && isxdigit (runp[5]) && runp[6] == '>') + { + unsigned int val = strtoul (runp + 2, NULL, 16); + + putchar ('<'); + if (val < 128) + putchar (val); + else if (val < 0x800) + { + putchar (0xc0 | (val >> 6)); + putchar (0x80 | (val & 0x3f)); + } + else + { + putchar (0xe0 | (val >> 12)); + putchar (0x80 | ((val >> 6) & 0x3f)); + putchar (0x80 | (val & 0x3f)); + } + putchar ('>'); + runp += 7; + } + else + putchar (*runp++); + } + while (runp < &line[cnt]); + } + + fclose (fp); + } + + return 0; +} |