2 * Copyright (C) 2001 Edmund Grimley Evans <edmundo@rano.org>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 int main(int argc, char *argv[])
33 unsigned char c, buf[4];
37 printf("Usage: %s ENCODING\n", argv[0]);
38 printf("Output a charset map for the 8-bit ENCODING.\n");
42 cd = iconv_open("UCS-4", argv[1]);
43 if (cd == (iconv_t)(-1)) {
48 for (i = 0; i < 256; i++) {
54 k = iconv(cd, &ib, &ibl, &ob, &obl);
55 if (!k && !ibl && !obl) {
56 wc = (buf[0] << 24) + (buf[1] << 16) + (buf[2] << 8) + buf[3];
58 printf("Dodgy value.\n");
62 else if (k == (size_t)(-1) && errno == EILSEQ)
65 printf("Non-standard iconv.\n");