summaryrefslogtreecommitdiff
path: root/localedata/tst-wctype.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-07-25 00:38:27 +0000
committerUlrich Drepper <drepper@redhat.com>2000-07-25 00:38:27 +0000
commita64e8af15015e277914970bde5062735b9506cad (patch)
tree6a6725e278180ad9c377b25a0d3e171516ff92b4 /localedata/tst-wctype.c
parent33101abcb858b81ca3f70709b4e7e3679add93de (diff)
Update.
2000-07-24 Ulrich Drepper <drepper@redhat.com> * libio/iogetwline.c (_IO_getwline_info): Use wide character string functions.
Diffstat (limited to 'localedata/tst-wctype.c')
-rw-r--r--localedata/tst-wctype.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/localedata/tst-wctype.c b/localedata/tst-wctype.c
new file mode 100644
index 0000000000..6c59a50427
--- /dev/null
+++ b/localedata/tst-wctype.c
@@ -0,0 +1,40 @@
+#include <error.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <wchar.h>
+#include <wctype.h>
+
+int
+main (void)
+{
+ wctype_t wct;
+ wchar_t buf[1000];
+ int result = 1;
+
+ setlocale (LC_ALL, "");
+ wprintf (L"locale = %s\n", setlocale (LC_CTYPE, NULL));
+
+ wct = wctype ("jhira");
+ if (wct == 0)
+ error (EXIT_FAILURE, 0, "jhira: no such character class");
+
+ if (fgetws (buf, sizeof (buf) / sizeof (buf[0]), stdin) != NULL)
+ {
+ int n;
+
+ wprintf (L"buf[] = \"%ls\"\n", buf);
+
+ result = 0;
+
+ for (n = 0; buf[n] != L'\0'; ++n)
+ {
+ wprintf (L"jhira(U%04lx = %lc) = %d\n", (long) buf[n], buf[n],
+ iswctype (buf[n], wct));
+ result |= ((buf[n] < 0xff && iswctype (buf[n], wct))
+ || (buf[n] > 0xff && !iswctype (buf[n], wct)));
+ }
+ }
+
+ return result;
+}