File indexing completed on 2024-04-28 15:40:33
0001 /* 0002 * SPDX-License-Identifier: BSD-3-Clause 0003 */ 0004 0005 #ifdef HAVE_ICONV_H 0006 #include <iconv.h> 0007 #endif 0008 #ifdef HAVE_SYS_ICONV_H 0009 #include <sys/iconv.h> 0010 #endif 0011 #include <stdlib.h> 0012 0013 int check(const char *from, const char *to) 0014 { 0015 iconv_t myConverter = iconv_open(to, from); 0016 0017 if (myConverter != (iconv_t) - 1) { 0018 iconv_close(myConverter); 0019 return 0; 0020 } else { 0021 return 1; 0022 } 0023 } 0024 0025 int main(int argc, char **argv) 0026 { 0027 const char *from[] = { "CP874", "CP932", "CP936", "CP949", 0028 "CP950", "CP1250", "CP1251", "CP1252", 0029 "CP1253", "CP1254", "CP1255", "CP1256", 0030 "CP1257", "koi8-r", 0 0031 }; 0032 const char *to[] = { "UNICODELITTLE", "UNICODEBIG", 0 }; 0033 int fromIndex = 0; 0034 int toIndex = 0; 0035 0036 while (to[ toIndex ] != 0) { 0037 while (from[ fromIndex ] != 0) { 0038 if (check(from[ fromIndex ], to[ toIndex ]) != 0) { 0039 exit(1); 0040 } 0041 fromIndex = fromIndex + 1; 0042 } 0043 toIndex = toIndex + 1; 0044 fromIndex = 0; 0045 } 0046 exit(0); 0047 }