Last change
on this file was 2036, checked in by bird, 20 years ago |
Initial revision
|
-
Property cvs2svn:cvs-rev
set to
1.1
-
Property svn:eol-style
set to
native
-
Property svn:executable
set to
*
-
Property svn:keywords
set to
Author Date Id Revision
|
File size:
1.2 KB
|
Line | |
---|
1 | #include <mcheck.h>
|
---|
2 | #include <nl_types.h>
|
---|
3 | #include <stdio.h>
|
---|
4 | #include <string.h>
|
---|
5 |
|
---|
6 |
|
---|
7 | static const char *msgs[] =
|
---|
8 | {
|
---|
9 | #define INPUT(str)
|
---|
10 | #define OUTPUT(str) str,
|
---|
11 | #include <intl/msgs.h>
|
---|
12 | };
|
---|
13 | #define nmsgs (sizeof (msgs) / sizeof (msgs[0]))
|
---|
14 |
|
---|
15 | #define ROUNDS 5
|
---|
16 |
|
---|
17 | int
|
---|
18 | main (void)
|
---|
19 | {
|
---|
20 | int rnd;
|
---|
21 | int result = 0;
|
---|
22 |
|
---|
23 | mtrace ();
|
---|
24 |
|
---|
25 | /* We do this a few times to stress the memory handling. */
|
---|
26 | for (rnd = 0; rnd < ROUNDS; ++rnd)
|
---|
27 | {
|
---|
28 | nl_catd cd = catopen ("libc", 0);
|
---|
29 | size_t cnt;
|
---|
30 |
|
---|
31 | if (cd == (nl_catd) -1)
|
---|
32 | {
|
---|
33 | printf ("cannot load catalog: %m\n");
|
---|
34 | result = 1;
|
---|
35 | break;
|
---|
36 | }
|
---|
37 |
|
---|
38 | /* Go through all the messages and compare the result. */
|
---|
39 | for (cnt = 0; cnt < nmsgs; ++cnt)
|
---|
40 | {
|
---|
41 | char *trans;
|
---|
42 |
|
---|
43 | trans = catgets (cd, 1, 1 + cnt,
|
---|
44 | "+#+# if this comes backs it's an error");
|
---|
45 |
|
---|
46 | if (trans == NULL)
|
---|
47 | {
|
---|
48 | printf ("catgets return NULL for %zd\n", cnt);
|
---|
49 | result = 1;
|
---|
50 | }
|
---|
51 | else if (strcmp (trans, msgs[cnt]) != 0 && msgs[cnt][0] != '\0')
|
---|
52 | {
|
---|
53 | printf ("expected \"%s\", got \"%s\"\n", msgs[cnt], trans);
|
---|
54 | result = 1;
|
---|
55 | }
|
---|
56 | }
|
---|
57 |
|
---|
58 | if (catclose (cd) != 0)
|
---|
59 | {
|
---|
60 | printf ("catclose failed: %m\n");
|
---|
61 | result = 1;
|
---|
62 | }
|
---|
63 | }
|
---|
64 |
|
---|
65 | return result;
|
---|
66 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.