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
23
int main(int argc, char *argv[])
29
unsigned char c, buf[4];
33
printf("Usage: %s ENCODING\n", argv[0]);
34
printf("Output a charset map for the 8-bit ENCODING.\n");
38
cd = iconv_open("UCS-4", argv[1]);
39
if (cd == (iconv_t)(-1)) {
44
for (i = 0; i < 256; i++) {
50
k = iconv(cd, &ib, &ibl, &ob, &obl);
51
if (!k && !ibl && !obl) {
52
wc = (buf[0] << 24) + (buf[1] << 16) + (buf[2] << 8) + buf[3];
54
printf("Dodgy value.\n");
58
else if (k == (size_t)(-1) && errno == EILSEQ)
61
printf("Non-standard iconv.\n");