Don't use 'return' where you should use 'PG_RETURN_xxx'.
[PostgreSQL.git] / src / backend / utils / mb / iso.c
blob7c925589ceef650edbb6bc404f8ef80c341e6cc7
1 /*
2 * make KOI8->ISO8859-5 and ISO8859-5->KOI8 translation table
3 * from koi-iso.tab.
5 * Tatsuo Ishii
7 * $PostgreSQL$
8 */
10 #include <stdio.h>
13 main()
15 int i;
16 char koitab[128],
17 isotab[128];
18 char buf[4096];
19 int koi,
20 iso;
22 for (i = 0; i < 128; i++)
23 koitab[i] = isotab[i] = 0;
25 while (fgets(buf, sizeof(buf), stdin) != NULL)
27 if (*buf == '#')
28 continue;
29 sscanf(buf, "%d %x", &koi, &iso);
30 if (koi < 128 || koi > 255 || iso < 128 || iso > 255)
32 fprintf(stderr, "invalid value %d\n", koi);
33 exit(1);
35 koitab[koi - 128] = iso;
36 isotab[iso - 128] = koi;
39 i = 0;
40 printf("static char koi2iso[] = {\n");
41 while (i < 128)
43 int j = 0;
45 while (j < 8)
47 printf("0x%02x", koitab[i++]);
48 j++;
49 if (i >= 128)
50 break;
51 printf(", ");
53 printf("\n");
55 printf("};\n");
57 i = 0;
58 printf("static char iso2koi[] = {\n");
59 while (i < 128)
61 int j = 0;
63 while (j < 8)
65 printf("0x%02x", isotab[i++]);
66 j++;
67 if (i >= 128)
68 break;
69 printf(", ");
71 printf("\n");
73 printf("};\n");