diff -uNr --exclude=CVS --exclude=obj src.orig/distrib/sets/lists/base/md.alpha src/distrib/sets/lists/base/md.alpha --- src.orig/distrib/sets/lists/base/md.alpha Fri Jun 19 05:37:42 2009 +++ src/distrib/sets/lists/base/md.alpha Thu Jun 18 13:03:20 2009 @@ -87,6 +87,29 @@ ./usr/lib/gcc-lib/alpha-unknown-openbsd4.6/3.3.5/collect2 ./usr/lib/gcc-lib/alpha-unknown-openbsd4.6/3.3.5/include ./usr/lib/gcc-lib/alpha-unknown-openbsd4.6/3.3.5/specs +./usr/lib/i18n/libBIG5.so.4.4 +./usr/lib/i18n/libDECHanyu.so.4.4 +./usr/lib/i18n/libEUC.so.4.4 +./usr/lib/i18n/libEUCTW.so.4.4 +./usr/lib/i18n/libGBK2K.so.4.4 +./usr/lib/i18n/libHZ.so.4.4 +./usr/lib/i18n/libISO2022.so.4.4 +./usr/lib/i18n/libJOHAB.so.4.4 +./usr/lib/i18n/libMSKanji.so.4.4 +./usr/lib/i18n/libUES.so.4.4 +./usr/lib/i18n/libUTF1632.so.4.4 +./usr/lib/i18n/libUTF7.so.4.4 +./usr/lib/i18n/libUTF8.so.4.4 +./usr/lib/i18n/libVIQR.so.4.4 +./usr/lib/i18n/libZW.so.4.4 +./usr/lib/i18n/libiconv_none.so.4.4 +./usr/lib/i18n/libiconv_std.so.4.4 +./usr/lib/i18n/libmapper_646.so.4.4 +./usr/lib/i18n/libmapper_none.so.4.4 +./usr/lib/i18n/libmapper_parallel.so.4.4 +./usr/lib/i18n/libmapper_serial.so.4.4 +./usr/lib/i18n/libmapper_std.so.4.4 +./usr/lib/i18n/libmapper_zone.so.4.4 ./usr/lib/libasn1.so.17.0 ./usr/lib/libc.so.53.0 ./usr/lib/libcom_err.so.17.0 @@ -100,6 +123,7 @@ ./usr/lib/libg2c.so.8.1 ./usr/lib/libgssapi.so.5.0 ./usr/lib/libiberty.so.10.0 +./usr/lib/libintl.so.0.0 ./usr/lib/libkafs.so.17.0 ./usr/lib/libkrb5.so.17.0 ./usr/lib/libkvm.so.9.1 @@ -1802,6 +1826,7 @@ ./usr/libdata/perl5/site_perl/alpha-openbsd/glob.ph ./usr/libdata/perl5/site_perl/alpha-openbsd/grp.ph ./usr/libdata/perl5/site_perl/alpha-openbsd/histedit.ph +./usr/libdata/perl5/site_perl/alpha-openbsd/iconv.ph ./usr/libdata/perl5/site_perl/alpha-openbsd/ieeefp.ph ./usr/libdata/perl5/site_perl/alpha-openbsd/ifaddrs.ph ./usr/libdata/perl5/site_perl/alpha-openbsd/inttypes.ph @@ -1849,6 +1874,7 @@ ./usr/libdata/perl5/site_perl/alpha-openbsd/kvm.ph ./usr/libdata/perl5/site_perl/alpha-openbsd/langinfo.ph ./usr/libdata/perl5/site_perl/alpha-openbsd/libgen.ph +./usr/libdata/perl5/site_perl/alpha-openbsd/libintl.ph ./usr/libdata/perl5/site_perl/alpha-openbsd/libmilter ./usr/libdata/perl5/site_perl/alpha-openbsd/libmilter/mfapi.ph ./usr/libdata/perl5/site_perl/alpha-openbsd/libmilter/mfdef.ph diff -uNr --exclude=CVS --exclude=obj src.orig/distrib/sets/lists/base/md.amd64 src/distrib/sets/lists/base/md.amd64 --- src.orig/distrib/sets/lists/base/md.amd64 Fri Jun 19 05:37:43 2009 +++ src/distrib/sets/lists/base/md.amd64 Thu Jun 18 13:03:20 2009 @@ -89,6 +89,29 @@ ./usr/lib/gcc-lib/amd64-unknown-openbsd4.6/3.3.5/cc1 ./usr/lib/gcc-lib/amd64-unknown-openbsd4.6/3.3.5/collect2 ./usr/lib/gcc-lib/amd64-unknown-openbsd4.6/3.3.5/specs +./usr/lib/i18n/libBIG5.so.4.4 +./usr/lib/i18n/libDECHanyu.so.4.4 +./usr/lib/i18n/libEUC.so.4.4 +./usr/lib/i18n/libEUCTW.so.4.4 +./usr/lib/i18n/libGBK2K.so.4.4 +./usr/lib/i18n/libHZ.so.4.4 +./usr/lib/i18n/libISO2022.so.4.4 +./usr/lib/i18n/libJOHAB.so.4.4 +./usr/lib/i18n/libMSKanji.so.4.4 +./usr/lib/i18n/libUES.so.4.4 +./usr/lib/i18n/libUTF1632.so.4.4 +./usr/lib/i18n/libUTF7.so.4.4 +./usr/lib/i18n/libUTF8.so.4.4 +./usr/lib/i18n/libVIQR.so.4.4 +./usr/lib/i18n/libZW.so.4.4 +./usr/lib/i18n/libiconv_none.so.4.4 +./usr/lib/i18n/libiconv_std.so.4.4 +./usr/lib/i18n/libmapper_646.so.4.4 +./usr/lib/i18n/libmapper_none.so.4.4 +./usr/lib/i18n/libmapper_parallel.so.4.4 +./usr/lib/i18n/libmapper_serial.so.4.4 +./usr/lib/i18n/libmapper_std.so.4.4 +./usr/lib/i18n/libmapper_zone.so.4.4 ./usr/lib/libasn1.so.17.0 ./usr/lib/libc.so.53.0 ./usr/lib/libcom_err.so.17.0 @@ -102,6 +125,7 @@ ./usr/lib/libg2c.so.8.1 ./usr/lib/libgssapi.so.5.0 ./usr/lib/libiberty.so.10.0 +./usr/lib/libintl.so.0.0 ./usr/lib/libkafs.so.17.0 ./usr/lib/libkrb5.so.17.0 ./usr/lib/libkvm.so.9.1 @@ -745,6 +769,7 @@ ./usr/libdata/perl5/site_perl/amd64-openbsd/amd64/i82489reg.ph ./usr/libdata/perl5/site_perl/amd64-openbsd/amd64/i82489var.ph ./usr/libdata/perl5/site_perl/amd64-openbsd/amd64/i8259.ph +./usr/libdata/perl5/site_perl/amd64-openbsd/amd64/iconv.ph ./usr/libdata/perl5/site_perl/amd64-openbsd/amd64/ieee.ph ./usr/libdata/perl5/site_perl/amd64-openbsd/amd64/ieeefp.ph ./usr/libdata/perl5/site_perl/amd64-openbsd/amd64/internal_types.ph @@ -1873,6 +1898,7 @@ ./usr/libdata/perl5/site_perl/amd64-openbsd/kvm.ph ./usr/libdata/perl5/site_perl/amd64-openbsd/langinfo.ph ./usr/libdata/perl5/site_perl/amd64-openbsd/libgen.ph +./usr/libdata/perl5/site_perl/amd64-openbsd/libintl.ph ./usr/libdata/perl5/site_perl/amd64-openbsd/libmilter ./usr/libdata/perl5/site_perl/amd64-openbsd/libmilter/mfapi.ph ./usr/libdata/perl5/site_perl/amd64-openbsd/libmilter/mfdef.ph diff -uNr --exclude=CVS --exclude=obj src.orig/distrib/sets/lists/base/md.armish src/distrib/sets/lists/base/md.armish --- src.orig/distrib/sets/lists/base/md.armish Fri Jun 19 05:37:45 2009 +++ src/distrib/sets/lists/base/md.armish Thu Jun 18 13:03:20 2009 @@ -62,6 +62,29 @@ ./usr/lib/gcc-lib/arm-unknown-openbsd4.6/3.3.5/collect2 ./usr/lib/gcc-lib/arm-unknown-openbsd4.6/3.3.5/f771 ./usr/lib/gcc-lib/arm-unknown-openbsd4.6/3.3.5/specs +./usr/lib/i18n/libBIG5.so.4.4 +./usr/lib/i18n/libDECHanyu.so.4.4 +./usr/lib/i18n/libEUC.so.4.4 +./usr/lib/i18n/libEUCTW.so.4.4 +./usr/lib/i18n/libGBK2K.so.4.4 +./usr/lib/i18n/libHZ.so.4.4 +./usr/lib/i18n/libISO2022.so.4.4 +./usr/lib/i18n/libJOHAB.so.4.4 +./usr/lib/i18n/libMSKanji.so.4.4 +./usr/lib/i18n/libUES.so.4.4 +./usr/lib/i18n/libUTF1632.so.4.4 +./usr/lib/i18n/libUTF7.so.4.4 +./usr/lib/i18n/libUTF8.so.4.4 +./usr/lib/i18n/libVIQR.so.4.4 +./usr/lib/i18n/libZW.so.4.4 +./usr/lib/i18n/libiconv_none.so.4.4 +./usr/lib/i18n/libiconv_std.so.4.4 +./usr/lib/i18n/libmapper_646.so.4.4 +./usr/lib/i18n/libmapper_none.so.4.4 +./usr/lib/i18n/libmapper_parallel.so.4.4 +./usr/lib/i18n/libmapper_serial.so.4.4 +./usr/lib/i18n/libmapper_std.so.4.4 +./usr/lib/i18n/libmapper_zone.so.4.4 ./usr/lib/libasn1.so.17.0 ./usr/lib/libc.so.53.0 ./usr/lib/libcom_err.so.17.0 @@ -75,6 +98,7 @@ ./usr/lib/libg2c.so.8.1 ./usr/lib/libgssapi.so.5.0 ./usr/lib/libiberty.so.10.0 +./usr/lib/libintl.so.0.0 ./usr/lib/libkafs.so.17.0 ./usr/lib/libkrb5.so.17.0 ./usr/lib/libkvm.so.9.1 @@ -1818,6 +1842,7 @@ ./usr/libdata/perl5/site_perl/arm-openbsd/glob.ph ./usr/libdata/perl5/site_perl/arm-openbsd/grp.ph ./usr/libdata/perl5/site_perl/arm-openbsd/histedit.ph +./usr/libdata/perl5/site_perl/arm-openbsd/iconv.ph ./usr/libdata/perl5/site_perl/arm-openbsd/ieeefp.ph ./usr/libdata/perl5/site_perl/arm-openbsd/ifaddrs.ph ./usr/libdata/perl5/site_perl/arm-openbsd/inttypes.ph @@ -1865,6 +1890,7 @@ ./usr/libdata/perl5/site_perl/arm-openbsd/kvm.ph ./usr/libdata/perl5/site_perl/arm-openbsd/langinfo.ph ./usr/libdata/perl5/site_perl/arm-openbsd/libgen.ph +./usr/libdata/perl5/site_perl/arm-openbsd/libintl.ph ./usr/libdata/perl5/site_perl/arm-openbsd/libmilter ./usr/libdata/perl5/site_perl/arm-openbsd/libmilter/mfapi.ph ./usr/libdata/perl5/site_perl/arm-openbsd/libmilter/mfdef.ph diff -uNr --exclude=CVS --exclude=obj src.orig/distrib/sets/lists/base/md.hp300 src/distrib/sets/lists/base/md.hp300 --- src.orig/distrib/sets/lists/base/md.hp300 Fri Jun 19 05:37:48 2009 +++ src/distrib/sets/lists/base/md.hp300 Thu Jun 18 13:03:20 2009 @@ -27,6 +27,29 @@ ./usr/lib/gcc-lib/m68k-unknown-openbsd4.6/2.95.3/cpp0 ./usr/lib/gcc-lib/m68k-unknown-openbsd4.6/2.95.3/include ./usr/lib/gcc-lib/m68k-unknown-openbsd4.6/2.95.3/specs +./usr/lib/i18n/libBIG5.so.4.4 +./usr/lib/i18n/libDECHanyu.so.4.4 +./usr/lib/i18n/libEUC.so.4.4 +./usr/lib/i18n/libEUCTW.so.4.4 +./usr/lib/i18n/libGBK2K.so.4.4 +./usr/lib/i18n/libHZ.so.4.4 +./usr/lib/i18n/libISO2022.so.4.4 +./usr/lib/i18n/libJOHAB.so.4.4 +./usr/lib/i18n/libMSKanji.so.4.4 +./usr/lib/i18n/libUES.so.4.4 +./usr/lib/i18n/libUTF1632.so.4.4 +./usr/lib/i18n/libUTF7.so.4.4 +./usr/lib/i18n/libUTF8.so.4.4 +./usr/lib/i18n/libVIQR.so.4.4 +./usr/lib/i18n/libZW.so.4.4 +./usr/lib/i18n/libiconv_none.so.4.4 +./usr/lib/i18n/libiconv_std.so.4.4 +./usr/lib/i18n/libmapper_646.so.4.4 +./usr/lib/i18n/libmapper_none.so.4.4 +./usr/lib/i18n/libmapper_parallel.so.4.4 +./usr/lib/i18n/libmapper_serial.so.4.4 +./usr/lib/i18n/libmapper_std.so.4.4 +./usr/lib/i18n/libmapper_zone.so.4.4 ./usr/lib/libasn1.so.17.0 ./usr/lib/libc.so.53.0 ./usr/lib/libcom_err.so.17.0 @@ -40,6 +63,7 @@ ./usr/lib/libg2c.so.8.0 ./usr/lib/libgssapi.so.5.0 ./usr/lib/libiberty.so.10.0 +./usr/lib/libintl.so.0.0 ./usr/lib/libkafs.so.17.0 ./usr/lib/libkrb5.so.17.0 ./usr/lib/libkvm.so.9.1 @@ -1696,6 +1720,7 @@ ./usr/libdata/perl5/site_perl/m68k-openbsd/hp300/trap.ph ./usr/libdata/perl5/site_perl/m68k-openbsd/hp300/varargs.ph ./usr/libdata/perl5/site_perl/m68k-openbsd/hp300/vmparam.ph +./usr/libdata/perl5/site_perl/m68k-openbsd/iconv.ph ./usr/libdata/perl5/site_perl/m68k-openbsd/ieeefp.ph ./usr/libdata/perl5/site_perl/m68k-openbsd/ifaddrs.ph ./usr/libdata/perl5/site_perl/m68k-openbsd/inttypes.ph @@ -1743,6 +1768,7 @@ ./usr/libdata/perl5/site_perl/m68k-openbsd/kvm.ph ./usr/libdata/perl5/site_perl/m68k-openbsd/langinfo.ph ./usr/libdata/perl5/site_perl/m68k-openbsd/libgen.ph +./usr/libdata/perl5/site_perl/m68k-openbsd/libintl.ph ./usr/libdata/perl5/site_perl/m68k-openbsd/libmilter ./usr/libdata/perl5/site_perl/m68k-openbsd/libmilter/mfapi.ph ./usr/libdata/perl5/site_perl/m68k-openbsd/libmilter/mfdef.ph diff -uNr --exclude=CVS --exclude=obj src.orig/distrib/sets/lists/base/md.hppa src/distrib/sets/lists/base/md.hppa --- src.orig/distrib/sets/lists/base/md.hppa Fri Jun 19 05:37:50 2009 +++ src/distrib/sets/lists/base/md.hppa Thu Jun 18 13:03:20 2009 @@ -87,6 +87,29 @@ ./usr/lib/gcc-lib/hppa-unknown-openbsd4.6/3.3.5/cc1 ./usr/lib/gcc-lib/hppa-unknown-openbsd4.6/3.3.5/collect2 ./usr/lib/gcc-lib/hppa-unknown-openbsd4.6/3.3.5/specs +./usr/lib/i18n/libBIG5.so.4.4 +./usr/lib/i18n/libDECHanyu.so.4.4 +./usr/lib/i18n/libEUC.so.4.4 +./usr/lib/i18n/libEUCTW.so.4.4 +./usr/lib/i18n/libGBK2K.so.4.4 +./usr/lib/i18n/libHZ.so.4.4 +./usr/lib/i18n/libISO2022.so.4.4 +./usr/lib/i18n/libJOHAB.so.4.4 +./usr/lib/i18n/libMSKanji.so.4.4 +./usr/lib/i18n/libUES.so.4.4 +./usr/lib/i18n/libUTF1632.so.4.4 +./usr/lib/i18n/libUTF7.so.4.4 +./usr/lib/i18n/libUTF8.so.4.4 +./usr/lib/i18n/libVIQR.so.4.4 +./usr/lib/i18n/libZW.so.4.4 +./usr/lib/i18n/libiconv_none.so.4.4 +./usr/lib/i18n/libiconv_std.so.4.4 +./usr/lib/i18n/libmapper_646.so.4.4 +./usr/lib/i18n/libmapper_none.so.4.4 +./usr/lib/i18n/libmapper_parallel.so.4.4 +./usr/lib/i18n/libmapper_serial.so.4.4 +./usr/lib/i18n/libmapper_std.so.4.4 +./usr/lib/i18n/libmapper_zone.so.4.4 ./usr/lib/libasn1.so.17.0 ./usr/lib/libc.so.53.0 ./usr/lib/libcom_err.so.17.0 @@ -100,6 +123,7 @@ ./usr/lib/libg2c.so.8.1 ./usr/lib/libgssapi.so.5.0 ./usr/lib/libiberty.so.10.0 +./usr/lib/libintl.so.0.0 ./usr/lib/libkafs.so.17.0 ./usr/lib/libkrb5.so.17.0 ./usr/lib/libkvm.so.9.1 @@ -1801,6 +1825,7 @@ ./usr/libdata/perl5/site_perl/hppa-openbsd/hppa/trap.ph ./usr/libdata/perl5/site_perl/hppa-openbsd/hppa/varargs.ph ./usr/libdata/perl5/site_perl/hppa-openbsd/hppa/vmparam.ph +./usr/libdata/perl5/site_perl/hppa-openbsd/iconv.ph ./usr/libdata/perl5/site_perl/hppa-openbsd/ieeefp.ph ./usr/libdata/perl5/site_perl/hppa-openbsd/ifaddrs.ph ./usr/libdata/perl5/site_perl/hppa-openbsd/inttypes.ph @@ -1848,6 +1873,7 @@ ./usr/libdata/perl5/site_perl/hppa-openbsd/kvm.ph ./usr/libdata/perl5/site_perl/hppa-openbsd/langinfo.ph ./usr/libdata/perl5/site_perl/hppa-openbsd/libgen.ph +./usr/libdata/perl5/site_perl/hppa-openbsd/libintl.ph ./usr/libdata/perl5/site_perl/hppa-openbsd/libmilter ./usr/libdata/perl5/site_perl/hppa-openbsd/libmilter/mfapi.ph ./usr/libdata/perl5/site_perl/hppa-openbsd/libmilter/mfdef.ph diff -uNr --exclude=CVS --exclude=obj src.orig/distrib/sets/lists/base/md.hppa64 src/distrib/sets/lists/base/md.hppa64 --- src.orig/distrib/sets/lists/base/md.hppa64 Fri Jun 19 05:37:52 2009 +++ src/distrib/sets/lists/base/md.hppa64 Thu Jun 18 13:03:20 2009 @@ -87,6 +87,29 @@ ./usr/lib/gcc-lib/hppa64-unknown-openbsd4.6/3.3.5/cc1 ./usr/lib/gcc-lib/hppa64-unknown-openbsd4.6/3.3.5/collect2 ./usr/lib/gcc-lib/hppa64-unknown-openbsd4.6/3.3.5/specs +./usr/lib/i18n/libBIG5.so.4.4 +./usr/lib/i18n/libDECHanyu.so.4.4 +./usr/lib/i18n/libEUC.so.4.4 +./usr/lib/i18n/libEUCTW.so.4.4 +./usr/lib/i18n/libGBK2K.so.4.4 +./usr/lib/i18n/libHZ.so.4.4 +./usr/lib/i18n/libISO2022.so.4.4 +./usr/lib/i18n/libJOHAB.so.4.4 +./usr/lib/i18n/libMSKanji.so.4.4 +./usr/lib/i18n/libUES.so.4.4 +./usr/lib/i18n/libUTF1632.so.4.4 +./usr/lib/i18n/libUTF7.so.4.4 +./usr/lib/i18n/libUTF8.so.4.4 +./usr/lib/i18n/libVIQR.so.4.4 +./usr/lib/i18n/libZW.so.4.4 +./usr/lib/i18n/libiconv_none.so.4.4 +./usr/lib/i18n/libiconv_std.so.4.4 +./usr/lib/i18n/libmapper_646.so.4.4 +./usr/lib/i18n/libmapper_none.so.4.4 +./usr/lib/i18n/libmapper_parallel.so.4.4 +./usr/lib/i18n/libmapper_serial.so.4.4 +./usr/lib/i18n/libmapper_std.so.4.4 +./usr/lib/i18n/libmapper_zone.so.4.4 ./usr/lib/libasn1.so.17.0 ./usr/lib/libc.so.53.0 ./usr/lib/libcom_err.so.17.0 @@ -100,6 +123,7 @@ ./usr/lib/libg2c.so.8.1 ./usr/lib/libgssapi.so.5.0 ./usr/lib/libiberty.so.10.0 +./usr/lib/libintl.so.0.0 ./usr/lib/libkafs.so.17.0 ./usr/lib/libkrb5.so.17.0 ./usr/lib/libkvm.so.9.1 diff -uNr --exclude=CVS --exclude=obj src.orig/distrib/sets/lists/base/md.i386 src/distrib/sets/lists/base/md.i386 --- src.orig/distrib/sets/lists/base/md.i386 Fri Jun 19 05:37:53 2009 +++ src/distrib/sets/lists/base/md.i386 Thu Jun 18 13:03:20 2009 @@ -95,6 +95,29 @@ ./usr/lib/gcc-lib/i386-unknown-openbsd4.6/3.3.5/collect2 ./usr/lib/gcc-lib/i386-unknown-openbsd4.6/3.3.5/include ./usr/lib/gcc-lib/i386-unknown-openbsd4.6/3.3.5/specs +./usr/lib/i18n/libBIG5.so.4.4 +./usr/lib/i18n/libDECHanyu.so.4.4 +./usr/lib/i18n/libEUC.so.4.4 +./usr/lib/i18n/libEUCTW.so.4.4 +./usr/lib/i18n/libGBK2K.so.4.4 +./usr/lib/i18n/libHZ.so.4.4 +./usr/lib/i18n/libISO2022.so.4.4 +./usr/lib/i18n/libJOHAB.so.4.4 +./usr/lib/i18n/libMSKanji.so.4.4 +./usr/lib/i18n/libUES.so.4.4 +./usr/lib/i18n/libUTF1632.so.4.4 +./usr/lib/i18n/libUTF7.so.4.4 +./usr/lib/i18n/libUTF8.so.4.4 +./usr/lib/i18n/libVIQR.so.4.4 +./usr/lib/i18n/libZW.so.4.4 +./usr/lib/i18n/libiconv_none.so.4.4 +./usr/lib/i18n/libiconv_std.so.4.4 +./usr/lib/i18n/libmapper_646.so.4.4 +./usr/lib/i18n/libmapper_none.so.4.4 +./usr/lib/i18n/libmapper_parallel.so.4.4 +./usr/lib/i18n/libmapper_serial.so.4.4 +./usr/lib/i18n/libmapper_std.so.4.4 +./usr/lib/i18n/libmapper_zone.so.4.4 ./usr/lib/libasn1.so.17.0 ./usr/lib/libc.so.53.0 ./usr/lib/libcom_err.so.17.0 @@ -108,6 +131,7 @@ ./usr/lib/libg2c.so.8.1 ./usr/lib/libgssapi.so.5.0 ./usr/lib/libiberty.so.10.0 +./usr/lib/libintl.so.0.0 ./usr/lib/libkafs.so.17.0 ./usr/lib/libkrb5.so.17.0 ./usr/lib/libkvm.so.9.1 @@ -1834,6 +1858,7 @@ ./usr/libdata/perl5/site_perl/i386-openbsd/i386/vga_post.ph ./usr/libdata/perl5/site_perl/i386-openbsd/i386/vm86.ph ./usr/libdata/perl5/site_perl/i386-openbsd/i386/vmparam.ph +./usr/libdata/perl5/site_perl/i386-openbsd/iconv.ph ./usr/libdata/perl5/site_perl/i386-openbsd/ieeefp.ph ./usr/libdata/perl5/site_perl/i386-openbsd/ifaddrs.ph ./usr/libdata/perl5/site_perl/i386-openbsd/inttypes.ph @@ -1881,6 +1906,7 @@ ./usr/libdata/perl5/site_perl/i386-openbsd/kvm.ph ./usr/libdata/perl5/site_perl/i386-openbsd/langinfo.ph ./usr/libdata/perl5/site_perl/i386-openbsd/libgen.ph +./usr/libdata/perl5/site_perl/i386-openbsd/libintl.ph ./usr/libdata/perl5/site_perl/i386-openbsd/libmilter ./usr/libdata/perl5/site_perl/i386-openbsd/libmilter/mfapi.ph ./usr/libdata/perl5/site_perl/i386-openbsd/libmilter/mfdef.ph diff -uNr --exclude=CVS --exclude=obj src.orig/distrib/sets/lists/base/md.landisk src/distrib/sets/lists/base/md.landisk --- src.orig/distrib/sets/lists/base/md.landisk Fri Jun 19 05:37:55 2009 +++ src/distrib/sets/lists/base/md.landisk Thu Jun 18 13:03:20 2009 @@ -50,6 +50,29 @@ ./usr/lib/apache/modules/mod_unique_id.so ./usr/lib/apache/modules/mod_usertrack.so ./usr/lib/apache/modules/mod_vhost_alias.so +./usr/lib/i18n/libBIG5.so.4.4 +./usr/lib/i18n/libDECHanyu.so.4.4 +./usr/lib/i18n/libEUC.so.4.4 +./usr/lib/i18n/libEUCTW.so.4.4 +./usr/lib/i18n/libGBK2K.so.4.4 +./usr/lib/i18n/libHZ.so.4.4 +./usr/lib/i18n/libISO2022.so.4.4 +./usr/lib/i18n/libJOHAB.so.4.4 +./usr/lib/i18n/libMSKanji.so.4.4 +./usr/lib/i18n/libUES.so.4.4 +./usr/lib/i18n/libUTF1632.so.4.4 +./usr/lib/i18n/libUTF7.so.4.4 +./usr/lib/i18n/libUTF8.so.4.4 +./usr/lib/i18n/libVIQR.so.4.4 +./usr/lib/i18n/libZW.so.4.4 +./usr/lib/i18n/libiconv_none.so.4.4 +./usr/lib/i18n/libiconv_std.so.4.4 +./usr/lib/i18n/libmapper_646.so.4.4 +./usr/lib/i18n/libmapper_none.so.4.4 +./usr/lib/i18n/libmapper_parallel.so.4.4 +./usr/lib/i18n/libmapper_serial.so.4.4 +./usr/lib/i18n/libmapper_std.so.4.4 +./usr/lib/i18n/libmapper_zone.so.4.4 ./usr/lib/libasn1.so.17.0 ./usr/lib/libc.so.53.0 ./usr/lib/libcom_err.so.17.0 @@ -63,6 +86,7 @@ ./usr/lib/libg2c.so.8.1 ./usr/lib/libgssapi.so.5.0 ./usr/lib/libiberty.so.10.0 +./usr/lib/libintl.so.0.0 ./usr/lib/libkafs.so.17.0 ./usr/lib/libkrb5.so.17.0 ./usr/lib/libkvm.so.9.1 @@ -1712,6 +1736,7 @@ ./usr/libdata/perl5/site_perl/sh-openbsd/glob.ph ./usr/libdata/perl5/site_perl/sh-openbsd/grp.ph ./usr/libdata/perl5/site_perl/sh-openbsd/histedit.ph +./usr/libdata/perl5/site_perl/sh-openbsd/iconv.ph ./usr/libdata/perl5/site_perl/sh-openbsd/ieeefp.ph ./usr/libdata/perl5/site_perl/sh-openbsd/ifaddrs.ph ./usr/libdata/perl5/site_perl/sh-openbsd/inttypes.ph @@ -1803,6 +1828,7 @@ ./usr/libdata/perl5/site_perl/sh-openbsd/landisk/vmparam.ph ./usr/libdata/perl5/site_perl/sh-openbsd/langinfo.ph ./usr/libdata/perl5/site_perl/sh-openbsd/libgen.ph +./usr/libdata/perl5/site_perl/sh-openbsd/libintl.ph ./usr/libdata/perl5/site_perl/sh-openbsd/libmilter ./usr/libdata/perl5/site_perl/sh-openbsd/libmilter/mfapi.ph ./usr/libdata/perl5/site_perl/sh-openbsd/libmilter/mfdef.ph diff -uNr --exclude=CVS --exclude=obj src.orig/distrib/sets/lists/base/md.luna88k src/distrib/sets/lists/base/md.luna88k --- src.orig/distrib/sets/lists/base/md.luna88k Fri Jun 19 05:37:57 2009 +++ src/distrib/sets/lists/base/md.luna88k Thu Jun 18 13:03:20 2009 @@ -1518,6 +1518,7 @@ ./usr/libdata/perl5/site_perl/m88k-openbsd/glob.ph ./usr/libdata/perl5/site_perl/m88k-openbsd/grp.ph ./usr/libdata/perl5/site_perl/m88k-openbsd/histedit.ph +./usr/libdata/perl5/site_perl/m88k-openbsd/iconv.ph ./usr/libdata/perl5/site_perl/m88k-openbsd/ieeefp.ph ./usr/libdata/perl5/site_perl/m88k-openbsd/ifaddrs.ph ./usr/libdata/perl5/site_perl/m88k-openbsd/inttypes.ph @@ -1565,6 +1566,7 @@ ./usr/libdata/perl5/site_perl/m88k-openbsd/kvm.ph ./usr/libdata/perl5/site_perl/m88k-openbsd/langinfo.ph ./usr/libdata/perl5/site_perl/m88k-openbsd/libgen.ph +./usr/libdata/perl5/site_perl/m88k-openbsd/libintl.ph ./usr/libdata/perl5/site_perl/m88k-openbsd/libmilter ./usr/libdata/perl5/site_perl/m88k-openbsd/libmilter/mfapi.ph ./usr/libdata/perl5/site_perl/m88k-openbsd/libmilter/mfdef.ph diff -uNr --exclude=CVS --exclude=obj src.orig/distrib/sets/lists/base/md.mac68k src/distrib/sets/lists/base/md.mac68k --- src.orig/distrib/sets/lists/base/md.mac68k Fri Jun 19 05:37:58 2009 +++ src/distrib/sets/lists/base/md.mac68k Thu Jun 18 13:03:20 2009 @@ -28,6 +28,29 @@ ./usr/lib/gcc-lib/m68k-unknown-openbsd4.6/2.95.3/cpp0 ./usr/lib/gcc-lib/m68k-unknown-openbsd4.6/2.95.3/include ./usr/lib/gcc-lib/m68k-unknown-openbsd4.6/2.95.3/specs +./usr/lib/i18n/libBIG5.so.4.4 +./usr/lib/i18n/libDECHanyu.so.4.4 +./usr/lib/i18n/libEUC.so.4.4 +./usr/lib/i18n/libEUCTW.so.4.4 +./usr/lib/i18n/libGBK2K.so.4.4 +./usr/lib/i18n/libHZ.so.4.4 +./usr/lib/i18n/libISO2022.so.4.4 +./usr/lib/i18n/libJOHAB.so.4.4 +./usr/lib/i18n/libMSKanji.so.4.4 +./usr/lib/i18n/libUES.so.4.4 +./usr/lib/i18n/libUTF1632.so.4.4 +./usr/lib/i18n/libUTF7.so.4.4 +./usr/lib/i18n/libUTF8.so.4.4 +./usr/lib/i18n/libVIQR.so.4.4 +./usr/lib/i18n/libZW.so.4.4 +./usr/lib/i18n/libiconv_none.so.4.4 +./usr/lib/i18n/libiconv_std.so.4.4 +./usr/lib/i18n/libmapper_646.so.4.4 +./usr/lib/i18n/libmapper_none.so.4.4 +./usr/lib/i18n/libmapper_parallel.so.4.4 +./usr/lib/i18n/libmapper_serial.so.4.4 +./usr/lib/i18n/libmapper_std.so.4.4 +./usr/lib/i18n/libmapper_zone.so.4.4 ./usr/lib/libasn1.so.17.0 ./usr/lib/libc.so.53.0 ./usr/lib/libcom_err.so.17.0 @@ -41,6 +64,7 @@ ./usr/lib/libg2c.so.8.0 ./usr/lib/libgssapi.so.5.0 ./usr/lib/libiberty.so.10.0 +./usr/lib/libintl.so.0.0 ./usr/lib/libkafs.so.17.0 ./usr/lib/libkrb5.so.17.0 ./usr/lib/libkvm.so.9.1 @@ -1656,6 +1680,7 @@ ./usr/libdata/perl5/site_perl/m68k-openbsd/glob.ph ./usr/libdata/perl5/site_perl/m68k-openbsd/grp.ph ./usr/libdata/perl5/site_perl/m68k-openbsd/histedit.ph +./usr/libdata/perl5/site_perl/m68k-openbsd/iconv.ph ./usr/libdata/perl5/site_perl/m68k-openbsd/ieeefp.ph ./usr/libdata/perl5/site_perl/m68k-openbsd/ifaddrs.ph ./usr/libdata/perl5/site_perl/m68k-openbsd/inttypes.ph @@ -1703,6 +1728,7 @@ ./usr/libdata/perl5/site_perl/m68k-openbsd/kvm.ph ./usr/libdata/perl5/site_perl/m68k-openbsd/langinfo.ph ./usr/libdata/perl5/site_perl/m68k-openbsd/libgen.ph +./usr/libdata/perl5/site_perl/m68k-openbsd/libintl.ph ./usr/libdata/perl5/site_perl/m68k-openbsd/libmilter ./usr/libdata/perl5/site_perl/m68k-openbsd/libmilter/mfapi.ph ./usr/libdata/perl5/site_perl/m68k-openbsd/libmilter/mfdef.ph diff -uNr --exclude=CVS --exclude=obj src.orig/distrib/sets/lists/base/md.macppc src/distrib/sets/lists/base/md.macppc --- src.orig/distrib/sets/lists/base/md.macppc Fri Jun 19 05:38:00 2009 +++ src/distrib/sets/lists/base/md.macppc Thu Jun 18 13:03:21 2009 @@ -90,6 +90,29 @@ ./usr/lib/gcc-lib/powerpc-unknown-openbsd4.6/3.3.5/collect2 ./usr/lib/gcc-lib/powerpc-unknown-openbsd4.6/3.3.5/include ./usr/lib/gcc-lib/powerpc-unknown-openbsd4.6/3.3.5/specs +./usr/lib/i18n/libBIG5.so.4.4 +./usr/lib/i18n/libDECHanyu.so.4.4 +./usr/lib/i18n/libEUC.so.4.4 +./usr/lib/i18n/libEUCTW.so.4.4 +./usr/lib/i18n/libGBK2K.so.4.4 +./usr/lib/i18n/libHZ.so.4.4 +./usr/lib/i18n/libISO2022.so.4.4 +./usr/lib/i18n/libJOHAB.so.4.4 +./usr/lib/i18n/libMSKanji.so.4.4 +./usr/lib/i18n/libUES.so.4.4 +./usr/lib/i18n/libUTF1632.so.4.4 +./usr/lib/i18n/libUTF7.so.4.4 +./usr/lib/i18n/libUTF8.so.4.4 +./usr/lib/i18n/libVIQR.so.4.4 +./usr/lib/i18n/libZW.so.4.4 +./usr/lib/i18n/libiconv_none.so.4.4 +./usr/lib/i18n/libiconv_std.so.4.4 +./usr/lib/i18n/libmapper_646.so.4.4 +./usr/lib/i18n/libmapper_none.so.4.4 +./usr/lib/i18n/libmapper_parallel.so.4.4 +./usr/lib/i18n/libmapper_serial.so.4.4 +./usr/lib/i18n/libmapper_std.so.4.4 +./usr/lib/i18n/libmapper_zone.so.4.4 ./usr/lib/libasn1.so.17.0 ./usr/lib/libc.so.53.0 ./usr/lib/libcom_err.so.17.0 @@ -103,6 +126,7 @@ ./usr/lib/libg2c.so.8.1 ./usr/lib/libgssapi.so.5.0 ./usr/lib/libiberty.so.10.0 +./usr/lib/libintl.so.0.0 ./usr/lib/libkafs.so.17.0 ./usr/lib/libkrb5.so.17.0 ./usr/lib/libkvm.so.9.1 @@ -1753,6 +1777,7 @@ ./usr/libdata/perl5/site_perl/powerpc-openbsd/glob.ph ./usr/libdata/perl5/site_perl/powerpc-openbsd/grp.ph ./usr/libdata/perl5/site_perl/powerpc-openbsd/histedit.ph +./usr/libdata/perl5/site_perl/powerpc-openbsd/iconv.ph ./usr/libdata/perl5/site_perl/powerpc-openbsd/ieeefp.ph ./usr/libdata/perl5/site_perl/powerpc-openbsd/ifaddrs.ph ./usr/libdata/perl5/site_perl/powerpc-openbsd/inttypes.ph @@ -1800,6 +1825,7 @@ ./usr/libdata/perl5/site_perl/powerpc-openbsd/kvm.ph ./usr/libdata/perl5/site_perl/powerpc-openbsd/langinfo.ph ./usr/libdata/perl5/site_perl/powerpc-openbsd/libgen.ph +./usr/libdata/perl5/site_perl/powerpc-openbsd/libintl.ph ./usr/libdata/perl5/site_perl/powerpc-openbsd/libmilter ./usr/libdata/perl5/site_perl/powerpc-openbsd/libmilter/mfapi.ph ./usr/libdata/perl5/site_perl/powerpc-openbsd/libmilter/mfdef.ph diff -uNr --exclude=CVS --exclude=obj src.orig/distrib/sets/lists/base/md.mvme68k src/distrib/sets/lists/base/md.mvme68k --- src.orig/distrib/sets/lists/base/md.mvme68k Fri Jun 19 05:38:02 2009 +++ src/distrib/sets/lists/base/md.mvme68k Thu Jun 18 13:03:21 2009 @@ -25,6 +25,29 @@ ./usr/lib/gcc-lib/m68k-unknown-openbsd4.6/2.95.3/cpp0 ./usr/lib/gcc-lib/m68k-unknown-openbsd4.6/2.95.3/include ./usr/lib/gcc-lib/m68k-unknown-openbsd4.6/2.95.3/specs +./usr/lib/i18n/libBIG5.so.4.4 +./usr/lib/i18n/libDECHanyu.so.4.4 +./usr/lib/i18n/libEUC.so.4.4 +./usr/lib/i18n/libEUCTW.so.4.4 +./usr/lib/i18n/libGBK2K.so.4.4 +./usr/lib/i18n/libHZ.so.4.4 +./usr/lib/i18n/libISO2022.so.4.4 +./usr/lib/i18n/libJOHAB.so.4.4 +./usr/lib/i18n/libMSKanji.so.4.4 +./usr/lib/i18n/libUES.so.4.4 +./usr/lib/i18n/libUTF1632.so.4.4 +./usr/lib/i18n/libUTF7.so.4.4 +./usr/lib/i18n/libUTF8.so.4.4 +./usr/lib/i18n/libVIQR.so.4.4 +./usr/lib/i18n/libZW.so.4.4 +./usr/lib/i18n/libiconv_none.so.4.4 +./usr/lib/i18n/libiconv_std.so.4.4 +./usr/lib/i18n/libmapper_646.so.4.4 +./usr/lib/i18n/libmapper_none.so.4.4 +./usr/lib/i18n/libmapper_parallel.so.4.4 +./usr/lib/i18n/libmapper_serial.so.4.4 +./usr/lib/i18n/libmapper_std.so.4.4 +./usr/lib/i18n/libmapper_zone.so.4.4 ./usr/lib/libasn1.so.17.0 ./usr/lib/libc.so.53.0 ./usr/lib/libcom_err.so.17.0 @@ -38,6 +61,7 @@ ./usr/lib/libg2c.so.8.0 ./usr/lib/libgssapi.so.5.0 ./usr/lib/libiberty.so.10.0 +./usr/lib/libintl.so.0.0 ./usr/lib/libkafs.so.17.0 ./usr/lib/libkrb5.so.17.0 ./usr/lib/libkvm.so.9.1 @@ -1672,6 +1696,7 @@ ./usr/libdata/perl5/site_perl/m68k-openbsd/glob.ph ./usr/libdata/perl5/site_perl/m68k-openbsd/grp.ph ./usr/libdata/perl5/site_perl/m68k-openbsd/histedit.ph +./usr/libdata/perl5/site_perl/m68k-openbsd/iconv.ph ./usr/libdata/perl5/site_perl/m68k-openbsd/ieeefp.ph ./usr/libdata/perl5/site_perl/m68k-openbsd/ifaddrs.ph ./usr/libdata/perl5/site_perl/m68k-openbsd/inttypes.ph @@ -1719,6 +1744,7 @@ ./usr/libdata/perl5/site_perl/m68k-openbsd/kvm.ph ./usr/libdata/perl5/site_perl/m68k-openbsd/langinfo.ph ./usr/libdata/perl5/site_perl/m68k-openbsd/libgen.ph +./usr/libdata/perl5/site_perl/m68k-openbsd/libintl.ph ./usr/libdata/perl5/site_perl/m68k-openbsd/libmilter ./usr/libdata/perl5/site_perl/m68k-openbsd/libmilter/mfapi.ph ./usr/libdata/perl5/site_perl/m68k-openbsd/libmilter/mfdef.ph diff -uNr --exclude=CVS --exclude=obj src.orig/distrib/sets/lists/base/md.mvme88k src/distrib/sets/lists/base/md.mvme88k --- src.orig/distrib/sets/lists/base/md.mvme88k Fri Jun 19 05:38:04 2009 +++ src/distrib/sets/lists/base/md.mvme88k Thu Jun 18 13:03:21 2009 @@ -1658,6 +1658,7 @@ ./usr/libdata/perl5/site_perl/m88k-openbsd/glob.ph ./usr/libdata/perl5/site_perl/m88k-openbsd/grp.ph ./usr/libdata/perl5/site_perl/m88k-openbsd/histedit.ph +./usr/libdata/perl5/site_perl/m88k-openbsd/iconv.ph ./usr/libdata/perl5/site_perl/m88k-openbsd/ieeefp.ph ./usr/libdata/perl5/site_perl/m88k-openbsd/ifaddrs.ph ./usr/libdata/perl5/site_perl/m88k-openbsd/inttypes.ph @@ -1705,6 +1706,7 @@ ./usr/libdata/perl5/site_perl/m88k-openbsd/kvm.ph ./usr/libdata/perl5/site_perl/m88k-openbsd/langinfo.ph ./usr/libdata/perl5/site_perl/m88k-openbsd/libgen.ph +./usr/libdata/perl5/site_perl/m88k-openbsd/libintl.ph ./usr/libdata/perl5/site_perl/m88k-openbsd/libmilter ./usr/libdata/perl5/site_perl/m88k-openbsd/libmilter/mfapi.ph ./usr/libdata/perl5/site_perl/m88k-openbsd/libmilter/mfdef.ph diff -uNr --exclude=CVS --exclude=obj src.orig/distrib/sets/lists/base/md.mvmeppc src/distrib/sets/lists/base/md.mvmeppc --- src.orig/distrib/sets/lists/base/md.mvmeppc Fri Jun 19 05:38:05 2009 +++ src/distrib/sets/lists/base/md.mvmeppc Thu Jun 18 13:03:21 2009 @@ -59,6 +59,29 @@ ./usr/lib/gcc-lib/powerpc-unknown-openbsd4.6/2.95.3/cpp0 ./usr/lib/gcc-lib/powerpc-unknown-openbsd4.6/2.95.3/include ./usr/lib/gcc-lib/powerpc-unknown-openbsd4.6/2.95.3/specs +./usr/lib/i18n/libBIG5.so.4.4 +./usr/lib/i18n/libDECHanyu.so.4.4 +./usr/lib/i18n/libEUC.so.4.4 +./usr/lib/i18n/libEUCTW.so.4.4 +./usr/lib/i18n/libGBK2K.so.4.4 +./usr/lib/i18n/libHZ.so.4.4 +./usr/lib/i18n/libISO2022.so.4.4 +./usr/lib/i18n/libJOHAB.so.4.4 +./usr/lib/i18n/libMSKanji.so.4.4 +./usr/lib/i18n/libUES.so.4.4 +./usr/lib/i18n/libUTF1632.so.4.4 +./usr/lib/i18n/libUTF7.so.4.4 +./usr/lib/i18n/libUTF8.so.4.4 +./usr/lib/i18n/libVIQR.so.4.4 +./usr/lib/i18n/libZW.so.4.4 +./usr/lib/i18n/libiconv_none.so.4.4 +./usr/lib/i18n/libiconv_std.so.4.4 +./usr/lib/i18n/libmapper_646.so.4.4 +./usr/lib/i18n/libmapper_none.so.4.4 +./usr/lib/i18n/libmapper_parallel.so.4.4 +./usr/lib/i18n/libmapper_serial.so.4.4 +./usr/lib/i18n/libmapper_std.so.4.4 +./usr/lib/i18n/libmapper_zone.so.4.4 ./usr/lib/libasn1.so.17.0 ./usr/lib/libc.so.53.0 ./usr/lib/libcom_err.so.17.0 @@ -72,6 +95,7 @@ ./usr/lib/libg2c.so.8.1 ./usr/lib/libgssapi.so.5.0 ./usr/lib/libiberty.so.10.0 +./usr/lib/libintl.so.0.0 ./usr/lib/libkafs.so.17.0 ./usr/lib/libkrb5.so.17.0 ./usr/lib/libkvm.so.9.1 @@ -1621,6 +1645,7 @@ ./usr/libdata/perl5/site_perl/powerpc-openbsd/glob.ph ./usr/libdata/perl5/site_perl/powerpc-openbsd/grp.ph ./usr/libdata/perl5/site_perl/powerpc-openbsd/histedit.ph +./usr/libdata/perl5/site_perl/powerpc-openbsd/iconv.ph ./usr/libdata/perl5/site_perl/powerpc-openbsd/ieeefp.ph ./usr/libdata/perl5/site_perl/powerpc-openbsd/ifaddrs.ph ./usr/libdata/perl5/site_perl/powerpc-openbsd/inttypes.ph @@ -1665,6 +1690,7 @@ ./usr/libdata/perl5/site_perl/powerpc-openbsd/kvm.ph ./usr/libdata/perl5/site_perl/powerpc-openbsd/langinfo.ph ./usr/libdata/perl5/site_perl/powerpc-openbsd/libgen.ph +./usr/libdata/perl5/site_perl/powerpc-openbsd/libintl.ph ./usr/libdata/perl5/site_perl/powerpc-openbsd/libmilter ./usr/libdata/perl5/site_perl/powerpc-openbsd/libmilter/mfapi.ph ./usr/libdata/perl5/site_perl/powerpc-openbsd/libmilter/mfdef.ph diff -uNr --exclude=CVS --exclude=obj src.orig/distrib/sets/lists/base/md.sgi src/distrib/sets/lists/base/md.sgi --- src.orig/distrib/sets/lists/base/md.sgi Fri Jun 19 05:38:09 2009 +++ src/distrib/sets/lists/base/md.sgi Thu Jun 18 13:03:21 2009 @@ -90,6 +90,29 @@ ./usr/lib/gcc-lib/mips64-unknown-openbsd4.6/3.3.5/f771 ./usr/lib/gcc-lib/mips64-unknown-openbsd4.6/3.3.5/include ./usr/lib/gcc-lib/mips64-unknown-openbsd4.6/3.3.5/specs +./usr/lib/i18n/libBIG5.so.4.4 +./usr/lib/i18n/libDECHanyu.so.4.4 +./usr/lib/i18n/libEUC.so.4.4 +./usr/lib/i18n/libEUCTW.so.4.4 +./usr/lib/i18n/libGBK2K.so.4.4 +./usr/lib/i18n/libHZ.so.4.4 +./usr/lib/i18n/libISO2022.so.4.4 +./usr/lib/i18n/libJOHAB.so.4.4 +./usr/lib/i18n/libMSKanji.so.4.4 +./usr/lib/i18n/libUES.so.4.4 +./usr/lib/i18n/libUTF1632.so.4.4 +./usr/lib/i18n/libUTF7.so.4.4 +./usr/lib/i18n/libUTF8.so.4.4 +./usr/lib/i18n/libVIQR.so.4.4 +./usr/lib/i18n/libZW.so.4.4 +./usr/lib/i18n/libiconv_none.so.4.4 +./usr/lib/i18n/libiconv_std.so.4.4 +./usr/lib/i18n/libmapper_646.so.4.4 +./usr/lib/i18n/libmapper_none.so.4.4 +./usr/lib/i18n/libmapper_parallel.so.4.4 +./usr/lib/i18n/libmapper_serial.so.4.4 +./usr/lib/i18n/libmapper_std.so.4.4 +./usr/lib/i18n/libmapper_zone.so.4.4 ./usr/lib/libasn1.so.17.0 ./usr/lib/libc.so.53.0 ./usr/lib/libcom_err.so.17.0 @@ -103,6 +126,7 @@ ./usr/lib/libg2c.so.8.1 ./usr/lib/libgssapi.so.5.0 ./usr/lib/libiberty.so.10.0 +./usr/lib/libintl.so.0.0 ./usr/lib/libkafs.so.17.0 ./usr/lib/libkrb5.so.17.0 ./usr/lib/libkvm.so.9.1 @@ -1753,6 +1777,7 @@ ./usr/libdata/perl5/site_perl/mips64-openbsd/glob.ph ./usr/libdata/perl5/site_perl/mips64-openbsd/grp.ph ./usr/libdata/perl5/site_perl/mips64-openbsd/histedit.ph +./usr/libdata/perl5/site_perl/mips64-openbsd/iconv.ph ./usr/libdata/perl5/site_perl/mips64-openbsd/ieeefp.ph ./usr/libdata/perl5/site_perl/mips64-openbsd/ifaddrs.ph ./usr/libdata/perl5/site_perl/mips64-openbsd/inttypes.ph @@ -1800,6 +1825,7 @@ ./usr/libdata/perl5/site_perl/mips64-openbsd/kvm.ph ./usr/libdata/perl5/site_perl/mips64-openbsd/langinfo.ph ./usr/libdata/perl5/site_perl/mips64-openbsd/libgen.ph +./usr/libdata/perl5/site_perl/mips64-openbsd/libintl.ph ./usr/libdata/perl5/site_perl/mips64-openbsd/libmilter ./usr/libdata/perl5/site_perl/mips64-openbsd/libmilter/mfapi.ph ./usr/libdata/perl5/site_perl/mips64-openbsd/libmilter/mfdef.ph diff -uNr --exclude=CVS --exclude=obj src.orig/distrib/sets/lists/base/md.socppc src/distrib/sets/lists/base/md.socppc --- src.orig/distrib/sets/lists/base/md.socppc Fri Jun 19 05:38:11 2009 +++ src/distrib/sets/lists/base/md.socppc Thu Jun 18 13:03:21 2009 @@ -85,6 +85,29 @@ ./usr/lib/gcc-lib/powerpc-unknown-openbsd4.6/3.3.5/collect2 ./usr/lib/gcc-lib/powerpc-unknown-openbsd4.6/3.3.5/include ./usr/lib/gcc-lib/powerpc-unknown-openbsd4.6/3.3.5/specs +./usr/lib/i18n/libBIG5.so.4.4 +./usr/lib/i18n/libDECHanyu.so.4.4 +./usr/lib/i18n/libEUC.so.4.4 +./usr/lib/i18n/libEUCTW.so.4.4 +./usr/lib/i18n/libGBK2K.so.4.4 +./usr/lib/i18n/libHZ.so.4.4 +./usr/lib/i18n/libISO2022.so.4.4 +./usr/lib/i18n/libJOHAB.so.4.4 +./usr/lib/i18n/libMSKanji.so.4.4 +./usr/lib/i18n/libUES.so.4.4 +./usr/lib/i18n/libUTF1632.so.4.4 +./usr/lib/i18n/libUTF7.so.4.4 +./usr/lib/i18n/libUTF8.so.4.4 +./usr/lib/i18n/libVIQR.so.4.4 +./usr/lib/i18n/libZW.so.4.4 +./usr/lib/i18n/libiconv_none.so.4.4 +./usr/lib/i18n/libiconv_std.so.4.4 +./usr/lib/i18n/libmapper_646.so.4.4 +./usr/lib/i18n/libmapper_none.so.4.4 +./usr/lib/i18n/libmapper_parallel.so.4.4 +./usr/lib/i18n/libmapper_serial.so.4.4 +./usr/lib/i18n/libmapper_std.so.4.4 +./usr/lib/i18n/libmapper_zone.so.4.4 ./usr/lib/libasn1.so.17.0 ./usr/lib/libc.so.53.0 ./usr/lib/libcom_err.so.17.0 @@ -98,6 +121,7 @@ ./usr/lib/libg2c.so.8.1 ./usr/lib/libgssapi.so.5.0 ./usr/lib/libiberty.so.10.0 +./usr/lib/libintl.so.0.0 ./usr/lib/libkafs.so.17.0 ./usr/lib/libkrb5.so.17.0 ./usr/lib/libkvm.so.9.1 @@ -1748,6 +1772,7 @@ ./usr/libdata/perl5/site_perl/powerpc-openbsd/glob.ph ./usr/libdata/perl5/site_perl/powerpc-openbsd/grp.ph ./usr/libdata/perl5/site_perl/powerpc-openbsd/histedit.ph +./usr/libdata/perl5/site_perl/powerpc-openbsd/iconv.ph ./usr/libdata/perl5/site_perl/powerpc-openbsd/ieeefp.ph ./usr/libdata/perl5/site_perl/powerpc-openbsd/ifaddrs.ph ./usr/libdata/perl5/site_perl/powerpc-openbsd/inttypes.ph @@ -1795,6 +1820,7 @@ ./usr/libdata/perl5/site_perl/powerpc-openbsd/kvm.ph ./usr/libdata/perl5/site_perl/powerpc-openbsd/langinfo.ph ./usr/libdata/perl5/site_perl/powerpc-openbsd/libgen.ph +./usr/libdata/perl5/site_perl/powerpc-openbsd/libintl.ph ./usr/libdata/perl5/site_perl/powerpc-openbsd/libmilter ./usr/libdata/perl5/site_perl/powerpc-openbsd/libmilter/mfapi.ph ./usr/libdata/perl5/site_perl/powerpc-openbsd/libmilter/mfdef.ph diff -uNr --exclude=CVS --exclude=obj src.orig/distrib/sets/lists/base/md.sparc src/distrib/sets/lists/base/md.sparc --- src.orig/distrib/sets/lists/base/md.sparc Fri Jun 19 05:38:12 2009 +++ src/distrib/sets/lists/base/md.sparc Thu Jun 18 13:03:21 2009 @@ -33,6 +33,29 @@ ./usr/lib/gcc-lib/sparc-unknown-openbsd4.6/2.95.3/cpp0 ./usr/lib/gcc-lib/sparc-unknown-openbsd4.6/2.95.3/include ./usr/lib/gcc-lib/sparc-unknown-openbsd4.6/2.95.3/specs +./usr/lib/i18n/libBIG5.so.4.4 +./usr/lib/i18n/libDECHanyu.so.4.4 +./usr/lib/i18n/libEUC.so.4.4 +./usr/lib/i18n/libEUCTW.so.4.4 +./usr/lib/i18n/libGBK2K.so.4.4 +./usr/lib/i18n/libHZ.so.4.4 +./usr/lib/i18n/libISO2022.so.4.4 +./usr/lib/i18n/libJOHAB.so.4.4 +./usr/lib/i18n/libMSKanji.so.4.4 +./usr/lib/i18n/libUES.so.4.4 +./usr/lib/i18n/libUTF1632.so.4.4 +./usr/lib/i18n/libUTF7.so.4.4 +./usr/lib/i18n/libUTF8.so.4.4 +./usr/lib/i18n/libVIQR.so.4.4 +./usr/lib/i18n/libZW.so.4.4 +./usr/lib/i18n/libiconv_none.so.4.4 +./usr/lib/i18n/libiconv_std.so.4.4 +./usr/lib/i18n/libmapper_646.so.4.4 +./usr/lib/i18n/libmapper_none.so.4.4 +./usr/lib/i18n/libmapper_parallel.so.4.4 +./usr/lib/i18n/libmapper_serial.so.4.4 +./usr/lib/i18n/libmapper_std.so.4.4 +./usr/lib/i18n/libmapper_zone.so.4.4 ./usr/lib/libasn1.so.17.0 ./usr/lib/libc.so.53.0 ./usr/lib/libcom_err.so.17.0 @@ -46,6 +69,7 @@ ./usr/lib/libg2c.so.8.0 ./usr/lib/libgssapi.so.5.0 ./usr/lib/libiberty.so.10.0 +./usr/lib/libintl.so.0.0 ./usr/lib/libkafs.so.17.0 ./usr/lib/libkrb5.so.17.0 ./usr/lib/libkvm.so.9.1 @@ -1109,6 +1133,7 @@ ./usr/libdata/perl5/site_perl/sparc-openbsd/glob.ph ./usr/libdata/perl5/site_perl/sparc-openbsd/grp.ph ./usr/libdata/perl5/site_perl/sparc-openbsd/histedit.ph +./usr/libdata/perl5/site_perl/sparc-openbsd/iconv.ph ./usr/libdata/perl5/site_perl/sparc-openbsd/ieeefp.ph ./usr/libdata/perl5/site_perl/sparc-openbsd/ifaddrs.ph ./usr/libdata/perl5/site_perl/sparc-openbsd/inttypes.ph @@ -1156,6 +1181,7 @@ ./usr/libdata/perl5/site_perl/sparc-openbsd/kvm.ph ./usr/libdata/perl5/site_perl/sparc-openbsd/langinfo.ph ./usr/libdata/perl5/site_perl/sparc-openbsd/libgen.ph +./usr/libdata/perl5/site_perl/sparc-openbsd/libintl.ph ./usr/libdata/perl5/site_perl/sparc-openbsd/libmilter ./usr/libdata/perl5/site_perl/sparc-openbsd/libmilter/mfapi.ph ./usr/libdata/perl5/site_perl/sparc-openbsd/libmilter/mfdef.ph diff -uNr --exclude=CVS --exclude=obj src.orig/distrib/sets/lists/base/md.sparc64 src/distrib/sets/lists/base/md.sparc64 --- src.orig/distrib/sets/lists/base/md.sparc64 Fri Jun 19 05:38:14 2009 +++ src/distrib/sets/lists/base/md.sparc64 Thu Jun 18 13:03:21 2009 @@ -86,6 +86,29 @@ ./usr/lib/apache/modules/mod_vhost_alias.so ./usr/lib/gcc-lib/sparc64-unknown-openbsd4.6 ./usr/lib/gcc-lib/sparc64-unknown-openbsd4.6/3.3.5/cc1 +./usr/lib/i18n/libBIG5.so.4.4 +./usr/lib/i18n/libDECHanyu.so.4.4 +./usr/lib/i18n/libEUC.so.4.4 +./usr/lib/i18n/libEUCTW.so.4.4 +./usr/lib/i18n/libGBK2K.so.4.4 +./usr/lib/i18n/libHZ.so.4.4 +./usr/lib/i18n/libISO2022.so.4.4 +./usr/lib/i18n/libJOHAB.so.4.4 +./usr/lib/i18n/libMSKanji.so.4.4 +./usr/lib/i18n/libUES.so.4.4 +./usr/lib/i18n/libUTF1632.so.4.4 +./usr/lib/i18n/libUTF7.so.4.4 +./usr/lib/i18n/libUTF8.so.4.4 +./usr/lib/i18n/libVIQR.so.4.4 +./usr/lib/i18n/libZW.so.4.4 +./usr/lib/i18n/libiconv_none.so.4.4 +./usr/lib/i18n/libiconv_std.so.4.4 +./usr/lib/i18n/libmapper_646.so.4.4 +./usr/lib/i18n/libmapper_none.so.4.4 +./usr/lib/i18n/libmapper_parallel.so.4.4 +./usr/lib/i18n/libmapper_serial.so.4.4 +./usr/lib/i18n/libmapper_std.so.4.4 +./usr/lib/i18n/libmapper_zone.so.4.4 ./usr/lib/libasn1.so.17.0 ./usr/lib/libc.so.53.0 ./usr/lib/libcom_err.so.17.0 @@ -99,6 +122,7 @@ ./usr/lib/libg2c.so.8.1 ./usr/lib/libgssapi.so.5.0 ./usr/lib/libiberty.so.10.0 +./usr/lib/libintl.so.0.0 ./usr/lib/libkafs.so.17.0 ./usr/lib/libkrb5.so.17.0 ./usr/lib/libkvm.so.9.1 @@ -1177,6 +1201,7 @@ ./usr/libdata/perl5/site_perl/sparc64-openbsd/glob.ph ./usr/libdata/perl5/site_perl/sparc64-openbsd/grp.ph ./usr/libdata/perl5/site_perl/sparc64-openbsd/histedit.ph +./usr/libdata/perl5/site_perl/sparc64-openbsd/iconv.ph ./usr/libdata/perl5/site_perl/sparc64-openbsd/ieeefp.ph ./usr/libdata/perl5/site_perl/sparc64-openbsd/ifaddrs.ph ./usr/libdata/perl5/site_perl/sparc64-openbsd/inttypes.ph @@ -1224,6 +1249,7 @@ ./usr/libdata/perl5/site_perl/sparc64-openbsd/kvm.ph ./usr/libdata/perl5/site_perl/sparc64-openbsd/langinfo.ph ./usr/libdata/perl5/site_perl/sparc64-openbsd/libgen.ph +./usr/libdata/perl5/site_perl/sparc64-openbsd/libintl.ph ./usr/libdata/perl5/site_perl/sparc64-openbsd/libmilter ./usr/libdata/perl5/site_perl/sparc64-openbsd/libmilter/mfapi.ph ./usr/libdata/perl5/site_perl/sparc64-openbsd/libmilter/mfdef.ph diff -uNr --exclude=CVS --exclude=obj src.orig/distrib/sets/lists/base/md.vax src/distrib/sets/lists/base/md.vax --- src.orig/distrib/sets/lists/base/md.vax Fri Jun 19 05:38:16 2009 +++ src/distrib/sets/lists/base/md.vax Thu Jun 18 13:03:21 2009 @@ -1043,6 +1043,7 @@ ./usr/libdata/perl5/site_perl/vax-openbsd/glob.ph ./usr/libdata/perl5/site_perl/vax-openbsd/grp.ph ./usr/libdata/perl5/site_perl/vax-openbsd/histedit.ph +./usr/libdata/perl5/site_perl/vax-openbsd/iconv.ph ./usr/libdata/perl5/site_perl/vax-openbsd/ifaddrs.ph ./usr/libdata/perl5/site_perl/vax-openbsd/inttypes.ph ./usr/libdata/perl5/site_perl/vax-openbsd/iso646.ph @@ -1089,6 +1090,7 @@ ./usr/libdata/perl5/site_perl/vax-openbsd/kvm.ph ./usr/libdata/perl5/site_perl/vax-openbsd/langinfo.ph ./usr/libdata/perl5/site_perl/vax-openbsd/libgen.ph +./usr/libdata/perl5/site_perl/vax-openbsd/libintl.ph ./usr/libdata/perl5/site_perl/vax-openbsd/libmilter ./usr/libdata/perl5/site_perl/vax-openbsd/libmilter/mfapi.ph ./usr/libdata/perl5/site_perl/vax-openbsd/libmilter/mfdef.ph diff -uNr --exclude=CVS --exclude=obj src.orig/distrib/sets/lists/base/md.zaurus src/distrib/sets/lists/base/md.zaurus --- src.orig/distrib/sets/lists/base/md.zaurus Fri Jun 19 05:38:18 2009 +++ src/distrib/sets/lists/base/md.zaurus Thu Jun 18 13:03:21 2009 @@ -60,6 +60,29 @@ ./usr/lib/gcc-lib/arm-unknown-openbsd4.6/3.3.5/collect2 ./usr/lib/gcc-lib/arm-unknown-openbsd4.6/3.3.5/f771 ./usr/lib/gcc-lib/arm-unknown-openbsd4.6/3.3.5/specs +./usr/lib/i18n/libBIG5.so.4.4 +./usr/lib/i18n/libDECHanyu.so.4.4 +./usr/lib/i18n/libEUC.so.4.4 +./usr/lib/i18n/libEUCTW.so.4.4 +./usr/lib/i18n/libGBK2K.so.4.4 +./usr/lib/i18n/libHZ.so.4.4 +./usr/lib/i18n/libISO2022.so.4.4 +./usr/lib/i18n/libJOHAB.so.4.4 +./usr/lib/i18n/libMSKanji.so.4.4 +./usr/lib/i18n/libUES.so.4.4 +./usr/lib/i18n/libUTF1632.so.4.4 +./usr/lib/i18n/libUTF7.so.4. +./usr/lib/i18n/libUTF8.so.4.4 +./usr/lib/i18n/libVIQR.so.4.4 +./usr/lib/i18n/libZW.so.4.4 +./usr/lib/i18n/libiconv_none.so.4.4 +./usr/lib/i18n/libiconv_std.so.4.4 +./usr/lib/i18n/libmapper_646.so.4.4 +./usr/lib/i18n/libmapper_none.so.4.4 +./usr/lib/i18n/libmapper_parallel.so.4.4 +./usr/lib/i18n/libmapper_serial.so.4.4 +./usr/lib/i18n/libmapper_std.so.4.4 +./usr/lib/i18n/libmapper_zone.so.4.4 ./usr/lib/libasn1.so.17.0 ./usr/lib/libc.so.53.0 ./usr/lib/libcom_err.so.17.0 @@ -73,6 +96,7 @@ ./usr/lib/libg2c.so.8.1 ./usr/lib/libgssapi.so.5.0 ./usr/lib/libiberty.so.10.0 +./usr/lib/libintl.so.0.0 ./usr/lib/libkafs.so.17.0 ./usr/lib/libkrb5.so.17.0 ./usr/lib/libkvm.so.9.1 diff -uNr --exclude=CVS --exclude=obj src.orig/distrib/sets/lists/base/mi src/distrib/sets/lists/base/mi --- src.orig/distrib/sets/lists/base/mi Fri Jun 19 05:38:20 2009 +++ src/distrib/sets/lists/base/mi Thu Jun 18 13:03:21 2009 @@ -286,6 +286,7 @@ ./usr/bin/hpftodit ./usr/bin/htdigest ./usr/bin/htpasswd +./usr/bin/iconv ./usr/bin/id ./usr/bin/ident ./usr/bin/indent @@ -318,6 +319,7 @@ ./usr/bin/libnetcfg ./usr/bin/lkbib ./usr/bin/lndir +./usr/bin/locale ./usr/bin/locate ./usr/bin/lock ./usr/bin/logger @@ -343,6 +345,8 @@ ./usr/bin/midicat ./usr/bin/midiplay ./usr/bin/mixerctl +./usr/bin/mkcsmapper +./usr/bin/mkesdb ./usr/bin/mkdep ./usr/bin/mklocale ./usr/bin/mktemp @@ -542,6 +546,7 @@ ./usr/lib/apache/include/xml ./usr/lib/apache/modules ./usr/lib/gcc-lib +./usr/lib/i18n ./usr/libdata ./usr/libdata/cvs ./usr/libdata/cvs/contrib @@ -2579,6 +2584,696 @@ ./usr/share/groff_font/devps/symbolsl.pfa ./usr/share/groff_font/devps/text.enc ./usr/share/groff_font/devps/zapfdr.pfa +./usr/share/i18n +./usr/share/i18n/csmapper +./usr/share/i18n/csmapper/APPLE +./usr/share/i18n/csmapper/APPLE/CELTIC%UCS.mps +./usr/share/i18n/csmapper/APPLE/CENTEURO%UCS.mps +./usr/share/i18n/csmapper/APPLE/CROATIAN%UCS.mps +./usr/share/i18n/csmapper/APPLE/CYRILLIC%UCS.mps +./usr/share/i18n/csmapper/APPLE/DINGBATS%UCS.mps +./usr/share/i18n/csmapper/APPLE/GAELIC%UCS.mps +./usr/share/i18n/csmapper/APPLE/GREEK%UCS.mps +./usr/share/i18n/csmapper/APPLE/ICELAND%UCS.mps +./usr/share/i18n/csmapper/APPLE/INUIT%UCS.mps +./usr/share/i18n/csmapper/APPLE/ROMAN%UCS.mps +./usr/share/i18n/csmapper/APPLE/ROMANIAN%UCS.mps +./usr/share/i18n/csmapper/APPLE/THAI%UCS.mps +./usr/share/i18n/csmapper/APPLE/TURKISH%UCS.mps +./usr/share/i18n/csmapper/APPLE/UCS%CELTIC.mps +./usr/share/i18n/csmapper/APPLE/UCS%CENTEURO.mps +./usr/share/i18n/csmapper/APPLE/UCS%CROATIAN.mps +./usr/share/i18n/csmapper/APPLE/UCS%CYRILLIC.mps +./usr/share/i18n/csmapper/APPLE/UCS%DINGBATS.mps +./usr/share/i18n/csmapper/APPLE/UCS%GAELIC.mps +./usr/share/i18n/csmapper/APPLE/UCS%GREEK.mps +./usr/share/i18n/csmapper/APPLE/UCS%ICELAND.mps +./usr/share/i18n/csmapper/APPLE/UCS%INUIT.mps +./usr/share/i18n/csmapper/APPLE/UCS%ROMAN.mps +./usr/share/i18n/csmapper/APPLE/UCS%ROMANIAN.mps +./usr/share/i18n/csmapper/APPLE/UCS%THAI.mps +./usr/share/i18n/csmapper/APPLE/UCS%TURKISH.mps +./usr/share/i18n/csmapper/AST +./usr/share/i18n/csmapper/AST/ARMSCII-7%UCS.mps +./usr/share/i18n/csmapper/AST/ARMSCII-8%UCS.mps +./usr/share/i18n/csmapper/AST/ARMSCII-8A%UCS.mps +./usr/share/i18n/csmapper/AST/UCS%ARMSCII-7.mps +./usr/share/i18n/csmapper/AST/UCS%ARMSCII-8.mps +./usr/share/i18n/csmapper/AST/UCS%ARMSCII-8A.mps +./usr/share/i18n/csmapper/BIG5 +./usr/share/i18n/csmapper/BIG5/Big5@1984%UCS.mps +./usr/share/i18n/csmapper/BIG5/Big5EXT@2003%UCS.mps +./usr/share/i18n/csmapper/BIG5/Big5EXT@E%UCS.mps +./usr/share/i18n/csmapper/BIG5/Big5EXT@IBM%UCS.mps +./usr/share/i18n/csmapper/BIG5/Big5EXT@Plus%UCS.mps +./usr/share/i18n/csmapper/BIG5/Big5UDA%UCS.mps +./usr/share/i18n/csmapper/BIG5/ETen%UCS@BMP.mps +./usr/share/i18n/csmapper/BIG5/ETen%UCS@SIP.mps +./usr/share/i18n/csmapper/BIG5/HKSCS%UCS@BMP.mps +./usr/share/i18n/csmapper/BIG5/HKSCS%UCS@SIP.mps +./usr/share/i18n/csmapper/BIG5/UCS%Big5@1984.mps +./usr/share/i18n/csmapper/BIG5/UCS%Big5EXT@2003.mps +./usr/share/i18n/csmapper/BIG5/UCS%Big5EXT@E.mps +./usr/share/i18n/csmapper/BIG5/UCS%Big5EXT@IBM.mps +./usr/share/i18n/csmapper/BIG5/UCS%Big5EXT@Plus.mps +./usr/share/i18n/csmapper/BIG5/UCS%Big5UDA.mps +./usr/share/i18n/csmapper/BIG5/UCS@BMP%ETen.mps +./usr/share/i18n/csmapper/BIG5/UCS@BMP%HKSCS.mps +./usr/share/i18n/csmapper/BIG5/UCS@SIP%ETen.mps +./usr/share/i18n/csmapper/BIG5/UCS@SIP%HKSCS.mps +./usr/share/i18n/csmapper/CNS +./usr/share/i18n/csmapper/CNS/CNS11643-1%UCS.mps +./usr/share/i18n/csmapper/CNS/CNS11643-2%UCS.mps +./usr/share/i18n/csmapper/CNS/CNS11643-3%UCS@BMP.mps +./usr/share/i18n/csmapper/CNS/CNS11643-3%UCS@SIP.mps +./usr/share/i18n/csmapper/CNS/CNS11643-4%UCS@BMP.mps +./usr/share/i18n/csmapper/CNS/CNS11643-4%UCS@SIP.mps +./usr/share/i18n/csmapper/CNS/CNS11643-5%UCS@BMP.mps +./usr/share/i18n/csmapper/CNS/CNS11643-5%UCS@SIP.mps +./usr/share/i18n/csmapper/CNS/CNS11643-6%UCS@BMP.mps +./usr/share/i18n/csmapper/CNS/CNS11643-6%UCS@SIP.mps +./usr/share/i18n/csmapper/CNS/CNS11643-7%UCS@BMP.mps +./usr/share/i18n/csmapper/CNS/CNS11643-7%UCS@SIP.mps +./usr/share/i18n/csmapper/CNS/UCS%CNS11643-1.mps +./usr/share/i18n/csmapper/CNS/UCS%CNS11643-2.mps +./usr/share/i18n/csmapper/CNS/UCS@BMP%CNS11643-3.mps +./usr/share/i18n/csmapper/CNS/UCS@BMP%CNS11643-4.mps +./usr/share/i18n/csmapper/CNS/UCS@BMP%CNS11643-5.mps +./usr/share/i18n/csmapper/CNS/UCS@BMP%CNS11643-6.mps +./usr/share/i18n/csmapper/CNS/UCS@BMP%CNS11643-7.mps +./usr/share/i18n/csmapper/CNS/UCS@SIP%CNS11643-3.mps +./usr/share/i18n/csmapper/CNS/UCS@SIP%CNS11643-4.mps +./usr/share/i18n/csmapper/CNS/UCS@SIP%CNS11643-5.mps +./usr/share/i18n/csmapper/CNS/UCS@SIP%CNS11643-6.mps +./usr/share/i18n/csmapper/CNS/UCS@SIP%CNS11643-7.mps +./usr/share/i18n/csmapper/CP +./usr/share/i18n/csmapper/CP/CP037%UCS.mps +./usr/share/i18n/csmapper/CP/CP038%UCS.mps +./usr/share/i18n/csmapper/CP/CP10000%UCS.mps +./usr/share/i18n/csmapper/CP/CP10006%UCS.mps +./usr/share/i18n/csmapper/CP/CP10007%UCS.mps +./usr/share/i18n/csmapper/CP/CP10029%UCS.mps +./usr/share/i18n/csmapper/CP/CP1006%UCS.mps +./usr/share/i18n/csmapper/CP/CP10079%UCS.mps +./usr/share/i18n/csmapper/CP/CP10081%UCS.mps +./usr/share/i18n/csmapper/CP/CP1026%UCS.mps +./usr/share/i18n/csmapper/CP/CP1046%UCS.mps +./usr/share/i18n/csmapper/CP/CP1124%UCS.mps +./usr/share/i18n/csmapper/CP/CP1125%UCS.mps +./usr/share/i18n/csmapper/CP/CP1129%UCS.mps +./usr/share/i18n/csmapper/CP/CP1131%UCS.mps +./usr/share/i18n/csmapper/CP/CP1133%UCS.mps +./usr/share/i18n/csmapper/CP/CP1161%UCS.mps +./usr/share/i18n/csmapper/CP/CP1162%UCS.mps +./usr/share/i18n/csmapper/CP/CP1163%UCS.mps +./usr/share/i18n/csmapper/CP/CP1250%UCS.mps +./usr/share/i18n/csmapper/CP/CP1251%UCS.mps +./usr/share/i18n/csmapper/CP/CP1252%UCS.mps +./usr/share/i18n/csmapper/CP/CP1253%UCS.mps +./usr/share/i18n/csmapper/CP/CP1254%UCS.mps +./usr/share/i18n/csmapper/CP/CP1255%UCS.mps +./usr/share/i18n/csmapper/CP/CP1256%UCS.mps +./usr/share/i18n/csmapper/CP/CP1257%UCS.mps +./usr/share/i18n/csmapper/CP/CP1258%UCS.mps +./usr/share/i18n/csmapper/CP/CP273%UCS.mps +./usr/share/i18n/csmapper/CP/CP274%UCS.mps +./usr/share/i18n/csmapper/CP/CP275%UCS.mps +./usr/share/i18n/csmapper/CP/CP277%UCS.mps +./usr/share/i18n/csmapper/CP/CP278%UCS.mps +./usr/share/i18n/csmapper/CP/CP280%UCS.mps +./usr/share/i18n/csmapper/CP/CP281%UCS.mps +./usr/share/i18n/csmapper/CP/CP284%UCS.mps +./usr/share/i18n/csmapper/CP/CP285%UCS.mps +./usr/share/i18n/csmapper/CP/CP290%UCS.mps +./usr/share/i18n/csmapper/CP/CP297%UCS.mps +./usr/share/i18n/csmapper/CP/CP420%UCS.mps +./usr/share/i18n/csmapper/CP/CP423%UCS.mps +./usr/share/i18n/csmapper/CP/CP424%UCS.mps +./usr/share/i18n/csmapper/CP/CP437%UCS.mps +./usr/share/i18n/csmapper/CP/CP500%UCS.mps +./usr/share/i18n/csmapper/CP/CP737%UCS.mps +./usr/share/i18n/csmapper/CP/CP775%UCS.mps +./usr/share/i18n/csmapper/CP/CP850%UCS.mps +./usr/share/i18n/csmapper/CP/CP851%UCS.mps +./usr/share/i18n/csmapper/CP/CP852%UCS.mps +./usr/share/i18n/csmapper/CP/CP853%UCS.mps +./usr/share/i18n/csmapper/CP/CP855%UCS.mps +./usr/share/i18n/csmapper/CP/CP856%UCS.mps +./usr/share/i18n/csmapper/CP/CP857%UCS.mps +./usr/share/i18n/csmapper/CP/CP858%UCS.mps +./usr/share/i18n/csmapper/CP/CP860%UCS.mps +./usr/share/i18n/csmapper/CP/CP861%UCS.mps +./usr/share/i18n/csmapper/CP/CP862%UCS.mps +./usr/share/i18n/csmapper/CP/CP863%UCS.mps +./usr/share/i18n/csmapper/CP/CP864%UCS.mps +./usr/share/i18n/csmapper/CP/CP865%UCS.mps +./usr/share/i18n/csmapper/CP/CP866%UCS.mps +./usr/share/i18n/csmapper/CP/CP868%UCS.mps +./usr/share/i18n/csmapper/CP/CP869%UCS.mps +./usr/share/i18n/csmapper/CP/CP870%UCS.mps +./usr/share/i18n/csmapper/CP/CP871%UCS.mps +./usr/share/i18n/csmapper/CP/CP874%UCS.mps +./usr/share/i18n/csmapper/CP/CP875%UCS.mps +./usr/share/i18n/csmapper/CP/CP880%UCS.mps +./usr/share/i18n/csmapper/CP/CP891%UCS.mps +./usr/share/i18n/csmapper/CP/CP903%UCS.mps +./usr/share/i18n/csmapper/CP/CP904%UCS.mps +./usr/share/i18n/csmapper/CP/CP905%UCS.mps +./usr/share/i18n/csmapper/CP/CP918%UCS.mps +./usr/share/i18n/csmapper/CP/CP922%UCS.mps +./usr/share/i18n/csmapper/CP/CP932UDA%UCS.mps +./usr/share/i18n/csmapper/CP/CP932VDC@IBM%UCS.mps +./usr/share/i18n/csmapper/CP/CP932VDC@NEC_IBM%UCS.mps +./usr/share/i18n/csmapper/CP/CP936EXT%UCS.mps +./usr/share/i18n/csmapper/CP/CP942EXT%UCS.mps +./usr/share/i18n/csmapper/CP/CP949EXT%UCS.mps +./usr/share/i18n/csmapper/CP/CP950%UCS.mps +./usr/share/i18n/csmapper/CP/UCS%CP037.mps +./usr/share/i18n/csmapper/CP/UCS%CP038.mps +./usr/share/i18n/csmapper/CP/UCS%CP10000.mps +./usr/share/i18n/csmapper/CP/UCS%CP10006.mps +./usr/share/i18n/csmapper/CP/UCS%CP10007.mps +./usr/share/i18n/csmapper/CP/UCS%CP10029.mps +./usr/share/i18n/csmapper/CP/UCS%CP1006.mps +./usr/share/i18n/csmapper/CP/UCS%CP10079.mps +./usr/share/i18n/csmapper/CP/UCS%CP10081.mps +./usr/share/i18n/csmapper/CP/UCS%CP1026.mps +./usr/share/i18n/csmapper/CP/UCS%CP1046.mps +./usr/share/i18n/csmapper/CP/UCS%CP1124.mps +./usr/share/i18n/csmapper/CP/UCS%CP1125.mps +./usr/share/i18n/csmapper/CP/UCS%CP1129.mps +./usr/share/i18n/csmapper/CP/UCS%CP1131.mps +./usr/share/i18n/csmapper/CP/UCS%CP1133.mps +./usr/share/i18n/csmapper/CP/UCS%CP1161.mps +./usr/share/i18n/csmapper/CP/UCS%CP1162.mps +./usr/share/i18n/csmapper/CP/UCS%CP1163.mps +./usr/share/i18n/csmapper/CP/UCS%CP1250.mps +./usr/share/i18n/csmapper/CP/UCS%CP1251.mps +./usr/share/i18n/csmapper/CP/UCS%CP1252.mps +./usr/share/i18n/csmapper/CP/UCS%CP1253.mps +./usr/share/i18n/csmapper/CP/UCS%CP1254.mps +./usr/share/i18n/csmapper/CP/UCS%CP1255.mps +./usr/share/i18n/csmapper/CP/UCS%CP1256.mps +./usr/share/i18n/csmapper/CP/UCS%CP1257.mps +./usr/share/i18n/csmapper/CP/UCS%CP1258.mps +./usr/share/i18n/csmapper/CP/UCS%CP273.mps +./usr/share/i18n/csmapper/CP/UCS%CP274.mps +./usr/share/i18n/csmapper/CP/UCS%CP275.mps +./usr/share/i18n/csmapper/CP/UCS%CP277.mps +./usr/share/i18n/csmapper/CP/UCS%CP278.mps +./usr/share/i18n/csmapper/CP/UCS%CP280.mps +./usr/share/i18n/csmapper/CP/UCS%CP281.mps +./usr/share/i18n/csmapper/CP/UCS%CP284.mps +./usr/share/i18n/csmapper/CP/UCS%CP285.mps +./usr/share/i18n/csmapper/CP/UCS%CP290.mps +./usr/share/i18n/csmapper/CP/UCS%CP297.mps +./usr/share/i18n/csmapper/CP/UCS%CP420.mps +./usr/share/i18n/csmapper/CP/UCS%CP423.mps +./usr/share/i18n/csmapper/CP/UCS%CP424.mps +./usr/share/i18n/csmapper/CP/UCS%CP437.mps +./usr/share/i18n/csmapper/CP/UCS%CP500.mps +./usr/share/i18n/csmapper/CP/UCS%CP737.mps +./usr/share/i18n/csmapper/CP/UCS%CP775.mps +./usr/share/i18n/csmapper/CP/UCS%CP850.mps +./usr/share/i18n/csmapper/CP/UCS%CP851.mps +./usr/share/i18n/csmapper/CP/UCS%CP852.mps +./usr/share/i18n/csmapper/CP/UCS%CP853.mps +./usr/share/i18n/csmapper/CP/UCS%CP855.mps +./usr/share/i18n/csmapper/CP/UCS%CP856.mps +./usr/share/i18n/csmapper/CP/UCS%CP857.mps +./usr/share/i18n/csmapper/CP/UCS%CP858.mps +./usr/share/i18n/csmapper/CP/UCS%CP860.mps +./usr/share/i18n/csmapper/CP/UCS%CP861.mps +./usr/share/i18n/csmapper/CP/UCS%CP862.mps +./usr/share/i18n/csmapper/CP/UCS%CP863.mps +./usr/share/i18n/csmapper/CP/UCS%CP864.mps +./usr/share/i18n/csmapper/CP/UCS%CP865.mps +./usr/share/i18n/csmapper/CP/UCS%CP866.mps +./usr/share/i18n/csmapper/CP/UCS%CP868.mps +./usr/share/i18n/csmapper/CP/UCS%CP869.mps +./usr/share/i18n/csmapper/CP/UCS%CP870.mps +./usr/share/i18n/csmapper/CP/UCS%CP871.mps +./usr/share/i18n/csmapper/CP/UCS%CP874.mps +./usr/share/i18n/csmapper/CP/UCS%CP875.mps +./usr/share/i18n/csmapper/CP/UCS%CP880.mps +./usr/share/i18n/csmapper/CP/UCS%CP891.mps +./usr/share/i18n/csmapper/CP/UCS%CP903.mps +./usr/share/i18n/csmapper/CP/UCS%CP904.mps +./usr/share/i18n/csmapper/CP/UCS%CP905.mps +./usr/share/i18n/csmapper/CP/UCS%CP918.mps +./usr/share/i18n/csmapper/CP/UCS%CP922.mps +./usr/share/i18n/csmapper/CP/UCS%CP932UDA.mps +./usr/share/i18n/csmapper/CP/UCS%CP932VDC@IBM.mps +./usr/share/i18n/csmapper/CP/UCS%CP932VDC@NEC_IBM.mps +./usr/share/i18n/csmapper/CP/UCS%CP936EXT.mps +./usr/share/i18n/csmapper/CP/UCS%CP942EXT.mps +./usr/share/i18n/csmapper/CP/UCS%CP949EXT.mps +./usr/share/i18n/csmapper/CP/UCS%CP950.mps +./usr/share/i18n/csmapper/EBCDIC +./usr/share/i18n/csmapper/EBCDIC/EBCDIC-AT-DE%UCS.mps +./usr/share/i18n/csmapper/EBCDIC/EBCDIC-AT-DE-A%UCS.mps +./usr/share/i18n/csmapper/EBCDIC/EBCDIC-CA-FR%UCS.mps +./usr/share/i18n/csmapper/EBCDIC/EBCDIC-DK-NO%UCS.mps +./usr/share/i18n/csmapper/EBCDIC/EBCDIC-DK-NO-A%UCS.mps +./usr/share/i18n/csmapper/EBCDIC/EBCDIC-ES%UCS.mps +./usr/share/i18n/csmapper/EBCDIC/EBCDIC-ES-A%UCS.mps +./usr/share/i18n/csmapper/EBCDIC/EBCDIC-ES-S%UCS.mps +./usr/share/i18n/csmapper/EBCDIC/EBCDIC-FI-SE%UCS.mps +./usr/share/i18n/csmapper/EBCDIC/EBCDIC-FI-SE-A%UCS.mps +./usr/share/i18n/csmapper/EBCDIC/EBCDIC-FR%UCS.mps +./usr/share/i18n/csmapper/EBCDIC/EBCDIC-IT%UCS.mps +./usr/share/i18n/csmapper/EBCDIC/EBCDIC-PT%UCS.mps +./usr/share/i18n/csmapper/EBCDIC/EBCDIC-UK%UCS.mps +./usr/share/i18n/csmapper/EBCDIC/UCS%EBCDIC-AT-DE-A.mps +./usr/share/i18n/csmapper/EBCDIC/UCS%EBCDIC-AT-DE.mps +./usr/share/i18n/csmapper/EBCDIC/UCS%EBCDIC-CA-FR.mps +./usr/share/i18n/csmapper/EBCDIC/UCS%EBCDIC-DK-NO-A.mps +./usr/share/i18n/csmapper/EBCDIC/UCS%EBCDIC-DK-NO.mps +./usr/share/i18n/csmapper/EBCDIC/UCS%EBCDIC-ES-A.mps +./usr/share/i18n/csmapper/EBCDIC/UCS%EBCDIC-ES-S.mps +./usr/share/i18n/csmapper/EBCDIC/UCS%EBCDIC-ES.mps +./usr/share/i18n/csmapper/EBCDIC/UCS%EBCDIC-FI-SE-A.mps +./usr/share/i18n/csmapper/EBCDIC/UCS%EBCDIC-FI-SE.mps +./usr/share/i18n/csmapper/EBCDIC/UCS%EBCDIC-FR.mps +./usr/share/i18n/csmapper/EBCDIC/UCS%EBCDIC-IT.mps +./usr/share/i18n/csmapper/EBCDIC/UCS%EBCDIC-PT.mps +./usr/share/i18n/csmapper/EBCDIC/UCS%EBCDIC-UK.mps +./usr/share/i18n/csmapper/GB +./usr/share/i18n/csmapper/GB/GB12345%UCS.mps +./usr/share/i18n/csmapper/GB/GB18030%UCS@BMP.mps +./usr/share/i18n/csmapper/GB/GB2312%UCS.mps +./usr/share/i18n/csmapper/GB/GB2312EXT%UCS.mps +./usr/share/i18n/csmapper/GB/GB2312UDA1%UCS.mps +./usr/share/i18n/csmapper/GB/GB2312UDA2%UCS.mps +./usr/share/i18n/csmapper/GB/GBKEXT%UCS.mps +./usr/share/i18n/csmapper/GB/GBKUDA%UCS.mps +./usr/share/i18n/csmapper/GB/ISO-IR-165EXT%UCS.mps +./usr/share/i18n/csmapper/GB/UCS%GB12345.mps +./usr/share/i18n/csmapper/GB/UCS%GB2312.mps +./usr/share/i18n/csmapper/GB/UCS%GB2312EXT.mps +./usr/share/i18n/csmapper/GB/UCS%GB2312UDA1.mps +./usr/share/i18n/csmapper/GB/UCS%GB2312UDA2.mps +./usr/share/i18n/csmapper/GB/UCS%GBKEXT.mps +./usr/share/i18n/csmapper/GB/UCS%GBKUDA.mps +./usr/share/i18n/csmapper/GB/UCS%ISO-IR-165EXT.mps +./usr/share/i18n/csmapper/GB/UCS@BMP%GB18030.mps +./usr/share/i18n/csmapper/GEORGIAN +./usr/share/i18n/csmapper/GEORGIAN/GEORGIAN-ACADEMY%UCS.mps +./usr/share/i18n/csmapper/GEORGIAN/GEORGIAN-ACADEMY@OldCapital%UCS.mps +./usr/share/i18n/csmapper/GEORGIAN/GEORGIAN-PS%UCS.mps +./usr/share/i18n/csmapper/GEORGIAN/GEORGIAN-PS@OldCapital%UCS.mps +./usr/share/i18n/csmapper/GEORGIAN/UCS%GEORGIAN-ACADEMY.mps +./usr/share/i18n/csmapper/GEORGIAN/UCS%GEORGIAN-ACADEMY@OldCapital.mps +./usr/share/i18n/csmapper/GEORGIAN/UCS%GEORGIAN-PS.mps +./usr/share/i18n/csmapper/GEORGIAN/UCS%GEORGIAN-PS@OldCapital.mps +./usr/share/i18n/csmapper/ISO-8859 +./usr/share/i18n/csmapper/ISO-8859/ISO-8859-10%UCS.mps +./usr/share/i18n/csmapper/ISO-8859/ISO-8859-11%UCS.mps +./usr/share/i18n/csmapper/ISO-8859/ISO-8859-13%UCS.mps +./usr/share/i18n/csmapper/ISO-8859/ISO-8859-14%UCS.mps +./usr/share/i18n/csmapper/ISO-8859/ISO-8859-15%UCS.mps +./usr/share/i18n/csmapper/ISO-8859/ISO-8859-16%UCS.mps +./usr/share/i18n/csmapper/ISO-8859/ISO-8859-2%UCS.mps +./usr/share/i18n/csmapper/ISO-8859/ISO-8859-3%UCS.mps +./usr/share/i18n/csmapper/ISO-8859/ISO-8859-4%UCS.mps +./usr/share/i18n/csmapper/ISO-8859/ISO-8859-5%UCS.mps +./usr/share/i18n/csmapper/ISO-8859/ISO-8859-6%UCS.mps +./usr/share/i18n/csmapper/ISO-8859/ISO-8859-7%UCS.mps +./usr/share/i18n/csmapper/ISO-8859/ISO-8859-8%UCS.mps +./usr/share/i18n/csmapper/ISO-8859/ISO-8859-9%UCS.mps +./usr/share/i18n/csmapper/ISO-8859/UCS%ISO-8859-10.mps +./usr/share/i18n/csmapper/ISO-8859/UCS%ISO-8859-11.mps +./usr/share/i18n/csmapper/ISO-8859/UCS%ISO-8859-13.mps +./usr/share/i18n/csmapper/ISO-8859/UCS%ISO-8859-14.mps +./usr/share/i18n/csmapper/ISO-8859/UCS%ISO-8859-15.mps +./usr/share/i18n/csmapper/ISO-8859/UCS%ISO-8859-16.mps +./usr/share/i18n/csmapper/ISO-8859/UCS%ISO-8859-2.mps +./usr/share/i18n/csmapper/ISO-8859/UCS%ISO-8859-3.mps +./usr/share/i18n/csmapper/ISO-8859/UCS%ISO-8859-4.mps +./usr/share/i18n/csmapper/ISO-8859/UCS%ISO-8859-5.mps +./usr/share/i18n/csmapper/ISO-8859/UCS%ISO-8859-6.mps +./usr/share/i18n/csmapper/ISO-8859/UCS%ISO-8859-7.mps +./usr/share/i18n/csmapper/ISO-8859/UCS%ISO-8859-8.mps +./usr/share/i18n/csmapper/ISO-8859/UCS%ISO-8859-9.mps +./usr/share/i18n/csmapper/ISO646 +./usr/share/i18n/csmapper/ISO646/ISO646-BASIC@1983%UCS.646 +./usr/share/i18n/csmapper/ISO646/ISO646-CA%UCS.646 +./usr/share/i18n/csmapper/ISO646/ISO646-CA2%UCS.646 +./usr/share/i18n/csmapper/ISO646/ISO646-CN%UCS.646 +./usr/share/i18n/csmapper/ISO646/ISO646-CU%UCS.646 +./usr/share/i18n/csmapper/ISO646/ISO646-DE%UCS.646 +./usr/share/i18n/csmapper/ISO646/ISO646-DK%UCS.646 +./usr/share/i18n/csmapper/ISO646/ISO646-ES%UCS.646 +./usr/share/i18n/csmapper/ISO646/ISO646-ES2%UCS.646 +./usr/share/i18n/csmapper/ISO646/ISO646-FR%UCS.646 +./usr/share/i18n/csmapper/ISO646/ISO646-FR1%UCS.646 +./usr/share/i18n/csmapper/ISO646/ISO646-GB%UCS.646 +./usr/share/i18n/csmapper/ISO646/ISO646-HU%UCS.646 +./usr/share/i18n/csmapper/ISO646/ISO646-IRV@1983%UCS.646 +./usr/share/i18n/csmapper/ISO646/ISO646-IT%UCS.646 +./usr/share/i18n/csmapper/ISO646/ISO646-JP%UCS.646 +./usr/share/i18n/csmapper/ISO646/ISO646-JP-OCR-B%UCS.646 +./usr/share/i18n/csmapper/ISO646/ISO646-KR%UCS.646 +./usr/share/i18n/csmapper/ISO646/ISO646-NO%UCS.646 +./usr/share/i18n/csmapper/ISO646/ISO646-NO2%UCS.646 +./usr/share/i18n/csmapper/ISO646/ISO646-PT%UCS.646 +./usr/share/i18n/csmapper/ISO646/ISO646-PT2%UCS.646 +./usr/share/i18n/csmapper/ISO646/ISO646-SE%UCS.646 +./usr/share/i18n/csmapper/ISO646/ISO646-SE2%UCS.646 +./usr/share/i18n/csmapper/ISO646/ISO646-US%UCS.646 +./usr/share/i18n/csmapper/ISO646/ISO646-YU%UCS.646 +./usr/share/i18n/csmapper/JIS +./usr/share/i18n/csmapper/JIS/JISX0201-KANA%UCS.mps +./usr/share/i18n/csmapper/JIS/JISX0208@1978%UCS.mps +./usr/share/i18n/csmapper/JIS/JISX0208@1990%UCS.mps +./usr/share/i18n/csmapper/JIS/JISX0208@MS%UCS.mps +./usr/share/i18n/csmapper/JIS/JISX0208UDC%UCS.mps +./usr/share/i18n/csmapper/JIS/JISX0208VDC@NEC%UCS.mps +./usr/share/i18n/csmapper/JIS/JISX0212%UCS.mps +./usr/share/i18n/csmapper/JIS/JISX0212@MS%UCS.mps +./usr/share/i18n/csmapper/JIS/JISX0212UDC%UCS.mps +./usr/share/i18n/csmapper/JIS/JISX0212VDC@IBM%UCS.mps +./usr/share/i18n/csmapper/JIS/JISX0213-1%UCS@BMP.mps +./usr/share/i18n/csmapper/JIS/JISX0213-1%UCS@SIP.mps +./usr/share/i18n/csmapper/JIS/JISX0213-2%UCS@BMP.mps +./usr/share/i18n/csmapper/JIS/JISX0213-2%UCS@SIP.mps +./usr/share/i18n/csmapper/JIS/UCS%JISX0201-KANA.mps +./usr/share/i18n/csmapper/JIS/UCS%JISX0208@1978.mps +./usr/share/i18n/csmapper/JIS/UCS%JISX0208@1990.mps +./usr/share/i18n/csmapper/JIS/UCS%JISX0208@MS.mps +./usr/share/i18n/csmapper/JIS/UCS%JISX0208UDC.mps +./usr/share/i18n/csmapper/JIS/UCS%JISX0208VDC@NEC.mps +./usr/share/i18n/csmapper/JIS/UCS%JISX0212.mps +./usr/share/i18n/csmapper/JIS/UCS%JISX0212@MS.mps +./usr/share/i18n/csmapper/JIS/UCS%JISX0212UDC.mps +./usr/share/i18n/csmapper/JIS/UCS%JISX0212VDC@IBM.mps +./usr/share/i18n/csmapper/JIS/UCS@BMP%JISX0213-1.mps +./usr/share/i18n/csmapper/JIS/UCS@BMP%JISX0213-2.mps +./usr/share/i18n/csmapper/JIS/UCS@SIP%JISX0213-1.mps +./usr/share/i18n/csmapper/JIS/UCS@SIP%JISX0213-2.mps +./usr/share/i18n/csmapper/KAZAKH +./usr/share/i18n/csmapper/KAZAKH/KZ1048%UCS.mps +./usr/share/i18n/csmapper/KAZAKH/PTCP154%UCS.mps +./usr/share/i18n/csmapper/KAZAKH/UCS%KZ1048.mps +./usr/share/i18n/csmapper/KAZAKH/UCS%PTCP154.mps +./usr/share/i18n/csmapper/KOI +./usr/share/i18n/csmapper/KOI/GOST19768-74%UCS.mps +./usr/share/i18n/csmapper/KOI/ISO-5427%UCS.mps +./usr/share/i18n/csmapper/KOI/KOI7%UCS.mps +./usr/share/i18n/csmapper/KOI/KOI8%UCS.mps +./usr/share/i18n/csmapper/KOI/KOI8-C%UCS.mps +./usr/share/i18n/csmapper/KOI/KOI8-E%UCS.mps +./usr/share/i18n/csmapper/KOI/KOI8-R%UCS.mps +./usr/share/i18n/csmapper/KOI/KOI8-RU%UCS.mps +./usr/share/i18n/csmapper/KOI/KOI8-T%UCS.mps +./usr/share/i18n/csmapper/KOI/KOI8-U%UCS.mps +./usr/share/i18n/csmapper/KOI/UCS%GOST19768-74.mps +./usr/share/i18n/csmapper/KOI/UCS%ISO-5427.mps +./usr/share/i18n/csmapper/KOI/UCS%KOI7.mps +./usr/share/i18n/csmapper/KOI/UCS%KOI8-C.mps +./usr/share/i18n/csmapper/KOI/UCS%KOI8-E.mps +./usr/share/i18n/csmapper/KOI/UCS%KOI8-R.mps +./usr/share/i18n/csmapper/KOI/UCS%KOI8-RU.mps +./usr/share/i18n/csmapper/KOI/UCS%KOI8-T.mps +./usr/share/i18n/csmapper/KOI/UCS%KOI8-U.mps +./usr/share/i18n/csmapper/KOI/UCS%KOI8.mps +./usr/share/i18n/csmapper/KS +./usr/share/i18n/csmapper/KS/JOHAB%UCS.mps +./usr/share/i18n/csmapper/KS/KSC5601HANGUL%UCS.mps +./usr/share/i18n/csmapper/KS/KSC5601HANJA%UCS.mps +./usr/share/i18n/csmapper/KS/UCS%JOHAB.mps +./usr/share/i18n/csmapper/KS/UCS%KSC5601HANGUL.mps +./usr/share/i18n/csmapper/KS/UCS%KSC5601HANJA.mps +./usr/share/i18n/csmapper/MISC +./usr/share/i18n/csmapper/MISC/ATARIST%UCS.mps +./usr/share/i18n/csmapper/MISC/DECMCS%UCS.mps +./usr/share/i18n/csmapper/MISC/HP-ROMAN8%UCS.mps +./usr/share/i18n/csmapper/MISC/MULELAO-1%UCS.mps +./usr/share/i18n/csmapper/MISC/NEXTSTEP%UCS.mps +./usr/share/i18n/csmapper/MISC/RISCOS-LATIN1%UCS.mps +./usr/share/i18n/csmapper/MISC/TDS565%UCS.mps +./usr/share/i18n/csmapper/MISC/UCS%ATARIST.mps +./usr/share/i18n/csmapper/MISC/UCS%DECMCS.mps +./usr/share/i18n/csmapper/MISC/UCS%HP-ROMAN8.mps +./usr/share/i18n/csmapper/MISC/UCS%MULELAO-1.mps +./usr/share/i18n/csmapper/MISC/UCS%NEXTSTEP.mps +./usr/share/i18n/csmapper/MISC/UCS%RISCOS-LATIN1.mps +./usr/share/i18n/csmapper/MISC/UCS%TDS565.mps +./usr/share/i18n/csmapper/TCVN +./usr/share/i18n/csmapper/TCVN/TCVN5712-1%UCS.mps +./usr/share/i18n/csmapper/TCVN/UCS%TCVN5712-1.mps +./usr/share/i18n/csmapper/TCVN/UCS%VISCII.mps +./usr/share/i18n/csmapper/TCVN/VISCII%UCS.mps +./usr/share/i18n/csmapper/charset.pivot +./usr/share/i18n/csmapper/charset.pivot.pvdb +./usr/share/i18n/csmapper/mapper.dir +./usr/share/i18n/csmapper/mapper.dir.db +./usr/share/i18n/esdb +./usr/share/i18n/esdb/APPLE +./usr/share/i18n/esdb/APPLE/MACCELTIC.esdb +./usr/share/i18n/esdb/APPLE/MACCENTEURO.esdb +./usr/share/i18n/esdb/APPLE/MACCROATIAN.esdb +./usr/share/i18n/esdb/APPLE/MACCYRILLIC.esdb +./usr/share/i18n/esdb/APPLE/MACDINGBATS.esdb +./usr/share/i18n/esdb/APPLE/MACGAELIC.esdb +./usr/share/i18n/esdb/APPLE/MACGREEK.esdb +./usr/share/i18n/esdb/APPLE/MACICELAND.esdb +./usr/share/i18n/esdb/APPLE/MACINUIT.esdb +./usr/share/i18n/esdb/APPLE/MACROMAN.esdb +./usr/share/i18n/esdb/APPLE/MACROMANIAN.esdb +./usr/share/i18n/esdb/APPLE/MACTHAI.esdb +./usr/share/i18n/esdb/APPLE/MACTURKISH.esdb +./usr/share/i18n/esdb/AST +./usr/share/i18n/esdb/AST/ARMSCII-7.esdb +./usr/share/i18n/esdb/AST/ARMSCII-8.esdb +./usr/share/i18n/esdb/AST/ARMSCII-8A.esdb +./usr/share/i18n/esdb/BIG5 +./usr/share/i18n/esdb/BIG5/Big5-2003.esdb +./usr/share/i18n/esdb/BIG5/Big5-E.esdb +./usr/share/i18n/esdb/BIG5/Big5-ETen.esdb +./usr/share/i18n/esdb/BIG5/Big5-HKSCS.esdb +./usr/share/i18n/esdb/BIG5/Big5-IBM.esdb +./usr/share/i18n/esdb/BIG5/Big5-Plus.esdb +./usr/share/i18n/esdb/CP +./usr/share/i18n/esdb/CP/CP037.esdb +./usr/share/i18n/esdb/CP/CP038.esdb +./usr/share/i18n/esdb/CP/CP10000.esdb +./usr/share/i18n/esdb/CP/CP10006.esdb +./usr/share/i18n/esdb/CP/CP10007.esdb +./usr/share/i18n/esdb/CP/CP10029.esdb +./usr/share/i18n/esdb/CP/CP1006.esdb +./usr/share/i18n/esdb/CP/CP10079.esdb +./usr/share/i18n/esdb/CP/CP10081.esdb +./usr/share/i18n/esdb/CP/CP1026.esdb +./usr/share/i18n/esdb/CP/CP1046.esdb +./usr/share/i18n/esdb/CP/CP1124.esdb +./usr/share/i18n/esdb/CP/CP1125.esdb +./usr/share/i18n/esdb/CP/CP1129.esdb +./usr/share/i18n/esdb/CP/CP1131.esdb +./usr/share/i18n/esdb/CP/CP1161.esdb +./usr/share/i18n/esdb/CP/CP1162.esdb +./usr/share/i18n/esdb/CP/CP1163.esdb +./usr/share/i18n/esdb/CP/CP1133.esdb +./usr/share/i18n/esdb/CP/CP1250.esdb +./usr/share/i18n/esdb/CP/CP1251.esdb +./usr/share/i18n/esdb/CP/CP1252.esdb +./usr/share/i18n/esdb/CP/CP1253.esdb +./usr/share/i18n/esdb/CP/CP1254.esdb +./usr/share/i18n/esdb/CP/CP1255.esdb +./usr/share/i18n/esdb/CP/CP1256.esdb +./usr/share/i18n/esdb/CP/CP1257.esdb +./usr/share/i18n/esdb/CP/CP1258.esdb +./usr/share/i18n/esdb/CP/CP273.esdb +./usr/share/i18n/esdb/CP/CP274.esdb +./usr/share/i18n/esdb/CP/CP275.esdb +./usr/share/i18n/esdb/CP/CP277.esdb +./usr/share/i18n/esdb/CP/CP278.esdb +./usr/share/i18n/esdb/CP/CP280.esdb +./usr/share/i18n/esdb/CP/CP281.esdb +./usr/share/i18n/esdb/CP/CP284.esdb +./usr/share/i18n/esdb/CP/CP285.esdb +./usr/share/i18n/esdb/CP/CP290.esdb +./usr/share/i18n/esdb/CP/CP297.esdb +./usr/share/i18n/esdb/CP/CP420.esdb +./usr/share/i18n/esdb/CP/CP423.esdb +./usr/share/i18n/esdb/CP/CP424.esdb +./usr/share/i18n/esdb/CP/CP437.esdb +./usr/share/i18n/esdb/CP/CP500.esdb +./usr/share/i18n/esdb/CP/CP50220.esdb +./usr/share/i18n/esdb/CP/CP50221.esdb +./usr/share/i18n/esdb/CP/CP50222.esdb +./usr/share/i18n/esdb/CP/CP51932.esdb +./usr/share/i18n/esdb/CP/CP737.esdb +./usr/share/i18n/esdb/CP/CP775.esdb +./usr/share/i18n/esdb/CP/CP850.esdb +./usr/share/i18n/esdb/CP/CP851.esdb +./usr/share/i18n/esdb/CP/CP852.esdb +./usr/share/i18n/esdb/CP/CP853.esdb +./usr/share/i18n/esdb/CP/CP855.esdb +./usr/share/i18n/esdb/CP/CP856.esdb +./usr/share/i18n/esdb/CP/CP857.esdb +./usr/share/i18n/esdb/CP/CP858.esdb +./usr/share/i18n/esdb/CP/CP860.esdb +./usr/share/i18n/esdb/CP/CP861.esdb +./usr/share/i18n/esdb/CP/CP862.esdb +./usr/share/i18n/esdb/CP/CP863.esdb +./usr/share/i18n/esdb/CP/CP864.esdb +./usr/share/i18n/esdb/CP/CP865.esdb +./usr/share/i18n/esdb/CP/CP866.esdb +./usr/share/i18n/esdb/CP/CP868.esdb +./usr/share/i18n/esdb/CP/CP869.esdb +./usr/share/i18n/esdb/CP/CP870.esdb +./usr/share/i18n/esdb/CP/CP871.esdb +./usr/share/i18n/esdb/CP/CP874.esdb +./usr/share/i18n/esdb/CP/CP875.esdb +./usr/share/i18n/esdb/CP/CP880.esdb +./usr/share/i18n/esdb/CP/CP891.esdb +./usr/share/i18n/esdb/CP/CP903.esdb +./usr/share/i18n/esdb/CP/CP904.esdb +./usr/share/i18n/esdb/CP/CP905.esdb +./usr/share/i18n/esdb/CP/CP918.esdb +./usr/share/i18n/esdb/CP/CP922.esdb +./usr/share/i18n/esdb/CP/CP932.esdb +./usr/share/i18n/esdb/CP/CP936.esdb +./usr/share/i18n/esdb/CP/CP942.esdb +./usr/share/i18n/esdb/CP/CP942C.esdb +./usr/share/i18n/esdb/CP/CP943.esdb +./usr/share/i18n/esdb/CP/CP943C.esdb +./usr/share/i18n/esdb/CP/CP949.esdb +./usr/share/i18n/esdb/CP/CP950.esdb +./usr/share/i18n/esdb/DEC +./usr/share/i18n/esdb/DEC/DECHanyu.esdb +./usr/share/i18n/esdb/DEC/DECMCS.esdb +./usr/share/i18n/esdb/EBCDIC +./usr/share/i18n/esdb/EBCDIC/EBCDIC-AT-DE-A.esdb +./usr/share/i18n/esdb/EBCDIC/EBCDIC-AT-DE.esdb +./usr/share/i18n/esdb/EBCDIC/EBCDIC-CA-FR.esdb +./usr/share/i18n/esdb/EBCDIC/EBCDIC-DK-NO-A.esdb +./usr/share/i18n/esdb/EBCDIC/EBCDIC-DK-NO.esdb +./usr/share/i18n/esdb/EBCDIC/EBCDIC-ES-A.esdb +./usr/share/i18n/esdb/EBCDIC/EBCDIC-ES-S.esdb +./usr/share/i18n/esdb/EBCDIC/EBCDIC-ES.esdb +./usr/share/i18n/esdb/EBCDIC/EBCDIC-FI-SE-A.esdb +./usr/share/i18n/esdb/EBCDIC/EBCDIC-FI-SE.esdb +./usr/share/i18n/esdb/EBCDIC/EBCDIC-FR.esdb +./usr/share/i18n/esdb/EBCDIC/EBCDIC-IT.esdb +./usr/share/i18n/esdb/EBCDIC/EBCDIC-PT.esdb +./usr/share/i18n/esdb/EBCDIC/EBCDIC-UK.esdb +./usr/share/i18n/esdb/EUC +./usr/share/i18n/esdb/EUC/EUC-CN.esdb +./usr/share/i18n/esdb/EUC/EUC-JIS-2004.esdb +./usr/share/i18n/esdb/EUC/EUC-JP-MS.esdb +./usr/share/i18n/esdb/EUC/EUC-JP.esdb +./usr/share/i18n/esdb/EUC/EUC-KR.esdb +./usr/share/i18n/esdb/EUC/EUC-TW.esdb +./usr/share/i18n/esdb/GB +./usr/share/i18n/esdb/GB/GB12345.esdb +./usr/share/i18n/esdb/GB/GB18030.esdb +./usr/share/i18n/esdb/GB/GBK.esdb +./usr/share/i18n/esdb/GEORGIAN +./usr/share/i18n/esdb/GEORGIAN/GEORGIAN-ACADEMY-OldCapital.esdb +./usr/share/i18n/esdb/GEORGIAN/GEORGIAN-ACADEMY.esdb +./usr/share/i18n/esdb/GEORGIAN/GEORGIAN-PS-OldCapital.esdb +./usr/share/i18n/esdb/GEORGIAN/GEORGIAN-PS.esdb +./usr/share/i18n/esdb/ISO-2022 +./usr/share/i18n/esdb/ISO-2022/ISO-2022-CN-EXT.esdb +./usr/share/i18n/esdb/ISO-2022/ISO-2022-CN.esdb +./usr/share/i18n/esdb/ISO-2022/ISO-2022-JP-1.esdb +./usr/share/i18n/esdb/ISO-2022/ISO-2022-JP-2.esdb +./usr/share/i18n/esdb/ISO-2022/ISO-2022-JP-2004.esdb +./usr/share/i18n/esdb/ISO-2022/ISO-2022-JP.esdb +./usr/share/i18n/esdb/ISO-2022/ISO-2022-KR.esdb +./usr/share/i18n/esdb/ISO-8859 +./usr/share/i18n/esdb/ISO-8859/ISO-8859-1.esdb +./usr/share/i18n/esdb/ISO-8859/ISO-8859-10.esdb +./usr/share/i18n/esdb/ISO-8859/ISO-8859-11.esdb +./usr/share/i18n/esdb/ISO-8859/ISO-8859-13.esdb +./usr/share/i18n/esdb/ISO-8859/ISO-8859-14.esdb +./usr/share/i18n/esdb/ISO-8859/ISO-8859-15.esdb +./usr/share/i18n/esdb/ISO-8859/ISO-8859-16.esdb +./usr/share/i18n/esdb/ISO-8859/ISO-8859-2.esdb +./usr/share/i18n/esdb/ISO-8859/ISO-8859-3.esdb +./usr/share/i18n/esdb/ISO-8859/ISO-8859-4.esdb +./usr/share/i18n/esdb/ISO-8859/ISO-8859-5.esdb +./usr/share/i18n/esdb/ISO-8859/ISO-8859-6.esdb +./usr/share/i18n/esdb/ISO-8859/ISO-8859-7.esdb +./usr/share/i18n/esdb/ISO-8859/ISO-8859-8.esdb +./usr/share/i18n/esdb/ISO-8859/ISO-8859-9.esdb +./usr/share/i18n/esdb/ISO646 +./usr/share/i18n/esdb/ISO646/ISO646-BASIC@1983.esdb +./usr/share/i18n/esdb/ISO646/ISO646-CA.esdb +./usr/share/i18n/esdb/ISO646/ISO646-CA2.esdb +./usr/share/i18n/esdb/ISO646/ISO646-CN.esdb +./usr/share/i18n/esdb/ISO646/ISO646-CU.esdb +./usr/share/i18n/esdb/ISO646/ISO646-DE.esdb +./usr/share/i18n/esdb/ISO646/ISO646-DK.esdb +./usr/share/i18n/esdb/ISO646/ISO646-ES.esdb +./usr/share/i18n/esdb/ISO646/ISO646-ES2.esdb +./usr/share/i18n/esdb/ISO646/ISO646-FR.esdb +./usr/share/i18n/esdb/ISO646/ISO646-FR1.esdb +./usr/share/i18n/esdb/ISO646/ISO646-GB.esdb +./usr/share/i18n/esdb/ISO646/ISO646-HU.esdb +./usr/share/i18n/esdb/ISO646/ISO646-IRV@1983.esdb +./usr/share/i18n/esdb/ISO646/ISO646-IT.esdb +./usr/share/i18n/esdb/ISO646/ISO646-JP-OCR-B.esdb +./usr/share/i18n/esdb/ISO646/ISO646-JP.esdb +./usr/share/i18n/esdb/ISO646/ISO646-KR.esdb +./usr/share/i18n/esdb/ISO646/ISO646-NO.esdb +./usr/share/i18n/esdb/ISO646/ISO646-NO2.esdb +./usr/share/i18n/esdb/ISO646/ISO646-PT.esdb +./usr/share/i18n/esdb/ISO646/ISO646-PT2.esdb +./usr/share/i18n/esdb/ISO646/ISO646-SE.esdb +./usr/share/i18n/esdb/ISO646/ISO646-SE2.esdb +./usr/share/i18n/esdb/ISO646/ISO646-US.esdb +./usr/share/i18n/esdb/ISO646/ISO646-YU.esdb +./usr/share/i18n/esdb/KAZAKH +./usr/share/i18n/esdb/KAZAKH/KZ1048.esdb +./usr/share/i18n/esdb/KAZAKH/PTCP154.esdb +./usr/share/i18n/esdb/KOI +./usr/share/i18n/esdb/KOI/KOI7-switched.esdb +./usr/share/i18n/esdb/KOI/KOI7.esdb +./usr/share/i18n/esdb/KOI/KOI8-C.esdb +./usr/share/i18n/esdb/KOI/KOI8-E.esdb +./usr/share/i18n/esdb/KOI/KOI8-R.esdb +./usr/share/i18n/esdb/KOI/KOI8-RU.esdb +./usr/share/i18n/esdb/KOI/KOI8-T.esdb +./usr/share/i18n/esdb/KOI/KOI8-U.esdb +./usr/share/i18n/esdb/KOI/KOI8.esdb +./usr/share/i18n/esdb/MISC +./usr/share/i18n/esdb/MISC/ATARIST.esdb +./usr/share/i18n/esdb/MISC/C99.esdb +./usr/share/i18n/esdb/MISC/CTEXT.esdb +./usr/share/i18n/esdb/MISC/HP-ROMAN8.esdb +./usr/share/i18n/esdb/MISC/HZ.esdb +./usr/share/i18n/esdb/MISC/HZ8.esdb +./usr/share/i18n/esdb/MISC/JAVA.esdb +./usr/share/i18n/esdb/MISC/JOHAB.esdb +./usr/share/i18n/esdb/MISC/MULELAO-1.esdb +./usr/share/i18n/esdb/MISC/NEXTSTEP.esdb +./usr/share/i18n/esdb/MISC/RISCOS-LATIN1.esdb +./usr/share/i18n/esdb/MISC/Shift_JIS-2004.esdb +./usr/share/i18n/esdb/MISC/Shift_JIS.esdb +./usr/share/i18n/esdb/MISC/TDS565.esdb +./usr/share/i18n/esdb/MISC/ZW.esdb +./usr/share/i18n/esdb/TCVN +./usr/share/i18n/esdb/TCVN/TCVN5712-1.esdb +./usr/share/i18n/esdb/TCVN/VIQR.esdb +./usr/share/i18n/esdb/TCVN/VISCII.esdb +./usr/share/i18n/esdb/UTF +./usr/share/i18n/esdb/UTF/UTF-16.esdb +./usr/share/i18n/esdb/UTF/UTF-16BE.esdb +./usr/share/i18n/esdb/UTF/UTF-16LE.esdb +./usr/share/i18n/esdb/UTF/UTF-32.esdb +./usr/share/i18n/esdb/UTF/UTF-32BE.esdb +./usr/share/i18n/esdb/UTF/UTF-32LE.esdb +./usr/share/i18n/esdb/UTF/UTF-7.esdb +./usr/share/i18n/esdb/UTF/UTF-8.esdb +./usr/share/i18n/esdb/esdb.alias +./usr/share/i18n/esdb/esdb.alias.db +./usr/share/i18n/esdb/esdb.dir +./usr/share/i18n/esdb/esdb.dir.db +./usr/share/i18n/iconv +./usr/share/i18n/iconv/iconv.dir ./usr/share/info ./usr/share/lkm ./usr/share/lkm/misc @@ -2588,6 +3283,14 @@ ./usr/share/lkm/syscall/module ./usr/share/lkm/syscall/test ./usr/share/locale +./usr/share/locale/af_ZA.ISO8859-1 +./usr/share/locale/af_ZA.ISO8859-1/LC_CTYPE +./usr/share/locale/af_ZA.ISO8859-15 +./usr/share/locale/af_ZA.ISO8859-15/LC_CTYPE +./usr/share/locale/be_BY.CP1251 +./usr/share/locale/be_BY.CP1251/LC_CTYPE +./usr/share/locale/be_BY.ISO8859-5 +./usr/share/locale/be_BY.ISO8859-5/LC_CTYPE ./usr/share/locale/bg_BG.CP1251 ./usr/share/locale/bg_BG.CP1251/LC_CTYPE ./usr/share/locale/ca_ES.ISO8859-1 @@ -2600,7 +3303,6 @@ ./usr/share/locale/da_DK.ISO8859-1/LC_CTYPE ./usr/share/locale/da_DK.ISO8859-15 ./usr/share/locale/da_DK.ISO8859-15/LC_CTYPE -./usr/share/locale/de_AT ./usr/share/locale/de_AT.ISO8859-1 ./usr/share/locale/de_AT.ISO8859-1/LC_CTYPE ./usr/share/locale/de_AT.ISO8859-15 @@ -2627,15 +3329,26 @@ ./usr/share/locale/en_GB.ISO8859-1/LC_CTYPE ./usr/share/locale/en_GB.ISO8859-15 ./usr/share/locale/en_GB.ISO8859-15/LC_CTYPE +./usr/share/locale/en_NZ.ISO8859-1 +./usr/share/locale/en_NZ.ISO8859-1/LC_CTYPE +./usr/share/locale/en_NZ.ISO8859-15 +./usr/share/locale/en_NZ.ISO8859-15/LC_CTYPE ./usr/share/locale/en_US.ISO8859-1 ./usr/share/locale/en_US.ISO8859-1/LC_CTYPE ./usr/share/locale/en_US.ISO8859-15 ./usr/share/locale/en_US.ISO8859-15/LC_CTYPE ./usr/share/locale/en_US.UTF-8 +./usr/share/locale/en_US.UTF-8/LC_CTYPE ./usr/share/locale/es_ES.ISO8859-1 ./usr/share/locale/es_ES.ISO8859-1/LC_CTYPE ./usr/share/locale/es_ES.ISO8859-15 ./usr/share/locale/es_ES.ISO8859-15/LC_CTYPE +./usr/share/locale/et_EE.ISO8859-15 +./usr/share/locale/et_EE.ISO8859-15/LC_CTYPE +./usr/share/locale/eu_ES.ISO8859-1 +./usr/share/locale/eu_ES.ISO8859-1/LC_CTYPE +./usr/share/locale/eu_ES.ISO8859-15 +./usr/share/locale/eu_ES.ISO8859-15/LC_CTYPE ./usr/share/locale/fi_FI.ISO8859-1 ./usr/share/locale/fi_FI.ISO8859-1/LC_CTYPE ./usr/share/locale/fi_FI.ISO8859-15 @@ -2675,12 +3388,20 @@ ./usr/share/locale/it_IT.ISO8859-15 ./usr/share/locale/it_IT.ISO8859-15/LC_CTYPE ./usr/share/locale/ja_JP.ISO2022-JP +./usr/share/locale/ja_JP.ISO2022-JP/LC_CTYPE ./usr/share/locale/ja_JP.ISO2022-JP2 +./usr/share/locale/ja_JP.ISO2022-JP2/LC_CTYPE ./usr/share/locale/ja_JP.SJIS +./usr/share/locale/ja_JP.SJIS/LC_CTYPE ./usr/share/locale/ja_JP.ct +./usr/share/locale/ja_JP.ct/LC_CTYPE ./usr/share/locale/ja_JP.eucJP -./usr/share/locale/ko_KR.UTF-8 +./usr/share/locale/ja_JP.eucJP/LC_CTYPE +./usr/share/locale/kk_KZ.PT154 +./usr/share/locale/kk_KZ.PT154/LC_CTYPE ./usr/share/locale/ko_KR.eucKR +./usr/share/locale/ko_KR.eucKR/LC_CTYPE +./usr/share/locale/locale.alias ./usr/share/locale/lt_LT.ISO8859-13 ./usr/share/locale/lt_LT.ISO8859-13/LC_CTYPE ./usr/share/locale/lt_LT.ISO8859-4 @@ -2693,16 +3414,28 @@ ./usr/share/locale/nl_NL.ISO8859-1/LC_CTYPE ./usr/share/locale/nl_NL.ISO8859-15 ./usr/share/locale/nl_NL.ISO8859-15/LC_CTYPE +./usr/share/locale/nn_NO.ISO8859-1 +./usr/share/locale/nn_NO.ISO8859-1/LC_CTYPE +./usr/share/locale/nn_NO.ISO8859-15 +./usr/share/locale/nn_NO.ISO8859-15/LC_CTYPE ./usr/share/locale/no_NO.ISO8859-1 ./usr/share/locale/no_NO.ISO8859-1/LC_CTYPE ./usr/share/locale/no_NO.ISO8859-15 ./usr/share/locale/no_NO.ISO8859-15/LC_CTYPE ./usr/share/locale/pl_PL.ISO8859-2 ./usr/share/locale/pl_PL.ISO8859-2/LC_CTYPE +./usr/share/locale/pt_BR.ISO8859-1 +./usr/share/locale/pt_BR.ISO8859-1/LC_CTYPE ./usr/share/locale/pt_PT.ISO8859-1 ./usr/share/locale/pt_PT.ISO8859-1/LC_CTYPE ./usr/share/locale/pt_PT.ISO8859-15 ./usr/share/locale/pt_PT.ISO8859-15/LC_CTYPE +./usr/share/locale/ro_RO.ISO8859-2 +./usr/share/locale/ro_RO.ISO8859-2/LC_CTYPE +./usr/share/locale/ru_BY.CP1251 +./usr/share/locale/ru_BY.CP1251/LC_CTYPE +./usr/share/locale/ru_RU.CP1251 +./usr/share/locale/ru_RU.CP1251/LC_CTYPE ./usr/share/locale/ru_RU.CP866 ./usr/share/locale/ru_RU.CP866/LC_CTYPE ./usr/share/locale/ru_RU.ISO8859-5 @@ -2713,17 +3446,32 @@ ./usr/share/locale/sk_SK.ISO8859-2/LC_CTYPE ./usr/share/locale/sl_SI.ISO8859-2 ./usr/share/locale/sl_SI.ISO8859-2/LC_CTYPE +./usr/share/locale/sr_YU.ISO8859-2 +./usr/share/locale/sr_YU.ISO8859-2/LC_CTYPE +./usr/share/locale/sr_YU.ISO8859-5 +./usr/share/locale/sr_YU.ISO8859-5/LC_CTYPE ./usr/share/locale/sv_SE.ISO8859-1 ./usr/share/locale/sv_SE.ISO8859-1/LC_CTYPE ./usr/share/locale/sv_SE.ISO8859-15 ./usr/share/locale/sv_SE.ISO8859-15/LC_CTYPE +./usr/share/locale/tr_TR.ISO8859-9 +./usr/share/locale/tr_TR.ISO8859-9/LC_CTYPE +./usr/share/locale/uk_UA.CP1251 +./usr/share/locale/uk_UA.CP1251/LC_CTYPE +./usr/share/locale/uk_UA.ISO8859-5 +./usr/share/locale/uk_UA.ISO8859-5/LC_CTYPE ./usr/share/locale/uk_UA.KOI8-U ./usr/share/locale/uk_UA.KOI8-U/LC_CTYPE ./usr/share/locale/zh_CN.GB18030 +./usr/share/locale/zh_CN.GB18030/LC_CTYPE ./usr/share/locale/zh_CN.eucCN -./usr/share/locale/zh_TW.BIG5 +./usr/share/locale/zh_CN.eucCN/LC_CTYPE +./usr/share/locale/zh_HK.Big5-HKSCS +./usr/share/locale/zh_HK.Big5-HKSCS/LC_CTYPE ./usr/share/locale/zh_TW.Big5 +./usr/share/locale/zh_TW.Big5/LC_CTYPE ./usr/share/locale/zh_TW.eucTW +./usr/share/locale/zh_TW.eucTW/LC_CTYPE ./usr/share/man ./usr/share/man/COPYRIGHT ./usr/share/man/cat1 @@ -2805,6 +3553,7 @@ ./usr/share/nls/it/libc.cat ./usr/share/nls/nl ./usr/share/nls/nl/libc.cat +./usr/share/nls/nls.alias ./usr/share/nls/no ./usr/share/nls/no/libc.cat ./usr/share/nls/ru diff -uNr --exclude=CVS --exclude=obj src.orig/distrib/sets/lists/comp/md.alpha src/distrib/sets/lists/comp/md.alpha --- src.orig/distrib/sets/lists/comp/md.alpha Tue Apr 28 15:19:07 2009 +++ src/distrib/sets/lists/comp/md.alpha Thu Jun 18 13:03:21 2009 @@ -213,6 +213,28 @@ ./usr/lib/gcc-lib/alpha-unknown-openbsd4.6/3.3.5/f771 ./usr/lib/gcc-lib/alpha-unknown-openbsd4.6/3.3.5/include/unwind.h ./usr/lib/gcc-lib/alpha-unknown-openbsd4.6/3.3.5/libgcc.a +./usr/lib/i18n/libBIG5_pic.a +./usr/lib/i18n/libDECHanyu_pic.a +./usr/lib/i18n/libEUC_pic.a +./usr/lib/i18n/libEUCTW_pic.a +./usr/lib/i18n/libGBK2K_pic.a +./usr/lib/i18n/libHZ_pic.a +./usr/lib/i18n/libISO2022_pic.a +./usr/lib/i18n/libJOHAB_pic.a +./usr/lib/i18n/libMSKanji_pic.a +./usr/lib/i18n/libUES_pic.a +./usr/lib/i18n/libUTF1632_pic.a +./usr/lib/i18n/libUTF7_pic.a +./usr/lib/i18n/libUTF8_pic.a +./usr/lib/i18n/libZW_pic.a +./usr/lib/i18n/libiconv_none_pic.a +./usr/lib/i18n/libiconv_std_pic.a +./usr/lib/i18n/libmapper_646_pic.a +./usr/lib/i18n/libmapper_none_pic.a +./usr/lib/i18n/libmapper_parallel_pic.a +./usr/lib/i18n/libmapper_serial_pic.a +./usr/lib/i18n/libmapper_std_pic.a +./usr/lib/i18n/libmapper_zone_pic.a ./usr/lib/libalpha.a ./usr/lib/libalpha_p.a ./usr/lib/libasn1_pic.a @@ -229,6 +251,7 @@ ./usr/lib/libg2c_pic.a ./usr/lib/libgssapi_pic.a ./usr/lib/libiberty_pic.a +./usr/lib/libintl_pic.a ./usr/lib/libkadm5clnt_pic.a ./usr/lib/libkadm5srv_pic.a ./usr/lib/libkafs_pic.a diff -uNr --exclude=CVS --exclude=obj src.orig/distrib/sets/lists/comp/md.amd64 src/distrib/sets/lists/comp/md.amd64 --- src.orig/distrib/sets/lists/comp/md.amd64 Tue Apr 28 15:19:07 2009 +++ src/distrib/sets/lists/comp/md.amd64 Thu Jun 18 13:03:21 2009 @@ -245,6 +245,29 @@ ./usr/lib/gcc-lib/amd64-unknown-openbsd4.6/3.3.5/include/unwind.h ./usr/lib/gcc-lib/amd64-unknown-openbsd4.6/3.3.5/include/xmmintrin.h ./usr/lib/gcc-lib/amd64-unknown-openbsd4.6/3.3.5/libgcc.a +./usr/lib/i18n/libBIG5_pic.a +./usr/lib/i18n/libDECHanyu_pic.a +./usr/lib/i18n/libEUC_pic.a +./usr/lib/i18n/libEUCTW_pic.a +./usr/lib/i18n/libGBK2K_pic.a +./usr/lib/i18n/libHZ_pic.a +./usr/lib/i18n/libISO2022_pic.a +./usr/lib/i18n/libJOHAB_pic.a +./usr/lib/i18n/libMSKanji_pic.a +./usr/lib/i18n/libUES_pic.a +./usr/lib/i18n/libUTF1632_pic.a +./usr/lib/i18n/libUTF7_pic. +./usr/lib/i18n/libUTF8_pic.a +./usr/lib/i18n/libVIQR_pic.a +./usr/lib/i18n/libZW_pic.a +./usr/lib/i18n/libiconv_none_pic.a +./usr/lib/i18n/libiconv_std_pic.a +./usr/lib/i18n/libmapper_646_pic.a +./usr/lib/i18n/libmapper_none_pic.a +./usr/lib/i18n/libmapper_parallel_pic.a +./usr/lib/i18n/libmapper_serial_pic.a +./usr/lib/i18n/libmapper_std_pic.a +./usr/lib/i18n/libmapper_zone_pic.a ./usr/lib/libamd64.a ./usr/lib/libamd64_p.a ./usr/lib/libasn1_pic.a @@ -261,6 +284,7 @@ ./usr/lib/libg2c_pic.a ./usr/lib/libgssapi_pic.a ./usr/lib/libiberty_pic.a +./usr/lib/libintl_pic.a ./usr/lib/libkadm5clnt_pic.a ./usr/lib/libkadm5srv_pic.a ./usr/lib/libkafs_pic.a diff -uNr --exclude=CVS --exclude=obj src.orig/distrib/sets/lists/comp/md.armish src/distrib/sets/lists/comp/md.armish --- src.orig/distrib/sets/lists/comp/md.armish Tue Apr 28 15:19:08 2009 +++ src/distrib/sets/lists/comp/md.armish Thu Jun 18 13:03:21 2009 @@ -252,6 +252,28 @@ ./usr/lib/gcc-lib/arm-unknown-openbsd4.6/3.3.5/include ./usr/lib/gcc-lib/arm-unknown-openbsd4.6/3.3.5/include/unwind.h ./usr/lib/gcc-lib/arm-unknown-openbsd4.6/3.3.5/libgcc.a +./usr/lib/i18n/libBIG5_pic.a +./usr/lib/i18n/libDECHanyu_pic.a +./usr/lib/i18n/libEUC_pic.a +./usr/lib/i18n/libEUCTW_pic.a +./usr/lib/i18n/libGBK2K_pic.a +./usr/lib/i18n/libHZ_pic.a +./usr/lib/i18n/libISO2022_pic.a +./usr/lib/i18n/libJOHAB_pic.a +./usr/lib/i18n/libMSKanji_pic.a +./usr/lib/i18n/libUES_pic.a +./usr/lib/i18n/libUTF1632_pic.a +./usr/lib/i18n/libUTF7_pic.a +./usr/lib/i18n/libUTF8_pic.a +./usr/lib/i18n/libZW_pic.a +./usr/lib/i18n/libiconv_none_pic.a +./usr/lib/i18n/libiconv_std_pic.a +./usr/lib/i18n/libmapper_646_pic.a +./usr/lib/i18n/libmapper_none_pic.a +./usr/lib/i18n/libmapper_parallel_pic.a +./usr/lib/i18n/libmapper_serial_pic.a +./usr/lib/i18n/libmapper_std_pic.a +./usr/lib/i18n/libmapper_zone_pic.a ./usr/lib/libarm.a ./usr/lib/libarm_p.a ./usr/lib/libasn1_pic.a @@ -268,6 +290,7 @@ ./usr/lib/libg2c_pic.a ./usr/lib/libgssapi_pic.a ./usr/lib/libiberty_pic.a +./usr/lib/libintl_pic.a ./usr/lib/libkadm5clnt_pic.a ./usr/lib/libkadm5srv_pic.a ./usr/lib/libkafs_pic.a diff -uNr --exclude=CVS --exclude=obj src.orig/distrib/sets/lists/comp/md.hp300 src/distrib/sets/lists/comp/md.hp300 --- src.orig/distrib/sets/lists/comp/md.hp300 Tue Apr 28 15:19:08 2009 +++ src/distrib/sets/lists/comp/md.hp300 Thu Jun 18 13:03:21 2009 @@ -204,6 +204,29 @@ ./usr/lib/gcc-lib/m68k-unknown-openbsd4.6/2.95.3/include/syslimits.h ./usr/lib/gcc-lib/m68k-unknown-openbsd4.6/2.95.3/include/typeinfo ./usr/lib/gcc-lib/m68k-unknown-openbsd4.6/2.95.3/libgcc.a +./usr/lib/i18n/libBIG5_pic.a +./usr/lib/i18n/libDECHanyu_pic.a +./usr/lib/i18n/libEUC_pic.a +./usr/lib/i18n/libEUCTW_pic.a +./usr/lib/i18n/libGBK2K_pic.a +./usr/lib/i18n/libHZ_pic.a +./usr/lib/i18n/libISO2022_pic.a +./usr/lib/i18n/libJOHAB_pic.a +./usr/lib/i18n/libMSKanji_pic.a +./usr/lib/i18n/libUES_pic.a +./usr/lib/i18n/libUTF1632_pic.a +./usr/lib/i18n/libUTF7_pic.a +./usr/lib/i18n/libUTF8_pic.a +./usr/lib/i18n/libVIQR_pic.a +./usr/lib/i18n/libZW_pic.a +./usr/lib/i18n/libiconv_none_pic.a +./usr/lib/i18n/libiconv_std_pic.a +./usr/lib/i18n/libmapper_646_pic.a +./usr/lib/i18n/libmapper_none_pic.a +./usr/lib/i18n/libmapper_parallel_pic.a +./usr/lib/i18n/libmapper_serial_pic.a +./usr/lib/i18n/libmapper_std_pic.a +./usr/lib/i18n/libmapper_zone_pic.a ./usr/lib/libasn1_pic.a ./usr/lib/libc_pic.a ./usr/lib/libcom_err_pic.a @@ -218,6 +241,7 @@ ./usr/lib/libg2c_pic.a ./usr/lib/libgssapi_pic.a ./usr/lib/libiberty_pic.a +./usr/lib/libintl_pic.a ./usr/lib/libkadm5clnt_pic.a ./usr/lib/libkadm5srv_pic.a ./usr/lib/libkafs_pic.a diff -uNr --exclude=CVS --exclude=obj src.orig/distrib/sets/lists/comp/md.hppa src/distrib/sets/lists/comp/md.hppa --- src.orig/distrib/sets/lists/comp/md.hppa Tue Apr 28 15:19:08 2009 +++ src/distrib/sets/lists/comp/md.hppa Thu Jun 18 13:03:21 2009 @@ -213,6 +213,29 @@ ./usr/lib/gcc-lib/hppa-unknown-openbsd4.6/3.3.5/include ./usr/lib/gcc-lib/hppa-unknown-openbsd4.6/3.3.5/include/unwind.h ./usr/lib/gcc-lib/hppa-unknown-openbsd4.6/3.3.5/libgcc.a +./usr/lib/i18n/libBIG5_pic.a +./usr/lib/i18n/libDECHanyu_pic.a +./usr/lib/i18n/libEUC_pic.a +./usr/lib/i18n/libEUCTW_pic.a +./usr/lib/i18n/libGBK2K_pic.a +./usr/lib/i18n/libHZ_pic.a +./usr/lib/i18n/libISO2022_pic.a +./usr/lib/i18n/libJOHAB_pic.a +./usr/lib/i18n/libMSKanji_pic.a +./usr/lib/i18n/libUES_pic.a +./usr/lib/i18n/libUTF1632_pic.a +./usr/lib/i18n/libUTF7_pic.a +./usr/lib/i18n/libUTF8_pic.a +./usr/lib/i18n/libVIQR_pic.a +./usr/lib/i18n/libZW_pic.a +./usr/lib/i18n/libiconv_none_pic.a +./usr/lib/i18n/libiconv_std_pic.a +./usr/lib/i18n/libmapper_646_pic.a +./usr/lib/i18n/libmapper_none_pic.a +./usr/lib/i18n/libmapper_parallel_pic.a +./usr/lib/i18n/libmapper_serial_pic.a +./usr/lib/i18n/libmapper_std_pic.a +./usr/lib/i18n/libmapper_zone_pic.a ./usr/lib/libasn1_pic.a ./usr/lib/libc_pic.a ./usr/lib/libcom_err_pic.a @@ -227,6 +250,7 @@ ./usr/lib/libg2c_pic.a ./usr/lib/libgssapi_pic.a ./usr/lib/libiberty_pic.a +./usr/lib/libintl_pic.a ./usr/lib/libkadm5clnt_pic.a ./usr/lib/libkadm5srv_pic.a ./usr/lib/libkafs_pic.a diff -uNr --exclude=CVS --exclude=obj src.orig/distrib/sets/lists/comp/md.hppa64 src/distrib/sets/lists/comp/md.hppa64 --- src.orig/distrib/sets/lists/comp/md.hppa64 Tue Apr 28 15:19:08 2009 +++ src/distrib/sets/lists/comp/md.hppa64 Thu Jun 18 13:03:21 2009 @@ -212,6 +212,29 @@ ./usr/lib/gcc-lib/hppa64-unknown-openbsd4.6/3.3.5/include ./usr/lib/gcc-lib/hppa64-unknown-openbsd4.6/3.3.5/include/unwind.h ./usr/lib/gcc-lib/hppa64-unknown-openbsd4.6/3.3.5/libgcc.a +./usr/lib/i18n/libBIG5_pic.a +./usr/lib/i18n/libDECHanyu_pic.a +./usr/lib/i18n/libEUC_pic.a +./usr/lib/i18n/libEUCTW_pic.a +./usr/lib/i18n/libGBK2K_pic.a +./usr/lib/i18n/libHZ_pic.a +./usr/lib/i18n/libISO2022_pic.a +./usr/lib/i18n/libJOHAB_pic.a +./usr/lib/i18n/libMSKanji_pic.a +./usr/lib/i18n/libUES_pic.a +./usr/lib/i18n/libUTF1632_pic.a +./usr/lib/i18n/libUTF7_pic.a +./usr/lib/i18n/libUTF8_pic.a +./usr/lib/i18n/libVIQR_pic.a +./usr/lib/i18n/libZW_pic.a +./usr/lib/i18n/libiconv_none_pic.a +./usr/lib/i18n/libiconv_std_pic.a +./usr/lib/i18n/libmapper_646_pic.a +./usr/lib/i18n/libmapper_none_pic.a +./usr/lib/i18n/libmapper_parallel_pic.a +./usr/lib/i18n/libmapper_serial_pic.a +./usr/lib/i18n/libmapper_std_pic.a +./usr/lib/i18n/libmapper_zone_pic.a ./usr/lib/libasn1_pic.a ./usr/lib/libc_pic.a ./usr/lib/libcom_err_pic.a @@ -226,6 +249,7 @@ ./usr/lib/libg2c_pic.a ./usr/lib/libgssapi_pic.a ./usr/lib/libiberty_pic.a +./usr/lib/libintl_pic.a ./usr/lib/libkadm5clnt_pic.a ./usr/lib/libkadm5srv_pic.a ./usr/lib/libkafs_pic.a diff -uNr --exclude=CVS --exclude=obj src.orig/distrib/sets/lists/comp/md.i386 src/distrib/sets/lists/comp/md.i386 --- src.orig/distrib/sets/lists/comp/md.i386 Tue Apr 28 15:19:08 2009 +++ src/distrib/sets/lists/comp/md.i386 Thu Jun 18 13:03:21 2009 @@ -246,6 +246,29 @@ ./usr/lib/gcc-lib/i386-unknown-openbsd4.6/3.3.5/include/unwind.h ./usr/lib/gcc-lib/i386-unknown-openbsd4.6/3.3.5/include/xmmintrin.h ./usr/lib/gcc-lib/i386-unknown-openbsd4.6/3.3.5/libgcc.a +./usr/lib/i18n/libBIG5_pic.a +./usr/lib/i18n/libDECHanyu_pic.a +./usr/lib/i18n/libEUC_pic.a +./usr/lib/i18n/libEUCTW_pic.a +./usr/lib/i18n/libGBK2K_pic.a +./usr/lib/i18n/libHZ_pic.a +./usr/lib/i18n/libISO2022_pic.a +./usr/lib/i18n/libJOHAB_pic.a +./usr/lib/i18n/libMSKanji_pic.a +./usr/lib/i18n/libUES_pic.a +./usr/lib/i18n/libUTF1632_pic.a +./usr/lib/i18n/libUTF7_pic.a +./usr/lib/i18n/libUTF8_pic.a +./usr/lib/i18n/libVIQR_pic.a +./usr/lib/i18n/libZW_pic.a +./usr/lib/i18n/libiconv_none_pic.a +./usr/lib/i18n/libiconv_std_pic.a +./usr/lib/i18n/libmapper_646_pic.a +./usr/lib/i18n/libmapper_none_pic.a +./usr/lib/i18n/libmapper_parallel_pic.a +./usr/lib/i18n/libmapper_serial_pic.a +./usr/lib/i18n/libmapper_std_pic.a +./usr/lib/i18n/libmapper_zone_pic.a ./usr/lib/libasn1_pic.a ./usr/lib/libc_pic.a ./usr/lib/libcom_err_pic.a @@ -262,6 +285,7 @@ ./usr/lib/libi386.a ./usr/lib/libi386_p.a ./usr/lib/libiberty_pic.a +./usr/lib/libintl_pic.a ./usr/lib/libkadm5clnt_pic.a ./usr/lib/libkadm5srv_pic.a ./usr/lib/libkafs_pic.a diff -uNr --exclude=CVS --exclude=obj src.orig/distrib/sets/lists/comp/md.landisk src/distrib/sets/lists/comp/md.landisk --- src.orig/distrib/sets/lists/comp/md.landisk Tue Apr 28 15:19:08 2009 +++ src/distrib/sets/lists/comp/md.landisk Thu Jun 18 13:03:21 2009 @@ -267,6 +267,28 @@ ./usr/lib/gcc-lib/sh-unknown-openbsd4.6/3.3.5/include/unwind.h ./usr/lib/gcc-lib/sh-unknown-openbsd4.6/3.3.5/libgcc.a ./usr/lib/gcc-lib/sh-unknown-openbsd4.6/3.3.5/specs +./usr/lib/i18n/libBIG5_pic.a +./usr/lib/i18n/libDECHanyu_pic.a +./usr/lib/i18n/libEUC_pic.a +./usr/lib/i18n/libEUCTW_pic.a +./usr/lib/i18n/libGBK2K_pic.a +./usr/lib/i18n/libHZ_pic.a +./usr/lib/i18n/libISO2022_pic.a +./usr/lib/i18n/libJOHAB_pic.a +./usr/lib/i18n/libMSKanji_pic.a +./usr/lib/i18n/libUES_pic.a +./usr/lib/i18n/libUTF1632_pic.a +./usr/lib/i18n/libUTF7_pic.a +./usr/lib/i18n/libUTF8_pic.a +./usr/lib/i18n/libZW_pic.a +./usr/lib/i18n/libiconv_none_pic.a +./usr/lib/i18n/libiconv_std_pic.a +./usr/lib/i18n/libmapper_646_pic.a +./usr/lib/i18n/libmapper_none_pic.a +./usr/lib/i18n/libmapper_parallel_pic.a +./usr/lib/i18n/libmapper_serial_pic.a +./usr/lib/i18n/libmapper_std_pic.a +./usr/lib/i18n/libmapper_zone_pic.a ./usr/lib/libasn1_pic.a ./usr/lib/libc_pic.a ./usr/lib/libcom_err_pic.a @@ -281,6 +303,7 @@ ./usr/lib/libg2c_pic.a ./usr/lib/libgssapi_pic.a ./usr/lib/libiberty_pic.a +./usr/lib/libintl_pic.a ./usr/lib/libkadm5clnt_pic.a ./usr/lib/libkadm5srv_pic.a ./usr/lib/libkafs_pic.a diff -uNr --exclude=CVS --exclude=obj src.orig/distrib/sets/lists/comp/md.mac68k src/distrib/sets/lists/comp/md.mac68k --- src.orig/distrib/sets/lists/comp/md.mac68k Tue Apr 28 15:19:08 2009 +++ src/distrib/sets/lists/comp/md.mac68k Thu Jun 18 13:03:21 2009 @@ -207,6 +207,29 @@ ./usr/lib/gcc-lib/m68k-unknown-openbsd4.6/2.95.3/include/syslimits.h ./usr/lib/gcc-lib/m68k-unknown-openbsd4.6/2.95.3/include/typeinfo ./usr/lib/gcc-lib/m68k-unknown-openbsd4.6/2.95.3/libgcc.a +./usr/lib/i18n/libBIG5_pic.a +./usr/lib/i18n/libDECHanyu_pic.a +./usr/lib/i18n/libEUC_pic.a +./usr/lib/i18n/libEUCTW_pic.a +./usr/lib/i18n/libGBK2K_pic.a +./usr/lib/i18n/libHZ_pic.a +./usr/lib/i18n/libISO2022_pic.a +./usr/lib/i18n/libJOHAB_pic.a +./usr/lib/i18n/libMSKanji_pic.a +./usr/lib/i18n/libUES_pic.a +./usr/lib/i18n/libUTF1632_pic.a +./usr/lib/i18n/libUTF7_pic. +./usr/lib/i18n/libUTF8_pic.a +./usr/lib/i18n/libVIQR_pic.a +./usr/lib/i18n/libZW_pic.a +./usr/lib/i18n/libiconv_none_pic.a +./usr/lib/i18n/libiconv_std_pic.a +./usr/lib/i18n/libmapper_646_pic.a +./usr/lib/i18n/libmapper_none_pic.a +./usr/lib/i18n/libmapper_parallel_pic.a +./usr/lib/i18n/libmapper_serial_pic.a +./usr/lib/i18n/libmapper_std_pic.a +./usr/lib/i18n/libmapper_zone_pic.a ./usr/lib/libasn1_pic.a ./usr/lib/libc_pic.a ./usr/lib/libcom_err_pic.a @@ -221,6 +244,7 @@ ./usr/lib/libg2c_pic.a ./usr/lib/libgssapi_pic.a ./usr/lib/libiberty_pic.a +./usr/lib/libintl_pic.a ./usr/lib/libkadm5clnt_pic.a ./usr/lib/libkadm5srv_pic.a ./usr/lib/libkafs_pic.a diff -uNr --exclude=CVS --exclude=obj src.orig/distrib/sets/lists/comp/md.macppc src/distrib/sets/lists/comp/md.macppc --- src.orig/distrib/sets/lists/comp/md.macppc Tue Apr 28 15:19:08 2009 +++ src/distrib/sets/lists/comp/md.macppc Thu Jun 18 13:03:21 2009 @@ -257,6 +257,29 @@ ./usr/lib/gcc-lib/powerpc-unknown-openbsd4.6/3.3.5/nof ./usr/lib/gcc-lib/powerpc-unknown-openbsd4.6/3.3.5/nof/crtsavres.o ./usr/lib/gcc-lib/powerpc-unknown-openbsd4.6/3.3.5/nof/libgcc.a +./usr/lib/i18n/libBIG5_pic.a +./usr/lib/i18n/libDECHanyu_pic.a +./usr/lib/i18n/libEUC_pic.a +./usr/lib/i18n/libEUCTW_pic.a +./usr/lib/i18n/libGBK2K_pic.a +./usr/lib/i18n/libHZ_pic.a +./usr/lib/i18n/libISO2022_pic.a +./usr/lib/i18n/libJOHAB_pic.a +./usr/lib/i18n/libMSKanji_pic.a +./usr/lib/i18n/libUES_pic.a +./usr/lib/i18n/libUTF1632_pic.a +./usr/lib/i18n/libUTF7_pic.a +./usr/lib/i18n/libUTF8_pic.a +./usr/lib/i18n/libVIQR_pic.a +./usr/lib/i18n/libZW_pic.a +./usr/lib/i18n/libiconv_none_pic.a +./usr/lib/i18n/libiconv_std_pic.a +./usr/lib/i18n/libmapper_646_pic.a +./usr/lib/i18n/libmapper_none_pic.a +./usr/lib/i18n/libmapper_parallel_pic.a +./usr/lib/i18n/libmapper_serial_pic.a +./usr/lib/i18n/libmapper_std_pic.a +./usr/lib/i18n/libmapper_zone_pic.a ./usr/lib/libasn1_pic.a ./usr/lib/libc_pic.a ./usr/lib/libcom_err_pic.a @@ -271,6 +294,7 @@ ./usr/lib/libg2c_pic.a ./usr/lib/libgssapi_pic.a ./usr/lib/libiberty_pic.a +./usr/lib/libintl_pic.a ./usr/lib/libkadm5clnt_pic.a ./usr/lib/libkadm5srv_pic.a ./usr/lib/libkafs_pic.a diff -uNr --exclude=CVS --exclude=obj src.orig/distrib/sets/lists/comp/md.mvme68k src/distrib/sets/lists/comp/md.mvme68k --- src.orig/distrib/sets/lists/comp/md.mvme68k Tue Apr 28 15:19:08 2009 +++ src/distrib/sets/lists/comp/md.mvme68k Thu Jun 18 13:03:21 2009 @@ -206,6 +206,29 @@ ./usr/lib/gcc-lib/m68k-unknown-openbsd4.6/2.95.3/include/syslimits.h ./usr/lib/gcc-lib/m68k-unknown-openbsd4.6/2.95.3/include/typeinfo ./usr/lib/gcc-lib/m68k-unknown-openbsd4.6/2.95.3/libgcc.a +./usr/lib/i18n/libBIG5_pic.a +./usr/lib/i18n/libDECHanyu_pic.a +./usr/lib/i18n/libEUC_pic.a +./usr/lib/i18n/libEUCTW_pic.a +./usr/lib/i18n/libGBK2K_pic.a +./usr/lib/i18n/libHZ_pic.a +./usr/lib/i18n/libISO2022_pic.a +./usr/lib/i18n/libJOHAB_pic.a +./usr/lib/i18n/libMSKanji_pic.a +./usr/lib/i18n/libUES_pic.a +./usr/lib/i18n/libUTF1632_pic.a +./usr/lib/i18n/libUTF7_pic.a +./usr/lib/i18n/libUTF8_pic.a +./usr/lib/i18n/libVIQR_pic.a +./usr/lib/i18n/libZW_pic.a +./usr/lib/i18n/libiconv_none_pic.a +./usr/lib/i18n/libiconv_std_pic.a +./usr/lib/i18n/libmapper_646_pic.a +./usr/lib/i18n/libmapper_none_pic.a +./usr/lib/i18n/libmapper_parallel_pic.a +./usr/lib/i18n/libmapper_serial_pic.a +./usr/lib/i18n/libmapper_std_pic.a +./usr/lib/i18n/libmapper_zone_pic.a ./usr/lib/libasn1_pic.a ./usr/lib/libc_pic.a ./usr/lib/libcom_err_pic.a @@ -220,6 +243,7 @@ ./usr/lib/libg2c_pic.a ./usr/lib/libgssapi_pic.a ./usr/lib/libiberty_pic.a +./usr/lib/libintl_pic.a ./usr/lib/libkadm5clnt_pic.a ./usr/lib/libkadm5srv_pic.a ./usr/lib/libkafs_pic.a diff -uNr --exclude=CVS --exclude=obj src.orig/distrib/sets/lists/comp/md.mvmeppc src/distrib/sets/lists/comp/md.mvmeppc --- src.orig/distrib/sets/lists/comp/md.mvmeppc Tue Apr 28 15:19:09 2009 +++ src/distrib/sets/lists/comp/md.mvmeppc Thu Jun 18 13:03:21 2009 @@ -176,6 +176,31 @@ ./usr/lib/gcc-lib/powerpc-unknown-openbsd4.6/2.95.3/libgcc.a ./usr/lib/gcc-lib/powerpc-unknown-openbsd4.6/2.95.3/soft-float ./usr/lib/gcc-lib/powerpc-unknown-openbsd4.6/2.95.3/soft-float/libgcc.a +./usr/lib/i18n/libBIG5_pic.a +./usr/lib/i18n/libDECHanyu_pic.a +./usr/lib/i18n/libEUC_pic.a +./usr/lib/i18n/libEUCTW_pic.a +./usr/lib/i18n/libGBK2K_pic.a +./usr/lib/i18n/libHZ_pic.a +./usr/lib/i18n/libISO2022_pic.a +./usr/lib/i18n/libJOHAB_pic.a +./usr/lib/i18n/libMSKanji_pic.a +./usr/lib/i18n/libUES_pic.a +./usr/lib/i18n/libUTF1632_pic.a +./usr/lib/i18n/libUTF7_pic.a +./usr/lib/i18n/libUTF8_pic.a +./usr/lib/i18n/libVIQR_pic.a +./usr/lib/i18n/libZW_pic.a +./usr/lib/i18n/libiconv_none_pic.a +./usr/lib/i18n/libiconv_std_pic.a +./usr/lib/i18n/libmapper_646_pic.a +./usr/lib/i18n/libmapper_none_pic.a +./usr/lib/i18n/libmapper_parallel_pic.a +./usr/lib/i18n/libmapper_serial_pic.a +./usr/lib/i18n/libmapper_std_pic.a +./usr/lib/i18n/libmapper_zone_pic.a +./usr/lib/libbfd.a +./usr/lib/libbfd.la ./usr/lib/libc_pic.a ./usr/lib/libcom_err_pic.a ./usr/lib/libcrypto_pic.a @@ -188,6 +213,7 @@ ./usr/lib/libfrtbegin_pic.a ./usr/lib/libg2c_pic.a ./usr/lib/libiberty_pic.a +./usr/lib/libintl_pic.a ./usr/lib/libkvm_pic.a ./usr/lib/libm_pic.a ./usr/lib/libmenu_pic.a diff -uNr --exclude=CVS --exclude=obj src.orig/distrib/sets/lists/comp/md.socppc src/distrib/sets/lists/comp/md.socppc --- src.orig/distrib/sets/lists/comp/md.socppc Fri Jun 19 05:38:20 2009 +++ src/distrib/sets/lists/comp/md.socppc Thu Jun 18 13:03:21 2009 @@ -251,6 +251,28 @@ ./usr/lib/gcc-lib/powerpc-unknown-openbsd4.6/3.3.5/nof ./usr/lib/gcc-lib/powerpc-unknown-openbsd4.6/3.3.5/nof/crtsavres.o ./usr/lib/gcc-lib/powerpc-unknown-openbsd4.6/3.3.5/nof/libgcc.a +./usr/lib/i18n/libBIG5_pic.a +./usr/lib/i18n/libDECHanyu_pic.a +./usr/lib/i18n/libEUC_pic.a +./usr/lib/i18n/libEUCTW_pic.a +./usr/lib/i18n/libGBK2K_pic.a +./usr/lib/i18n/libHZ_pic.a +./usr/lib/i18n/libISO2022_pic.a +./usr/lib/i18n/libJOHAB_pic.a +./usr/lib/i18n/libMSKanji_pic.a +./usr/lib/i18n/libUES_pic.a +./usr/lib/i18n/libUTF1632_pic.a +./usr/lib/i18n/libUTF7_pic.a +./usr/lib/i18n/libUTF8_pic.a +./usr/lib/i18n/libZW_pic.a +./usr/lib/i18n/libiconv_none_pic.a +./usr/lib/i18n/libiconv_std_pic.a +./usr/lib/i18n/libmapper_646_pic.a +./usr/lib/i18n/libmapper_none_pic.a +./usr/lib/i18n/libmapper_parallel_pic.a +./usr/lib/i18n/libmapper_serial_pic.a +./usr/lib/i18n/libmapper_std_pic.a +./usr/lib/i18n/libmapper_zone_pic.a ./usr/lib/libasn1_pic.a ./usr/lib/libc_pic.a ./usr/lib/libcom_err_pic.a @@ -265,6 +287,7 @@ ./usr/lib/libg2c_pic.a ./usr/lib/libgssapi_pic.a ./usr/lib/libiberty_pic.a +./usr/lib/libintl_pic.a ./usr/lib/libkadm5clnt_pic.a ./usr/lib/libkadm5srv_pic.a ./usr/lib/libkafs_pic.a diff -uNr --exclude=CVS --exclude=obj src.orig/distrib/sets/lists/comp/md.sparc src/distrib/sets/lists/comp/md.sparc --- src.orig/distrib/sets/lists/comp/md.sparc Tue Apr 28 15:19:09 2009 +++ src/distrib/sets/lists/comp/md.sparc Thu Jun 18 13:03:22 2009 @@ -190,6 +190,29 @@ ./usr/lib/gcc-lib/sparc-unknown-openbsd4.6/2.95.3/include/syslimits.h ./usr/lib/gcc-lib/sparc-unknown-openbsd4.6/2.95.3/include/typeinfo ./usr/lib/gcc-lib/sparc-unknown-openbsd4.6/2.95.3/libgcc.a +./usr/lib/i18n/libBIG5_pic.a +./usr/lib/i18n/libDECHanyu_pic.a +./usr/lib/i18n/libEUC_pic.a +./usr/lib/i18n/libEUCTW_pic.a +./usr/lib/i18n/libGBK2K_pic.a +./usr/lib/i18n/libHZ_pic.a +./usr/lib/i18n/libISO2022_pic.a +./usr/lib/i18n/libJOHAB_pic.a +./usr/lib/i18n/libMSKanji_pic.a +./usr/lib/i18n/libUES_pic.a +./usr/lib/i18n/libUTF1632_pic.a +./usr/lib/i18n/libUTF7_pic.a +./usr/lib/i18n/libUTF8_pic.a +./usr/lib/i18n/libVIQR_pic.a +./usr/lib/i18n/libZW_pic.a +./usr/lib/i18n/libiconv_none_pic.a +./usr/lib/i18n/libiconv_std_pic.a +./usr/lib/i18n/libmapper_646_pic.a +./usr/lib/i18n/libmapper_none_pic.a +./usr/lib/i18n/libmapper_parallel_pic.a +./usr/lib/i18n/libmapper_serial_pic.a +./usr/lib/i18n/libmapper_std_pic.a +./usr/lib/i18n/libmapper_zone_pic.a ./usr/lib/libasn1_pic.a ./usr/lib/libc_pic.a ./usr/lib/libcom_err_pic.a @@ -204,6 +227,7 @@ ./usr/lib/libg2c_pic.a ./usr/lib/libgssapi_pic.a ./usr/lib/libiberty_pic.a +./usr/lib/libintl_pic.a ./usr/lib/libkadm5clnt_pic.a ./usr/lib/libkadm5srv_pic.a ./usr/lib/libkafs_pic.a diff -uNr --exclude=CVS --exclude=obj src.orig/distrib/sets/lists/comp/md.sparc64 src/distrib/sets/lists/comp/md.sparc64 --- src.orig/distrib/sets/lists/comp/md.sparc64 Tue Apr 28 15:19:09 2009 +++ src/distrib/sets/lists/comp/md.sparc64 Thu Jun 18 13:03:22 2009 @@ -223,6 +223,29 @@ ./usr/lib/gcc-lib/sparc64-unknown-openbsd4.6/3.3.5/include/unwind.h ./usr/lib/gcc-lib/sparc64-unknown-openbsd4.6/3.3.5/libgcc.a ./usr/lib/gcc-lib/sparc64-unknown-openbsd4.6/3.3.5/specs +./usr/lib/i18n/libBIG5_pic.a +./usr/lib/i18n/libDECHanyu_pic.a +./usr/lib/i18n/libEUC_pic.a +./usr/lib/i18n/libEUCTW_pic.a +./usr/lib/i18n/libGBK2K_pic.a +./usr/lib/i18n/libHZ_pic.a +./usr/lib/i18n/libISO2022_pic.a +./usr/lib/i18n/libJOHAB_pic.a +./usr/lib/i18n/libMSKanji_pic.a +./usr/lib/i18n/libUES_pic.a +./usr/lib/i18n/libUTF1632_pic.a +./usr/lib/i18n/libUTF7_pic.a +./usr/lib/i18n/libUTF8_pic.a +./usr/lib/i18n/libVIQR_pic.a +./usr/lib/i18n/libZW_pic.a +./usr/lib/i18n/libiconv_none_pic.a +./usr/lib/i18n/libiconv_std_pic.a +./usr/lib/i18n/libmapper_646_pic.a +./usr/lib/i18n/libmapper_none_pic.a +./usr/lib/i18n/libmapper_parallel_pic.a +./usr/lib/i18n/libmapper_serial_pic.a +./usr/lib/i18n/libmapper_std_pic.a +./usr/lib/i18n/libmapper_zone_pic.a ./usr/lib/libasn1_pic.a ./usr/lib/libc_pic.a ./usr/lib/libcom_err_pic.a @@ -237,6 +260,7 @@ ./usr/lib/libg2c_pic.a ./usr/lib/libgssapi_pic.a ./usr/lib/libiberty_pic.a +./usr/lib/libintl_pic.a ./usr/lib/libkadm5clnt_pic.a ./usr/lib/libkadm5srv_pic.a ./usr/lib/libkafs_pic.a diff -uNr --exclude=CVS --exclude=obj src.orig/distrib/sets/lists/comp/md.zaurus src/distrib/sets/lists/comp/md.zaurus --- src.orig/distrib/sets/lists/comp/md.zaurus Tue Apr 28 15:19:09 2009 +++ src/distrib/sets/lists/comp/md.zaurus Thu Jun 18 13:03:22 2009 @@ -253,6 +253,29 @@ ./usr/lib/gcc-lib/arm-unknown-openbsd4.6/3.3.5/include ./usr/lib/gcc-lib/arm-unknown-openbsd4.6/3.3.5/include/unwind.h ./usr/lib/gcc-lib/arm-unknown-openbsd4.6/3.3.5/libgcc.a +./usr/lib/i18n/libBIG5_pic.a +./usr/lib/i18n/libDECHanyu_pic.a +./usr/lib/i18n/libEUC_pic.a +./usr/lib/i18n/libEUCTW_pic.a +./usr/lib/i18n/libGBK2K_pic.a +./usr/lib/i18n/libHZ_pic.a +./usr/lib/i18n/libISO2022_pic.a +./usr/lib/i18n/libJOHAB_pic.a +./usr/lib/i18n/libMSKanji_pic.a +./usr/lib/i18n/libUES_pic.a +./usr/lib/i18n/libUTF1632_pic.a +./usr/lib/i18n/libUTF7_pic.a +./usr/lib/i18n/libUTF8_pic.a +./usr/lib/i18n/libVIQR_pic.a +./usr/lib/i18n/libZW_pic.a +./usr/lib/i18n/libiconv_none_pic.a +./usr/lib/i18n/libiconv_std_pic.a +./usr/lib/i18n/libmapper_646_pic.a +./usr/lib/i18n/libmapper_none_pic.a +./usr/lib/i18n/libmapper_parallel_pic.a +./usr/lib/i18n/libmapper_serial_pic.a +./usr/lib/i18n/libmapper_std_pic.a +./usr/lib/i18n/libmapper_zone_pic.a ./usr/lib/libarm.a ./usr/lib/libarm_p.a ./usr/lib/libasn1_pic.a @@ -269,6 +292,7 @@ ./usr/lib/libg2c_pic.a ./usr/lib/libgssapi_pic.a ./usr/lib/libiberty_pic.a +./usr/lib/libintl_pic.a ./usr/lib/libkadm5clnt_pic.a ./usr/lib/libkadm5srv_pic.a ./usr/lib/libkafs_pic.a diff -uNr --exclude=CVS --exclude=obj src.orig/distrib/sets/lists/comp/mi src/distrib/sets/lists/comp/mi --- src.orig/distrib/sets/lists/comp/mi Fri Jun 19 05:38:23 2009 +++ src/distrib/sets/lists/comp/mi Thu Jun 18 13:03:22 2009 @@ -1005,6 +1005,7 @@ ./usr/include/glob.h ./usr/include/grp.h ./usr/include/histedit.h +./usr/include/iconv.h ./usr/include/ifaddrs.h ./usr/include/inttypes.h ./usr/include/iso646.h @@ -1051,6 +1052,7 @@ ./usr/include/kvm.h ./usr/include/langinfo.h ./usr/include/libgen.h +./usr/include/libintl.h ./usr/include/libmilter ./usr/include/libmilter/mfapi.h ./usr/include/libmilter/mfdef.h @@ -1761,6 +1763,8 @@ ./usr/lib/libhdb_p.a ./usr/lib/libiberty.a ./usr/lib/libiberty_p.a +./usr/lib/libintl.a +./usr/lib/libintl_p.a ./usr/lib/libkadm5clnt.a ./usr/lib/libkadm5clnt_p.a ./usr/lib/libkadm5srv.a @@ -1825,6 +1829,29 @@ ./usr/lib/liby_p.a ./usr/lib/libz.a ./usr/lib/libz_p.a +./usr/lib/i18n/libBIG5.a +./usr/lib/i18n/libDECHanyu.a +./usr/lib/i18n/libEUC.a +./usr/lib/i18n/libEUCTW.a +./usr/lib/i18n/libGBK2K.a +./usr/lib/i18n/libHZ.a +./usr/lib/i18n/libISO2022.a +./usr/lib/i18n/libJOHAB.a +./usr/lib/i18n/libMSKanji.a +./usr/lib/i18n/libUES.a +./usr/lib/i18n/libUTF1632.a +./usr/lib/i18n/libUTF7.a +./usr/lib/i18n/libUTF8.a +./usr/lib/i18n/libVIQR.a +./usr/lib/i18n/libZW.a +./usr/lib/i18n/libiconv_none.a +./usr/lib/i18n/libiconv_std.a +./usr/lib/i18n/libmapper_646.a +./usr/lib/i18n/libmapper_none.a +./usr/lib/i18n/libmapper_parallel.a +./usr/lib/i18n/libmapper_serial.a +./usr/lib/i18n/libmapper_std.a +./usr/lib/i18n/libmapper_zone.a ./usr/libdata/lint/llib-lc.ln ./usr/libdata/lint/llib-lcompat.ln ./usr/libdata/lint/llib-lcrypto.ln @@ -3319,8 +3346,10 @@ ./usr/share/man/cat3/betoh16.0 ./usr/share/man/cat3/betoh32.0 ./usr/share/man/cat3/betoh64.0 +./usr/share/man/cat3/bind_textdomain_codeset.0 ./usr/share/man/cat3/bindresvport.0 ./usr/share/man/cat3/bindresvport_sa.0 +./usr/share/man/cat3/bindtextdomain.0 ./usr/share/man/cat3/bit_alloc.0 ./usr/share/man/cat3/bit_clear.0 ./usr/share/man/cat3/bit_decl.0 @@ -3575,6 +3604,8 @@ ./usr/share/man/cat3/dbmclose.0 ./usr/share/man/cat3/dbminit.0 ./usr/share/man/cat3/dbopen.0 +./usr/share/man/cat3/dcgettext.0 +./usr/share/man/cat3/dcngettext.0 ./usr/share/man/cat3/def_prog_mode.0 ./usr/share/man/cat3/def_shell_mode.0 ./usr/share/man/cat3/default_colors.0 @@ -3627,6 +3658,7 @@ ./usr/share/man/cat3/des_string_to_2key.0 ./usr/share/man/cat3/des_string_to_key.0 ./usr/share/man/cat3/devname.0 +./usr/share/man/cat3/dgettext.0 ./usr/share/man/cat3/dh.0 ./usr/share/man/cat3/difftime.0 ./usr/share/man/cat3/directory.0 @@ -3643,6 +3675,7 @@ ./usr/share/man/cat3/dlsym.0 ./usr/share/man/cat3/dn_comp.0 ./usr/share/man/cat3/dn_expand.0 +./usr/share/man/cat3/dngettext.0 ./usr/share/man/cat3/doupdate.0 ./usr/share/man/cat3/drand48.0 ./usr/share/man/cat3/drem.0 @@ -3996,6 +4029,7 @@ ./usr/share/man/cat3/getstr.0 ./usr/share/man/cat3/getsubopt.0 ./usr/share/man/cat3/getsyx.0 +./usr/share/man/cat3/gettext.0 ./usr/share/man/cat3/getttyent.0 ./usr/share/man/cat3/getttynam.0 ./usr/share/man/cat3/getusershell.0 @@ -4148,6 +4182,9 @@ ./usr/share/man/cat3/i2d_X509_REQ_fp.0 ./usr/share/man/cat3/i2d_X509_bio.0 ./usr/share/man/cat3/i2d_X509_fp.0 +./usr/share/man/cat3/iconv.0 +./usr/share/man/cat3/iconv_close.0 +./usr/share/man/cat3/iconv_open.0 ./usr/share/man/cat3/idcok.0 ./usr/share/man/cat3/idlok.0 ./usr/share/man/cat3/if_freenameindex.0 @@ -5080,6 +5117,7 @@ ./usr/share/man/cat3/nextafterf.0 ./usr/share/man/cat3/nextkey.0 ./usr/share/man/cat3/nftw.0 +./usr/share/man/cat3/ngettext.0 ./usr/share/man/cat3/nice.0 ./usr/share/man/cat3/nl.0 ./usr/share/man/cat3/nl_langinfo.0 @@ -5755,6 +5793,7 @@ ./usr/share/man/cat3/termcap.0 ./usr/share/man/cat3/terminfo.0 ./usr/share/man/cat3/termname.0 +./usr/share/man/cat3/textdomain.0 ./usr/share/man/cat3/tfind.0 ./usr/share/man/cat3/tgamma.0 ./usr/share/man/cat3/tgammaf.0 @@ -5888,8 +5927,10 @@ ./usr/share/man/cat3/wcscat.0 ./usr/share/man/cat3/wcschr.0 ./usr/share/man/cat3/wcscmp.0 +./usr/share/man/cat3/wcscoll.0 ./usr/share/man/cat3/wcscpy.0 ./usr/share/man/cat3/wcscspn.0 +./usr/share/man/cat3/wcsftime.0 ./usr/share/man/cat3/wcslcat.0 ./usr/share/man/cat3/wcslcpy.0 ./usr/share/man/cat3/wcslen.0 @@ -5912,11 +5953,15 @@ ./usr/share/man/cat3/wcstoul.0 ./usr/share/man/cat3/wcstoull.0 ./usr/share/man/cat3/wcstoumax.0 +./usr/share/man/cat3/wcswcs.0 +./usr/share/man/cat3/wcswidth.0 +./usr/share/man/cat3/wcsxfrm.0 ./usr/share/man/cat3/wctob.0 ./usr/share/man/cat3/wctomb.0 ./usr/share/man/cat3/wctrans.0 ./usr/share/man/cat3/wctype.0 ./usr/share/man/cat3/wcursyncup.0 +./usr/share/man/cat3/wcwidth.0 ./usr/share/man/cat3/wdelch.0 ./usr/share/man/cat3/wdeleteln.0 ./usr/share/man/cat3/wechochar.0 diff -uNr --exclude=CVS --exclude=obj src.orig/distrib/sets/lists/man/mi src/distrib/sets/lists/man/mi --- src.orig/distrib/sets/lists/man/mi Fri Jun 19 05:38:24 2009 +++ src/distrib/sets/lists/man/mi Thu Jun 18 13:03:22 2009 @@ -166,6 +166,7 @@ ./usr/share/man/cat1/htpasswd.0 ./usr/share/man/cat1/i386 ./usr/share/man/cat1/i386/fdformat.0 +./usr/share/man/cat1/iconv.0 ./usr/share/man/cat1/id.0 ./usr/share/man/cat1/ident.0 ./usr/share/man/cat1/indent.0 @@ -205,6 +206,7 @@ ./usr/share/man/cat1/ln.0 ./usr/share/man/cat1/lndir.0 ./usr/share/man/cat1/locate.0 +./usr/share/man/cat1/locale.0 ./usr/share/man/cat1/lock.0 ./usr/share/man/cat1/lockspool.0 ./usr/share/man/cat1/logger.0 diff -uNr --exclude=CVS --exclude=obj src.orig/etc/mtree/4.4BSD.dist src/etc/mtree/4.4BSD.dist --- src.orig/etc/mtree/4.4BSD.dist Tue Apr 28 15:19:30 2009 +++ src/etc/mtree/4.4BSD.dist Thu Jun 18 13:03:22 2009 @@ -313,6 +313,11 @@ # ./usr/lib/debug .. +# ./usr/lib/i18n +i18n +# ./usr/lib/i18n +.. + # ./usr/lib .. @@ -1098,6 +1103,194 @@ # ./usr/share/groff_font .. +# ./usr/share/i18n +i18n + +# ./usr/share/i18n/csmapper +csmapper + +# ./usr/share/i18n/csmapper/APPLE +APPLE +# ./usr/share/i18n/csmapper/APPLE +.. + +# ./usr/share/i18n/csmapper/AST +AST +# ./usr/share/i18n/csmapper/AST +.. + +# ./usr/share/i18n/csmapper/BIG5 +BIG5 +# ./usr/share/i18n/csmapper/BIG5 +.. + +# ./usr/share/i18n/csmapper/CNS +CNS +# ./usr/share/i18n/csmapper/CNS +.. + +# ./usr/share/i18n/csmapper/CP +CP +# ./usr/share/i18n/csmapper/CP +.. + +# ./usr/share/i18n/csmapper/EBCDIC +EBCDIC +# ./usr/share/i18n/csmapper/EBCDIC +.. + +# ./usr/share/i18n/csmapper/GB +GB +# ./usr/share/i18n/csmapper/GB +.. + +# ./usr/share/i18n/csmapper/GEORGIAN +GEORGIAN +# ./usr/share/i18n/csmapper/GEORGIAN +.. + +# ./usr/share/i18n/csmapper/ISO-8859 +ISO-8859 +# ./usr/share/i18n/csmapper/ISO-8859 +.. + +# ./usr/share/i18n/csmapper/ISO646 +ISO646 +# ./usr/share/i18n/csmapper/ISO646 +.. + +# ./usr/share/i18n/csmapper/JIS +JIS +# ./usr/share/i18n/csmapper/JIS +.. + +# ./usr/share/i18n/csmapper/KAZAKH +KAZAKH +# ./usr/share/i18n/csmapper/KAZAKH +.. + +# ./usr/share/i18n/csmapper/KOI +KOI +# ./usr/share/i18n/csmapper/KOI +.. + +# ./usr/share/i18n/csmapper/KS +KS +# ./usr/share/i18n/csmapper/KS +.. + +# ./usr/share/i18n/csmapper/MISC +MISC +# ./usr/share/i18n/csmapper/MISC +.. + +# ./usr/share/i18n/csmapper/TCVN +TCVN +# ./usr/share/i18n/csmapper/TCVN +.. + +# ./usr/share/i18n/csmapper +.. + +# ./usr/share/i18n/esdb +esdb + +# ./usr/share/i18n/esdb/APPLE +APPLE +# ./usr/share/i18n/esdb/APPLE +.. + +# ./usr/share/i18n/esdb/AST +AST +# ./usr/share/i18n/esdb/AST +.. + +# ./usr/share/i18n/esdb/BIG5 +BIG5 +# ./usr/share/i18n/esdb/BIG5 +.. + +# ./usr/share/i18n/esdb/CP +CP +# ./usr/share/i18n/esdb/CP +.. + +# ./usr/share/i18n/esdb/DEC +DEC +# ./usr/share/i18n/esdb/DEC +.. + +# ./usr/share/i18n/esdb/EBCDIC +EBCDIC +# ./usr/share/i18n/esdb/EBCDIC +.. + +# ./usr/share/i18n/esdb/EUC +EUC +# ./usr/share/i18n/esdb/EUC +.. + +# ./usr/share/i18n/esdb/GB +GB +# ./usr/share/i18n/esdb/GB +.. + +# ./usr/share/i18n/esdb/GEORGIAN +GEORGIAN +# ./usr/share/i18n/esdb/GEORGIAN +.. + +# ./usr/share/i18n/esdb/ISO-2022 +ISO-2022 +# ./usr/share/i18n/esdb/ISO-2022 +.. + +# ./usr/share/i18n/esdb/ISO-8859 +ISO-8859 +# ./usr/share/i18n/esdb/ISO-8859 +.. + +# ./usr/share/i18n/esdb/ISO646 +ISO646 +# ./usr/share/i18n/esdb/ISO646 +.. + +# ./usr/share/i18n/esdb/KAZAKH +KAZAKH +# ./usr/share/i18n/esdb/KAZAKH +.. + +# ./usr/share/i18n/esdb/KOI +KOI +# ./usr/share/i18n/esdb/KOI +.. + +# ./usr/share/i18n/esdb/MISC +MISC +# ./usr/share/i18n/esdb/MISC +.. + +# ./usr/share/i18n/esdb/TCVN +TCVN +# ./usr/share/i18n/esdb/TCVN +.. + +# ./usr/share/i18n/esdb/UTF +UTF +# ./usr/share/i18n/esdb/UTF +.. + +# ./usr/share/i18n/esdb +.. + +# ./usr/share/i18n/iconv +iconv +# ./usr/share/i18n/iconv +.. + +# ./usr/share/i18n +.. + # ./usr/share/info info # ./usr/share/info @@ -1121,6 +1314,27 @@ # ./usr/share/locale locale + +# ./usr/share/locale/af_ZA.ISO8859-1 +af_ZA.ISO8859-1 +# ./usr/share/locale/af_ZA.ISO8859-1 +.. + +# ./usr/share/locale/af_ZA.ISO8859-15 +af_ZA.ISO8859-15 +# ./usr/share/locale/af_ZA.ISO8859-15 +.. + +# ./usr/share/locale/be_BY.CP1251 +be_BY.CP1251 +# ./usr/share/locale/be_BY.CP1251 +.. + +# ./usr/share/locale/be_BY.ISO8859-5 +be_BY.ISO8859-5 +# ./usr/share/locale/be_BY.ISO8859-5 +.. + # ./usr/share/locale/bg_BG.CP1251 bg_BG.CP1251 # ./usr/share/locale/bg_BG.CP1251 @@ -1151,11 +1365,6 @@ # ./usr/share/locale/da_DK.ISO8859-15 .. -# ./usr/share/locale/de_AT -de_AT -# ./usr/share/locale/de_AT -.. - # ./usr/share/locale/de_AT.ISO8859-1 de_AT.ISO8859-1 # ./usr/share/locale/de_AT.ISO8859-1 @@ -1221,6 +1430,16 @@ # ./usr/share/locale/en_GB.ISO8859-15 .. +# ./usr/share/locale/en_NZ.ISO8859-1 +en_NZ.ISO8859-1 +# ./usr/share/locale/en_NZ.ISO8859-1 +.. + +# ./usr/share/locale/en_NZ.ISO8859-15 +en_NZ.ISO8859-15 +# ./usr/share/locale/en_NZ.ISO8859-15 +.. + # ./usr/share/locale/en_US.ISO8859-1 en_US.ISO8859-1 # ./usr/share/locale/en_US.ISO8859-1 @@ -1246,6 +1465,21 @@ # ./usr/share/locale/es_ES.ISO8859-15 .. +# ./usr/share/locale/et_EE.ISO8859-15 +et_EE.ISO8859-15 +# ./usr/share/locale/et_EE.ISO8859-15 +.. + +# ./usr/share/locale/eu_ES.ISO8859-1 +eu_ES.ISO8859-1 +# ./usr/share/locale/eu_ES.ISO8859-1 +.. + +# ./usr/share/locale/eu_ES.ISO8859-15 +eu_ES.ISO8859-15 +# ./usr/share/locale/eu_ES.ISO8859-15 +.. + # ./usr/share/locale/fi_FI.ISO8859-1 fi_FI.ISO8859-1 # ./usr/share/locale/fi_FI.ISO8859-1 @@ -1366,9 +1600,9 @@ # ./usr/share/locale/ja_JP.eucJP .. -# ./usr/share/locale/ko_KR.UTF-8 -ko_KR.UTF-8 -# ./usr/share/locale/ko_KR.UTF-8 +# ./usr/share/locale/kk_KZ.PT154 +kk_KZ.PT154 +# ./usr/share/locale/kk_KZ.PT154 .. # ./usr/share/locale/ko_KR.eucKR @@ -1406,6 +1640,16 @@ # ./usr/share/locale/nl_NL.ISO8859-15 .. +# ./usr/share/locale/nn_NO.ISO8859-1 +nn_NO.ISO8859-1 +# ./usr/share/locale/nn_NO.ISO8859-1 +.. + +# ./usr/share/locale/nn_NO.ISO8859-15 +nn_NO.ISO8859-15 +# ./usr/share/locale/nn_NO.ISO8859-15 +.. + # ./usr/share/locale/no_NO.ISO8859-1 no_NO.ISO8859-1 # ./usr/share/locale/no_NO.ISO8859-1 @@ -1421,6 +1665,11 @@ # ./usr/share/locale/pl_PL.ISO8859-2 .. +# ./usr/share/locale/pt_BR.ISO8859-1 +pt_BR.ISO8859-1 +# ./usr/share/locale/pt_BR.ISO8859-1 +.. + # ./usr/share/locale/pt_PT.ISO8859-1 pt_PT.ISO8859-1 # ./usr/share/locale/pt_PT.ISO8859-1 @@ -1431,6 +1680,21 @@ # ./usr/share/locale/pt_PT.ISO8859-15 .. +# ./usr/share/locale/ro_RO.ISO8859-2 +ro_RO.ISO8859-2 +# ./usr/share/locale/ro_RO.ISO8859-2 +.. + +# ./usr/share/locale/ru_BY.CP1251 +ru_BY.CP1251 +# ./usr/share/locale/ru_BY.CP1251 +.. + +# ./usr/share/locale/ru_RU.CP1251 +ru_RU.CP1251 +# ./usr/share/locale/ru_RU.CP1251 +.. + # ./usr/share/locale/ru_RU.CP866 ru_RU.CP866 # ./usr/share/locale/ru_RU.CP866 @@ -1456,6 +1720,16 @@ # ./usr/share/locale/sl_SI.ISO8859-2 .. +# ./usr/share/locale/sr_YU.ISO8859-2 +sr_YU.ISO8859-2 +# ./usr/share/locale/sr_YU.ISO8859-2 +.. + +# ./usr/share/locale/sr_YU.ISO8859-5 +sr_YU.ISO8859-5 +# ./usr/share/locale/sr_YU.ISO8859-5 +.. + # ./usr/share/locale/sv_SE.ISO8859-1 sv_SE.ISO8859-1 # ./usr/share/locale/sv_SE.ISO8859-1 @@ -1466,6 +1740,21 @@ # ./usr/share/locale/sv_SE.ISO8859-15 .. +# ./usr/share/locale/tr_TR.ISO8859-9 +tr_TR.ISO8859-9 +# ./usr/share/locale/tr_TR.ISO8859-9 +.. + +# ./usr/share/locale/uk_UA.CP1251 +uk_UA.CP1251 +# ./usr/share/locale/uk_UA.CP1251 +.. + +# ./usr/share/locale/uk_UA.ISO8859-5 +uk_UA.ISO8859-5 +# ./usr/share/locale/uk_UA.ISO8859-5 +.. + # ./usr/share/locale/uk_UA.KOI8-U uk_UA.KOI8-U # ./usr/share/locale/uk_UA.KOI8-U @@ -1481,14 +1770,14 @@ # ./usr/share/locale/zh_CN.eucCN .. +# ./usr/share/locale/zh_HK.Big5-HKSCS +zh_HK.Big5-HKSCS +# ./usr/share/locale/zh_HK.Big5 +.. + # ./usr/share/locale/zh_TW.Big5 zh_TW.Big5 # ./usr/share/locale/zh_TW.Big5 -.. - -# ./usr/share/locale/zh_TW.BIG5 -zh_TW.BIG5 -# ./usr/share/locale/zh_TW.BIG5 .. # ./usr/share/locale/zh_TW.eucTW diff -uNr --exclude=CVS --exclude=obj src.orig/include/Makefile src/include/Makefile --- src.orig/include/Makefile Tue Apr 28 15:24:13 2009 +++ src/include/Makefile Thu Jun 18 13:03:22 2009 @@ -14,7 +14,7 @@ FILES= a.out.h ar.h assert.h bitstring.h blf.h bm.h bsd_auth.h cast.h \ complex.h cpio.h ctype.h curses.h db.h dbm.h des.h dirent.h disktab.h \ dlfcn.h elf_abi.h err.h errno.h fnmatch.h fstab.h fts.h ftw.h getopt.h \ - glob.h grp.h ifaddrs.h inttypes.h iso646.h kvm.h langinfo.h \ + glob.h grp.h iconv.h ifaddrs.h inttypes.h iso646.h kvm.h langinfo.h \ libgen.h limits.h locale.h login_cap.h malloc.h math.h md4.h \ md5.h memory.h mpool.h ndbm.h netdb.h netgroup.h nlist.h nl_types.h \ ohash.h paths.h poll.h pwd.h ranlib.h re_comp.h \ @@ -45,6 +45,7 @@ ../lib/libskey ../lib/libsectok ../lib/libedit ../lib/libexpat \ ../lib/libpcap ../lib/libutil ../lib/libusbhid ../lib/libwrap \ ../lib/libz ../lib/libkeynote ../lib/libevent ../usr.bin/lex \ + ../lib/libintl \ ../gnu/lib/libreadline ../gnu/usr.sbin/sendmail/libmilter \ ../sys/arch/${MACHINE} diff -uNr --exclude=CVS --exclude=obj src.orig/include/iconv.h src/include/iconv.h --- src.orig/include/iconv.h Thu Jan 1 09:00:00 1970 +++ src/include/iconv.h Thu Jun 18 13:03:22 2009 @@ -0,0 +1,61 @@ +/* $OpenBSD$ */ +/* NetBSD: iconv.h,v 1.6 2005/02/03 04:39:32 perry Exp */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#ifndef _ICONV_H_ +#define _ICONV_H_ + +#include +#include + +#ifndef _SIZE_T_DEFINED_ +#define _SIZE_T_DEFINED_ +typedef __size_t size_t; +#endif + +struct __tag_iconv_t; +typedef struct __tag_iconv_t *iconv_t; + +__BEGIN_DECLS +iconv_t iconv_open(const char *, const char *); +size_t iconv(iconv_t, const char ** __restrict, + size_t * __restrict, char ** __restrict, + size_t * __restrict); +int iconv_close(iconv_t); +/* + * non-portable interfaces for iconv + */ +int __iconv_get_list(char ***, size_t *); +void __iconv_free_list(char **, size_t); +size_t __iconv(iconv_t, const char **, size_t *, char **, + size_t *, __uint32_t, size_t *); +#define __ICONV_F_HIDE_INVALID 0x0001 +__END_DECLS + +#endif /* !_ICONV_H_ */ diff -uNr --exclude=CVS --exclude=obj src.orig/include/langinfo.h src/include/langinfo.h --- src.orig/include/langinfo.h Thu Nov 17 01:48:14 2005 +++ src/include/langinfo.h Thu Jun 18 13:03:22 2009 @@ -1,8 +1,8 @@ /* $OpenBSD: langinfo.h,v 1.5 2005/11/16 16:48:14 espie Exp $ */ -/* $NetBSD: langinfo.h,v 1.3 1995/04/28 23:30:54 jtc Exp $ */ +/* NetBSD: langinfo.h,v 1.9 2005/02/03 04:39:32 perry Exp */ /* - * Written by J.T. Conklin + * Written by J.T. Conklin * Public domain. */ @@ -12,64 +12,78 @@ #include #include -#define D_T_FMT 0 /* String for formatting date and time */ -#define D_FMT 1 /* Date format string */ -#define T_FMT 2 /* Time format string */ -#define T_FMT_AMPM 3 /* Time format string with 12 hour clock */ -#define AM_STR 4 /* Ante Meridiem afix */ -#define PM_STR 5 /* Post Meridiem afix */ +#define D_T_FMT ((nl_item)0) /* String for formatting date and + time */ +#define D_FMT ((nl_item)1) /* Date format string */ +#define T_FMT ((nl_item)2) /* Time format string */ +#define T_FMT_AMPM ((nl_item)3) /* Time format string with 12 hour + clock */ +#define AM_STR ((nl_item)4) /* Ante Meridiem afix */ +#define PM_STR ((nl_item)5) /* Post Meridiem afix */ -#define DAY_1 6 /* Name of the first day of the week */ -#define DAY_2 7 -#define DAY_3 8 -#define DAY_4 9 -#define DAY_5 10 -#define DAY_6 11 -#define DAY_7 12 +#define DAY_1 ((nl_item)6) /* Name of the first day of the week */ +#define DAY_2 ((nl_item)7) +#define DAY_3 ((nl_item)8) +#define DAY_4 ((nl_item)9) +#define DAY_5 ((nl_item)10) +#define DAY_6 ((nl_item)11) +#define DAY_7 ((nl_item)12) -#define ABDAY_1 13 /* Abbrev. name of the first day of the week */ -#define ABDAY_2 14 -#define ABDAY_3 15 -#define ABDAY_4 16 -#define ABDAY_5 17 -#define ABDAY_6 18 -#define ABDAY_7 19 +#define ABDAY_1 ((nl_item)13) /* Abbrev. name of the first day of + the week */ +#define ABDAY_2 ((nl_item)14) +#define ABDAY_3 ((nl_item)15) +#define ABDAY_4 ((nl_item)16) +#define ABDAY_5 ((nl_item)17) +#define ABDAY_6 ((nl_item)18) +#define ABDAY_7 ((nl_item)19) -#define MON_1 20 /* Name of the first month */ -#define MON_2 21 -#define MON_3 22 -#define MON_4 23 -#define MON_5 24 -#define MON_6 25 -#define MON_7 26 -#define MON_8 27 -#define MON_9 28 -#define MON_10 29 -#define MON_11 30 -#define MON_12 31 +#define MON_1 ((nl_item)20) /* Name of the first month */ +#define MON_2 ((nl_item)21) +#define MON_3 ((nl_item)22) +#define MON_4 ((nl_item)23) +#define MON_5 ((nl_item)24) +#define MON_6 ((nl_item)25) +#define MON_7 ((nl_item)26) +#define MON_8 ((nl_item)27) +#define MON_9 ((nl_item)28) +#define MON_10 ((nl_item)29) +#define MON_11 ((nl_item)30) +#define MON_12 ((nl_item)31) -#define ABMON_1 32 /* Abbrev. name of the first month */ -#define ABMON_2 33 -#define ABMON_3 34 -#define ABMON_4 35 -#define ABMON_5 36 -#define ABMON_6 37 -#define ABMON_7 38 -#define ABMON_8 39 -#define ABMON_9 40 -#define ABMON_10 41 -#define ABMON_11 42 -#define ABMON_12 43 +#define ABMON_1 ((nl_item)32) /* Abbrev. name of the first month */ +#define ABMON_2 ((nl_item)33) +#define ABMON_3 ((nl_item)34) +#define ABMON_4 ((nl_item)35) +#define ABMON_5 ((nl_item)36) +#define ABMON_6 ((nl_item)37) +#define ABMON_7 ((nl_item)38) +#define ABMON_8 ((nl_item)39) +#define ABMON_9 ((nl_item)40) +#define ABMON_10 ((nl_item)41) +#define ABMON_11 ((nl_item)42) +#define ABMON_12 ((nl_item)43) -#define RADIXCHAR 44 /* Radix character */ -#define THOUSEP 45 /* Separator for thousands */ -#define YESSTR 46 /* Affirmitive response for yes/no queries */ -#define YESEXPR 47 /* Affirmitive response for yes/no queries */ -#define NOSTR 48 /* Negative response for yes/no queries */ -#define NOEXPR 49 /* Negative response for yes/no queries */ -#define CRNCYSTR 50 /* Currency symbol */ +#define RADIXCHAR ((nl_item)44) /* Radix character */ +#define THOUSEP ((nl_item)45) /* Separator for thousands */ +#define YESSTR ((nl_item)46) /* Affirmitive response for yes/no + queries */ +#define YESEXPR ((nl_item)47) /* Affirmitive response for yes/no + queries */ +#define NOSTR ((nl_item)48) /* Negative response for yes/no + queries */ +#define NOEXPR ((nl_item)49) /* Negative response for yes/no + queries */ +#define CRNCYSTR ((nl_item)50) /* Currency symbol */ -#define CODESET 51 /* Codeset name */ +#define CODESET ((nl_item)51) /* codeset name */ + +#define ERA ((nl_item)52) /* Era description segments */ +#define ERA_D_FMT ((nl_item)53) /* Era date format string */ +#define ERA_D_T_FMT ((nl_item)54) /* Era date and time format string */ +#define ERA_T_FMT ((nl_item)55) /* Era time format string */ + +#define ALT_DIGITS ((nl_item)56) /* Alternative symbols for digits */ __BEGIN_DECLS char *nl_langinfo(nl_item); diff -uNr --exclude=CVS --exclude=obj src.orig/include/locale.h src/include/locale.h --- src.orig/include/locale.h Tue Jun 3 04:34:12 2003 +++ src/include/locale.h Thu Jun 18 13:03:22 2009 @@ -1,9 +1,9 @@ /* $OpenBSD: locale.h,v 1.6 2003/06/02 19:34:12 millert Exp $ */ -/* $NetBSD: locale.h,v 1.6 1994/10/26 00:56:02 cgd Exp $ */ +/* $NetBSD: locale.h,v 1.14 2005/02/03 04:39:32 perry Exp $ */ /* - * Copyright (c) 1991 The Regents of the University of California. - * All rights reserved. + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)locale.h 5.2 (Berkeley) 2/24/91 + * @(#)locale.h 8.1 (Berkeley) 6/2/93 */ #ifndef _LOCALE_H_ @@ -54,6 +54,14 @@ char n_sep_by_space; char p_sign_posn; char n_sign_posn; +#if 0 + char int_p_cs_precedes; + char int_n_cs_precedes; + char int_p_sep_by_space; + char int_n_sep_by_space; + char int_p_sign_posn; + char int_n_sign_posn; +#endif }; #ifndef NULL diff -uNr --exclude=CVS --exclude=obj src.orig/include/paths.h src/include/paths.h --- src.orig/include/paths.h Wed Dec 17 11:56:30 2008 +++ src/include/paths.h Thu Jun 18 13:03:22 2009 @@ -43,10 +43,14 @@ #define _PATH_BSHELL "/bin/sh" #define _PATH_CONSOLE "/dev/console" #define _PATH_CSHELL "/bin/csh" +#define _PATH_CSMAPPER "/usr/share/i18n/csmapper" #define _PATH_DEFTAPE "/dev/rst0" #define _PATH_DEVDB "/var/run/dev.db" #define _PATH_DEVNULL "/dev/null" +#define _PATH_ESDB "/usr/share/i18n/esdb" #define _PATH_FSIRAND "/sbin/fsirand" +#define _PATH_I18NMODULE "/usr/lib/i18n" +#define _PATH_ICONV "/usr/share/i18n/iconv" #define _PATH_KLOG "/dev/klog" #define _PATH_KMEM "/dev/kmem" #define _PATH_KSHELL "/bin/ksh" diff -uNr --exclude=CVS --exclude=obj src.orig/include/wchar.h src/include/wchar.h --- src.orig/include/wchar.h Wed Dec 17 11:56:30 2008 +++ src/include/wchar.h Thu Jun 18 13:03:22 2009 @@ -1,5 +1,5 @@ /* $OpenBSD: wchar.h,v 1.10 2009/01/13 18:18:31 kettenis Exp $ */ -/* $NetBSD: wchar.h,v 1.16 2003/03/07 07:11:35 tshiozak Exp $ */ +/* $NetBSD: wchar.h,v 1.27 2008/04/28 20:22:54 martin Exp $ */ /*- * Copyright (c)1999 Citrus Project, @@ -111,6 +111,8 @@ int wcscoll(const wchar_t *, const wchar_t *); wchar_t *wcscpy(wchar_t * __restrict, const wchar_t * __restrict); size_t wcscspn(const wchar_t *, const wchar_t *); +size_t wcsftime(wchar_t * __restrict, size_t, const wchar_t * __restrict, + const struct tm * __restrict); size_t wcslen(const wchar_t *); wchar_t *wcsncat(wchar_t * __restrict, const wchar_t * __restrict, size_t); @@ -142,9 +144,9 @@ int wcwidth(wchar_t); double wcstod(const wchar_t * __restrict, wchar_t ** __restrict); -long int wcstol(const wchar_t * __restrict, wchar_t ** __restrict, int base); +long int wcstol(const wchar_t * __restrict, wchar_t ** __restrict, int); unsigned long int wcstoul(const wchar_t * __restrict, wchar_t ** __restrict, - int base); + int); #if __ISO_C_VISIBLE >= 1999 float wcstof(const wchar_t * __restrict, wchar_t ** __restrict); @@ -155,10 +157,10 @@ __ISO_C_VISIBLE >= 1999 /* LONGLONG */ long long int wcstoll(const wchar_t * __restrict, - wchar_t ** __restrict, int base); + wchar_t ** __restrict, int); /* LONGLONG */ unsigned long long int wcstoull(const wchar_t * __restrict, - wchar_t ** __restrict, int base); + wchar_t ** __restrict, int); #endif wint_t ungetwc(wint_t, FILE *); diff -uNr --exclude=CVS --exclude=obj src.orig/include/wctype.h src/include/wctype.h --- src.orig/include/wctype.h Sat Jan 7 03:53:04 2006 +++ src/include/wctype.h Thu Jun 18 13:03:22 2009 @@ -1,5 +1,5 @@ /* $OpenBSD: wctype.h,v 1.5 2006/01/06 18:53:04 millert Exp $ */ -/* $NetBSD: wctype.h,v 1.5 2003/03/02 22:18:11 tshiozak Exp $ */ +/* $NetBSD: wctype.h,v 1.6 2005/02/03 04:39:32 perry Exp $ */ /*- * Copyright (c)1999 Citrus Project, diff -uNr --exclude=CVS --exclude=obj src.orig/lib/Makefile src/lib/Makefile --- src.orig/lib/Makefile Mon Oct 27 09:26:33 2008 +++ src/lib/Makefile Thu Jun 18 13:03:22 2009 @@ -3,7 +3,7 @@ SUBDIR= csu libarch libc libcompat libcurses \ libdes libedit libevent libexpat \ - libform libkeynote libkvm libl libm libmenu \ + libform libintl libkeynote libkvm libl libm libmenu \ libocurses libossaudio libpanel libpcap libpthread librpcsvc \ libskey libsectok libsndio libssl libusbhid libutil libwrap liby libz @@ -11,6 +11,10 @@ .if (${KERBEROS5:L} == "yes") SUBDIR+=libgssapi libkadm5srv libkadm5clnt libkrb5 +.endif + +.if (${CITRUS:L} == "yes") +SUBDIR+=i18n_module .endif .include diff -uNr --exclude=CVS --exclude=obj src.orig/lib/i18n_module/BIG5/Makefile src/lib/i18n_module/BIG5/Makefile --- src.orig/lib/i18n_module/BIG5/Makefile Thu Jan 1 09:00:00 1970 +++ src/lib/i18n_module/BIG5/Makefile Thu Jun 18 13:03:22 2009 @@ -0,0 +1,6 @@ +# $OpenBSD$ +# $NetBSD: Makefile,v 1.2 2006/11/22 23:38:27 tnozaki Exp $ + +SRCS= citrus_big5.c citrus_prop.c + +.include diff -uNr --exclude=CVS --exclude=obj src.orig/lib/i18n_module/DECHanyu/Makefile src/lib/i18n_module/DECHanyu/Makefile --- src.orig/lib/i18n_module/DECHanyu/Makefile Thu Jan 1 09:00:00 1970 +++ src/lib/i18n_module/DECHanyu/Makefile Thu Jun 18 13:03:22 2009 @@ -0,0 +1,5 @@ +# $OpenBSD$ +# $NetBSD: Makefile,v 1.1 2007/04/01 18:52:31 tnozaki Exp $ + +SRCPRE=citrus_ +.include diff -uNr --exclude=CVS --exclude=obj src.orig/lib/i18n_module/EUC/Makefile src/lib/i18n_module/EUC/Makefile --- src.orig/lib/i18n_module/EUC/Makefile Thu Jan 1 09:00:00 1970 +++ src/lib/i18n_module/EUC/Makefile Thu Jun 18 13:03:22 2009 @@ -0,0 +1,5 @@ +# $OpenBSD$ +# $NetBSD: Makefile,v 1.1 2002/03/17 22:14:15 tshiozak Exp $ + +SRCPRE=citrus_ +.include diff -uNr --exclude=CVS --exclude=obj src.orig/lib/i18n_module/EUCTW/Makefile src/lib/i18n_module/EUCTW/Makefile --- src.orig/lib/i18n_module/EUCTW/Makefile Thu Jan 1 09:00:00 1970 +++ src/lib/i18n_module/EUCTW/Makefile Thu Jun 18 13:03:22 2009 @@ -0,0 +1,5 @@ +# $OpenBSD$ +# $NetBSD: Makefile,v 1.1 2002/03/17 22:14:15 tshiozak Exp $ + +SRCPRE=citrus_ +.include diff -uNr --exclude=CVS --exclude=obj src.orig/lib/i18n_module/GBK2K/Makefile src/lib/i18n_module/GBK2K/Makefile --- src.orig/lib/i18n_module/GBK2K/Makefile Thu Jan 1 09:00:00 1970 +++ src/lib/i18n_module/GBK2K/Makefile Thu Jun 18 13:03:22 2009 @@ -0,0 +1,6 @@ +# $OpenBSD$ +# $NetBSD: Makefile,v 1.1 2003/03/25 18:26:54 tshiozak Exp $ + +SRCPRE=citrus_ +#CFLAGS+=-g +.include diff -uNr --exclude=CVS --exclude=obj src.orig/lib/i18n_module/HZ/Makefile src/lib/i18n_module/HZ/Makefile --- src.orig/lib/i18n_module/HZ/Makefile Thu Jan 1 09:00:00 1970 +++ src/lib/i18n_module/HZ/Makefile Thu Jun 18 13:03:22 2009 @@ -0,0 +1,6 @@ +# $OpenBSD$ +# $NetBSD: Makefile,v 1.1 2006/11/22 23:38:27 tnozaki Exp $ + +SRCS= citrus_hz.c citrus_prop.c + +.include diff -uNr --exclude=CVS --exclude=obj src.orig/lib/i18n_module/ISO2022/Makefile src/lib/i18n_module/ISO2022/Makefile --- src.orig/lib/i18n_module/ISO2022/Makefile Thu Jan 1 09:00:00 1970 +++ src/lib/i18n_module/ISO2022/Makefile Thu Jun 18 13:03:22 2009 @@ -0,0 +1,5 @@ +# $OpenBSD$ +# $NetBSD: Makefile,v 1.1 2002/03/17 22:14:16 tshiozak Exp $ + +SRCPRE=citrus_ +.include diff -uNr --exclude=CVS --exclude=obj src.orig/lib/i18n_module/JOHAB/Makefile src/lib/i18n_module/JOHAB/Makefile --- src.orig/lib/i18n_module/JOHAB/Makefile Thu Jan 1 09:00:00 1970 +++ src/lib/i18n_module/JOHAB/Makefile Thu Jun 18 13:03:22 2009 @@ -0,0 +1,5 @@ +# $OpenBSD$ +# $NetBSD: Makefile,v 1.1 2006/10/18 17:54:55 tnozaki Exp $ + +SRCPRE=citrus_ +.include diff -uNr --exclude=CVS --exclude=obj src.orig/lib/i18n_module/MSKanji/Makefile src/lib/i18n_module/MSKanji/Makefile --- src.orig/lib/i18n_module/MSKanji/Makefile Thu Jan 1 09:00:00 1970 +++ src/lib/i18n_module/MSKanji/Makefile Thu Jun 18 13:03:22 2009 @@ -0,0 +1,5 @@ +# $OpenBSD$ +# $NetBSD: Makefile,v 1.1 2002/03/17 22:14:16 tshiozak Exp $ + +SRCPRE=citrus_ +.include diff -uNr --exclude=CVS --exclude=obj src.orig/lib/i18n_module/Makefile src/lib/i18n_module/Makefile --- src.orig/lib/i18n_module/Makefile Thu Jan 1 09:00:00 1970 +++ src/lib/i18n_module/Makefile Thu Jun 18 13:03:22 2009 @@ -0,0 +1,9 @@ +# $OpenBSD$ +# $NetBSD: Makefile,v 1.8 2007/04/01 18:52:31 tnozaki Exp $ + +SUBDIR= BIG5 DECHanyu EUC EUCTW GBK2K HZ ISO2022 JOHAB MSKanji UES UTF1632 UTF8 UTF7 VIQR ZW +SUBDIR+=iconv_none iconv_std +SUBDIR+=mapper_646 mapper_none mapper_serial mapper_parallel mapper_std \ + mapper_zone + +.include diff -uNr --exclude=CVS --exclude=obj src.orig/lib/i18n_module/Makefile.inc src/lib/i18n_module/Makefile.inc --- src.orig/lib/i18n_module/Makefile.inc Thu Jan 1 09:00:00 1970 +++ src/lib/i18n_module/Makefile.inc Thu Jun 18 13:03:22 2009 @@ -0,0 +1,25 @@ +# $OpenBSD$ +# $NetBSD: Makefile.inc,v 1.9 2006/11/22 23:38:27 tnozaki Exp $ + +NOLINT= # defined +NOPICINSTALL= # defined +NOPROFILE= # defined + +.include + +.include "${.CURDIR}/../shlib_version" +SHLIB_MAJOR?=${major} +SHLIB_MINOR?=${minor} + +LIBDIR= /usr/lib/i18n +SHLIBDIR= /usr/lib/i18n +INTERNALLIB= yes +CPPFLAGS+= -I${.CURDIR}/../../libc/citrus +CPPFLAGS+= -DLOCALEMOD_MAJOR=${SHLIB_MAJOR} +BASENAME!= basename ${.CURDIR} +LIB= ${BASENAME} +.ifndef SRCS +SRCS!= echo ${SRCPRE}${BASENAME}.c | tr A-Z a-z +.endif + +.PATH: ${.CURDIR}/../../libc/citrus ${.CURDIR}/../../libc/citrus/modules diff -uNr --exclude=CVS --exclude=obj src.orig/lib/i18n_module/UES/Makefile src/lib/i18n_module/UES/Makefile --- src.orig/lib/i18n_module/UES/Makefile Thu Jan 1 09:00:00 1970 +++ src/lib/i18n_module/UES/Makefile Thu Jun 18 13:03:22 2009 @@ -0,0 +1,5 @@ +# $OpenBSD$ +# $NetBSD: Makefile,v 1.1 2006/11/13 15:16:31 tnozaki Exp $ + +SRCPRE=citrus_ +.include diff -uNr --exclude=CVS --exclude=obj src.orig/lib/i18n_module/UTF1632/Makefile src/lib/i18n_module/UTF1632/Makefile --- src.orig/lib/i18n_module/UTF1632/Makefile Thu Jan 1 09:00:00 1970 +++ src/lib/i18n_module/UTF1632/Makefile Thu Jun 18 13:03:22 2009 @@ -0,0 +1,5 @@ +# $OpenBSD$ +# $NetBSD: Makefile,v 1.1 2003/06/25 10:38:03 tshiozak Exp $ + +SRCPRE=citrus_ +.include diff -uNr --exclude=CVS --exclude=obj src.orig/lib/i18n_module/UTF7/Makefile src/lib/i18n_module/UTF7/Makefile --- src.orig/lib/i18n_module/UTF7/Makefile Thu Jan 1 09:00:00 1970 +++ src/lib/i18n_module/UTF7/Makefile Thu Jun 18 13:03:22 2009 @@ -0,0 +1,9 @@ +# $OpenBSD$ +# $NetBSD: Makefile,v 1.2 2006/07/01 05:54:35 mrg Exp $ + +SRCPRE=citrus_ +.include + +.if ${MACHINE_ARCH} == "vax" && ${HAVE_GCC} > 3 +COPTS.citrus_utf7.c+= -O0 +.endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/i18n_module/UTF8/Makefile src/lib/i18n_module/UTF8/Makefile --- src.orig/lib/i18n_module/UTF8/Makefile Thu Jan 1 09:00:00 1970 +++ src/lib/i18n_module/UTF8/Makefile Thu Jun 18 13:03:22 2009 @@ -0,0 +1,5 @@ +# $OpenBSD$ +# $NetBSD: Makefile,v 1.1 2002/03/17 22:14:17 tshiozak Exp $ + +SRCPRE=citrus_ +.include diff -uNr --exclude=CVS --exclude=obj src.orig/lib/i18n_module/VIQR/Makefile src/lib/i18n_module/VIQR/Makefile --- src.orig/lib/i18n_module/VIQR/Makefile Thu Jan 1 09:00:00 1970 +++ src/lib/i18n_module/VIQR/Makefile Thu Jun 18 13:03:22 2009 @@ -0,0 +1,5 @@ +# $OpenBSD$ +# $NetBSD: Makefile,v 1.1 2006/11/13 15:16:31 tnozaki Exp $ + +SRCPRE=citrus_ +.include diff -uNr --exclude=CVS --exclude=obj src.orig/lib/i18n_module/ZW/Makefile src/lib/i18n_module/ZW/Makefile --- src.orig/lib/i18n_module/ZW/Makefile Thu Jan 1 09:00:00 1970 +++ src/lib/i18n_module/ZW/Makefile Thu Jun 18 13:03:22 2009 @@ -0,0 +1,5 @@ +# $OpenBSD$ +# $NetBSD: Makefile,v 1.1 2006/11/22 23:38:27 tnozaki Exp $ + +SRCPRE=citrus_ +.include diff -uNr --exclude=CVS --exclude=obj src.orig/lib/i18n_module/iconv_none/Makefile src/lib/i18n_module/iconv_none/Makefile --- src.orig/lib/i18n_module/iconv_none/Makefile Thu Jan 1 09:00:00 1970 +++ src/lib/i18n_module/iconv_none/Makefile Thu Jun 18 13:03:22 2009 @@ -0,0 +1,5 @@ +# $OpenBSD$ +# $NetBSD: Makefile,v 1.1 2003/06/25 10:38:04 tshiozak Exp $ + +SRCPRE=citrus_ +.include diff -uNr --exclude=CVS --exclude=obj src.orig/lib/i18n_module/iconv_std/Makefile src/lib/i18n_module/iconv_std/Makefile --- src.orig/lib/i18n_module/iconv_std/Makefile Thu Jan 1 09:00:00 1970 +++ src/lib/i18n_module/iconv_std/Makefile Thu Jun 18 13:03:22 2009 @@ -0,0 +1,5 @@ +# $OpenBSD$ +# $NetBSD: Makefile,v 1.1 2003/06/25 10:38:04 tshiozak Exp $ + +SRCPRE=citrus_ +.include diff -uNr --exclude=CVS --exclude=obj src.orig/lib/i18n_module/mapper_646/Makefile src/lib/i18n_module/mapper_646/Makefile --- src.orig/lib/i18n_module/mapper_646/Makefile Thu Jan 1 09:00:00 1970 +++ src/lib/i18n_module/mapper_646/Makefile Thu Jun 18 13:03:22 2009 @@ -0,0 +1,5 @@ +# $OpenBSD$ +# $NetBSD: Makefile,v 1.1 2003/06/25 10:38:04 tshiozak Exp $ + +SRCPRE=citrus_ +.include diff -uNr --exclude=CVS --exclude=obj src.orig/lib/i18n_module/mapper_none/Makefile src/lib/i18n_module/mapper_none/Makefile --- src.orig/lib/i18n_module/mapper_none/Makefile Thu Jan 1 09:00:00 1970 +++ src/lib/i18n_module/mapper_none/Makefile Thu Jun 18 13:03:22 2009 @@ -0,0 +1,5 @@ +# $OpenBSD$ +# $NetBSD: Makefile,v 1.1 2003/06/25 10:38:05 tshiozak Exp $ + +SRCPRE=citrus_ +.include diff -uNr --exclude=CVS --exclude=obj src.orig/lib/i18n_module/mapper_parallel/Makefile src/lib/i18n_module/mapper_parallel/Makefile --- src.orig/lib/i18n_module/mapper_parallel/Makefile Thu Jan 1 09:00:00 1970 +++ src/lib/i18n_module/mapper_parallel/Makefile Thu Jun 18 13:03:23 2009 @@ -0,0 +1,5 @@ +# $OpenBSD$ +# $NetBSD: Makefile,v 1.1 2003/06/25 10:38:05 tshiozak Exp $ + +SRCS=citrus_mapper_serial.c +.include diff -uNr --exclude=CVS --exclude=obj src.orig/lib/i18n_module/mapper_serial/Makefile src/lib/i18n_module/mapper_serial/Makefile --- src.orig/lib/i18n_module/mapper_serial/Makefile Thu Jan 1 09:00:00 1970 +++ src/lib/i18n_module/mapper_serial/Makefile Thu Jun 18 13:03:23 2009 @@ -0,0 +1,5 @@ +# $OpenBSD$ +# $NetBSD: Makefile,v 1.1 2003/06/25 10:38:05 tshiozak Exp $ + +SRCPRE=citrus_ +.include diff -uNr --exclude=CVS --exclude=obj src.orig/lib/i18n_module/mapper_std/Makefile src/lib/i18n_module/mapper_std/Makefile --- src.orig/lib/i18n_module/mapper_std/Makefile Thu Jan 1 09:00:00 1970 +++ src/lib/i18n_module/mapper_std/Makefile Thu Jun 18 13:03:23 2009 @@ -0,0 +1,5 @@ +# $OpenBSD$ +# $NetBSD: Makefile,v 1.1 2003/06/25 10:38:06 tshiozak Exp $ + +SRCPRE=citrus_ +.include diff -uNr --exclude=CVS --exclude=obj src.orig/lib/i18n_module/mapper_zone/Makefile src/lib/i18n_module/mapper_zone/Makefile --- src.orig/lib/i18n_module/mapper_zone/Makefile Thu Jan 1 09:00:00 1970 +++ src/lib/i18n_module/mapper_zone/Makefile Thu Jun 18 13:03:23 2009 @@ -0,0 +1,5 @@ +# $OpenBSD$ +# $NetBSD: Makefile,v 1.1 2003/06/25 10:38:06 tshiozak Exp $ + +SRCPRE=citrus_ +.include diff -uNr --exclude=CVS --exclude=obj src.orig/lib/i18n_module/shlib_version src/lib/i18n_module/shlib_version --- src.orig/lib/i18n_module/shlib_version Thu Jan 1 09:00:00 1970 +++ src/lib/i18n_module/shlib_version Thu Jun 18 13:03:23 2009 @@ -0,0 +1,6 @@ +# $OpenBSD$ +# $NetBSD: shlib_version,v 1.5 2005/10/29 18:02:04 tshiozak Exp $ +# Remember to update distrib/sets/lists/base/shl.* when changing +# +major=4 +minor=4 diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/Makefile src/lib/libc/Makefile --- src.orig/lib/libc/Makefile Fri Jun 19 06:03:14 2009 +++ src/lib/libc/Makefile Thu Jun 18 13:03:23 2009 @@ -1,5 +1,11 @@ # $OpenBSD: Makefile,v 1.28 2009/11/24 20:11:08 mk Exp $ # +# All library objects contain sccsid strings by default; they may be +# excluded as a space-saving measure. To produce a library that does +# not contain these strings, delete -DLIBC_SCCS and -DSYSLIBC_SCCS +# from CFLAGS below. To remove these strings from just the system call +# stubs, remove just -DSYSLIBC_SCCS from CFLAGS. +# # The NLS (message catalog) functions are always in libc. To choose that # strerror(), perror(), strsignal(), psignal(), etc. actually call the NLS # functions, put -DNLS on the CFLAGS line below. @@ -57,3 +63,12 @@ ${DESTDIR}/var/db/lib${LIB}.tags .include + +# workaround for I18N stuffs: build singlebyte setlocale() for libc.a, +# multibyte for libc.so. the quirk should be removed when we support +# dlopen() from within statically linked binaries. + +.if (${CITRUS:L} == "yes") +MODULE_SHLIB_MAJOR!= . ${LIBCSRCDIR}/../i18n_module/shlib_version ; echo $$major +PICFLAG+= -D_I18N_DYNAMIC -DI18NMODULE_MAJOR=${MODULE_SHLIB_MAJOR} +.endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/Makefile.inc src/lib/libc/Makefile.inc --- src.orig/lib/libc/Makefile.inc Fri Jun 19 06:03:14 2009 +++ src/lib/libc/Makefile.inc Thu Jun 18 13:03:23 2009 @@ -31,11 +31,13 @@ .include "${LIBCSRCDIR}/db/Makefile.inc" .include "${LIBCSRCDIR}/dlfcn/Makefile.inc" .include "${LIBCSRCDIR}/compat-43/Makefile.inc" +.include "${LIBCSRCDIR}/citrus/Makefile.inc" .include "${LIBCSRCDIR}/gen/Makefile.inc" .include "${LIBCSRCDIR}/crypt/Makefile.inc" .include "${LIBCSRCDIR}/gdtoa/Makefile.inc" .include "${LIBCSRCDIR}/gmon/Makefile.inc" .include "${LIBCSRCDIR}/hash/Makefile.inc" +.include "${LIBCSRCDIR}/iconv/Makefile.inc" .include "${LIBCSRCDIR}/locale/Makefile.inc" .include "${LIBCSRCDIR}/net/Makefile.inc" .include "${LIBCSRCDIR}/nls/Makefile.inc" diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/Makefile.inc src/lib/libc/citrus/Makefile.inc --- src.orig/lib/libc/citrus/Makefile.inc Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/Makefile.inc Thu Jun 18 13:03:23 2009 @@ -0,0 +1,13 @@ +# $OpenBSD$ +# $NetBSD: Makefile.inc,v 1.5 2004/07/21 20:27:46 tshiozak Exp $ + +# sources +.PATH: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/citrus ${LIBCSRCDIR}/citrus + +.if (${CITRUS:L} == "yes") +SRCS+= citrus_bcs.c citrus_csmapper.c citrus_ctype.c citrus_ctype_fallback.c \ + citrus_db.c citrus_db_hash.c citrus_esdb.c citrus_hash.c \ + citrus_iconv.c citrus_lookup.c \ + citrus_mapper.c citrus_memstream.c citrus_mmap.c citrus_module.c \ + citrus_none.c citrus_stdenc.c +.endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_bcs.c src/lib/libc/citrus/citrus_bcs.c --- src.orig/lib/libc/citrus/citrus_bcs.c Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_bcs.c Thu Jun 18 13:03:23 2009 @@ -0,0 +1,159 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_bcs.c,v 1.5 2005/05/14 17:55:42 tshiozak Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include "citrus_namespace.h" +#include "citrus_bcs.h" + +/* + * case insensitive comparison between two C strings. + */ +int +_citrus_bcs_strcasecmp(const char * __restrict str1, + const char * __restrict str2) +{ + int c1 = 1, c2 = 1; + + while (c1 && c2 && c1 == c2) { + c1 = _bcs_toupper(*str1++); + c2 = _bcs_toupper(*str2++); + } + + return ((c1 == c2) ? 0 : ((c1 > c2) ? 1 : -1)); +} + +/* + * case insensitive comparison between two C strings with limitation of length. + */ +int +_citrus_bcs_strncasecmp(const char * __restrict str1, + const char * __restrict str2, size_t sz) +{ + int c1 = 1, c2 = 1; + + while (c1 && c2 && c1 == c2 && sz != 0) { + c1 = _bcs_toupper(*str1++); + c2 = _bcs_toupper(*str2++); + sz--; + } + + return ((c1 == c2) ? 0 : ((c1 > c2) ? 1 : -1)); +} + +/* + * skip white space characters. + */ +const char * +_citrus_bcs_skip_ws(const char *p) +{ + + while (*p && _bcs_isspace(*p)) + p++; + + return (p); +} + +/* + * skip non white space characters. + */ +const char * +_citrus_bcs_skip_nonws(const char *p) +{ + + while (*p && !_bcs_isspace(*p)) + p++; + + return (p); +} + +/* + * skip white space characters with limitation of length. + */ +const char * +_citrus_bcs_skip_ws_len(const char * __restrict p, size_t * __restrict len) +{ + + while (*p && *len > 0 && _bcs_isspace(*p)) { + p++; + (*len)--; + } + + return (p); +} + +/* + * skip non white space characters with limitation of length. + */ +const char * +_citrus_bcs_skip_nonws_len(const char * __restrict p, size_t * __restrict len) +{ + + while (*p && *len > 0 && !_bcs_isspace(*p)) { + p++; + (*len)--; + } + + return (p); +} + +/* + * truncate trailing white space characters. + */ +void +_citrus_bcs_trunc_rws_len(const char * __restrict p, size_t * __restrict len) +{ + + while (*len > 0 && _bcs_isspace(p[*len - 1])) + (*len)--; +} + +/* + * destructive transliterate to lowercase. + */ +void +_citrus_bcs_convert_to_lower(char *s) +{ + while (*s) { + *s = _bcs_tolower(*s); + s++; + } +} + +/* + * destructive transliterate to uppercase. + */ +void +_citrus_bcs_convert_to_upper(char *s) +{ + while (*s) { + *s = _bcs_toupper(*s); + s++; + } +} diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_bcs.h src/lib/libc/citrus/citrus_bcs.h --- src.orig/lib/libc/citrus/citrus_bcs.h Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_bcs.h Thu Jun 18 13:03:23 2009 @@ -0,0 +1,93 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_bcs.h,v 1.4 2008/02/09 14:56:20 junyoung Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _CITRUS_BCS_H_ +#define _CITRUS_BCS_H_ + +/* + * predicate/conversion for basic character set. + * + * `Basic character set' is a term defined in the ISO C standard. + * Citrus bcs is, if anything, close to `portable character set' + * defined in the POSIX. + */ + +#define _CITRUS_BCS_PRED(_name_, _cond_) \ +static __inline int _citrus_bcs_##_name_(uint8_t c) { return (_cond_); } + +/* + * predicates. + * Unlike predicates defined in ctype.h, these do not accept EOF. + */ +_CITRUS_BCS_PRED(isblank, c == ' ' || c == '\t') +_CITRUS_BCS_PRED(iseol, c == '\n' || c == '\r') +_CITRUS_BCS_PRED(isspace, + _citrus_bcs_isblank(c) || _citrus_bcs_iseol(c) || + c == '\f' || c == '\v') +_CITRUS_BCS_PRED(isdigit, c >= '0' && c <= '9') +_CITRUS_BCS_PRED(isupper, c >= 'A' && c <= 'Z') +_CITRUS_BCS_PRED(islower, c >= 'a' && c <= 'z') +_CITRUS_BCS_PRED(isalpha, _citrus_bcs_isupper(c) || _citrus_bcs_islower(c)) +_CITRUS_BCS_PRED(isalnum, _citrus_bcs_isdigit(c) || _citrus_bcs_isalpha(c)) +_CITRUS_BCS_PRED(isxdigit, + _citrus_bcs_isdigit(c) || + (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f')) + +/* + * transliterate between uppercase and lowercase. + * Unlike transliterator defined in ctype.h, these do not accept EOF. + */ +static __inline uint8_t +_citrus_bcs_toupper(uint8_t c) +{ + return (_citrus_bcs_islower(c) ? (c - 'a' + 'A') : c); +} + +static __inline uint8_t +_citrus_bcs_tolower(uint8_t c) +{ + return (_citrus_bcs_isupper(c) ? (c - 'A' + 'a') : c); +} + +__BEGIN_DECLS +int _citrus_bcs_strcasecmp(const char * __restrict, const char * __restrict); +int _citrus_bcs_strncasecmp(const char * __restrict, const char * __restrict, + size_t); +const char *_citrus_bcs_skip_ws(const char * __restrict); +const char *_citrus_bcs_skip_nonws(const char * __restrict); +const char *_citrus_bcs_skip_ws_len(const char * __restrict, + size_t * __restrict); +const char *_citrus_bcs_skip_nonws_len(const char * __restrict, + size_t * __restrict); +void _citrus_bcs_trunc_rws_len(const char * __restrict, size_t * __restrict); +void _citrus_bcs_convert_to_lower(char *); +void _citrus_bcs_convert_to_upper(char *); +__END_DECLS + +#endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_csmapper.c src/lib/libc/citrus/citrus_csmapper.c --- src.orig/lib/libc/citrus/citrus_csmapper.c Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_csmapper.c Thu Jun 18 13:03:23 2009 @@ -0,0 +1,381 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_csmapper.c,v 1.8 2008/02/09 14:56:20 junyoung Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#define be32toh htobe32 +#include +#include +#include +#include +#include +#include +#include +#include "thread_private.h" + +#include "citrus_namespace.h" +#include "citrus_types.h" +#include "citrus_bcs.h" +#include "citrus_region.h" +#include "citrus_memstream.h" +#include "citrus_mmap.h" +#include "citrus_module.h" +#include "citrus_hash.h" +#include "citrus_mapper.h" +#include "citrus_csmapper.h" +#include "citrus_pivot_file.h" +#include "citrus_db.h" +#include "citrus_db_hash.h" +#include "citrus_lookup.h" + +_THREAD_PRIVATE_MUTEX(citrus_csmapper); +static struct _citrus_mapper_area *maparea = NULL; + +#define CS_ALIAS _PATH_CSMAPPER "/charset.alias" +#define CS_PIVOT _PATH_CSMAPPER "/charset.pivot" + + +/* ---------------------------------------------------------------------- */ + +static int +get32(struct _region *r, uint32_t *rval) +{ + if (_region_size(r) != 4) + return EFTYPE; + + memcpy(rval, _region_head(r), (size_t)4); + *rval = be32toh(*rval); + + return 0; +} + +static int +open_subdb(struct _citrus_db **subdb, struct _citrus_db *db, const char *src) +{ + int ret; + struct _region r; + + ret = _db_lookup_by_s(db, src, &r, NULL); + if (ret) + return ret; + ret = _db_open(subdb, &r, _CITRUS_PIVOT_SUB_MAGIC, _db_hash_std, NULL); + if (ret) + return ret; + + return 0; +} + + +#define NO_SUCH_FILE EOPNOTSUPP +static int +find_best_pivot_pvdb(const char *src, const char *dst, char *pivot, + size_t pvlen, unsigned long *rnorm) +{ + int ret, num, i; + struct _region fr, r1, r2; + struct _citrus_db *db1, *db2, *db3; + char buf[LINE_MAX]; + unsigned long norm; + uint32_t val32; + + ret = _map_file(&fr, CS_PIVOT ".pvdb"); + if (ret) { + if (ret == ENOENT) + ret = NO_SUCH_FILE; + return ret; + } + ret = _db_open(&db1, &fr, _CITRUS_PIVOT_MAGIC, _db_hash_std, NULL); + if (ret) + goto quit1; + ret = open_subdb(&db2, db1, src); + if (ret) + goto quit2; + + num = _db_get_num_entries(db2); + *rnorm = ULONG_MAX; + for (i = 0; i < num; i++) { + /* iterate each pivot */ + ret = _db_get_entry(db2, i, &r1, &r2); + if (ret) + goto quit3; + /* r1:pivot name, r2:norm among src and pivot */ + ret = get32(&r2, &val32); + if (ret) + goto quit3; + norm = val32; + snprintf(buf, sizeof(buf), "%.*s", + (int)_region_size(&r1), (char *)_region_head(&r1)); + /* buf: pivot name */ + ret = open_subdb(&db3, db1, buf); + if (ret) + goto quit3; + if (_db_lookup_by_s(db3, dst, &r2, NULL) != 0) + goto quit4; + /* r2: norm among pivot and dst */ + ret = get32(&r2, &val32); + if (ret) + goto quit4; + norm += val32; + /* judge minimum norm */ + if (norm < *rnorm) { + *rnorm = norm; + strlcpy(pivot, buf, pvlen); + } +quit4: + _db_close(db3); + if (ret) + goto quit3; + } +quit3: + _db_close(db2); +quit2: + _db_close(db1); +quit1: + _unmap_file(&fr); + if (ret) + return ret; + + if (*rnorm == ULONG_MAX) + return ENOENT; + + return 0; +} + +/* ---------------------------------------------------------------------- */ + +struct zone { + const char *begin, *end; +}; + +struct parse_arg { + char dst[PATH_MAX]; + unsigned long norm; +}; + +static int +parse_line(struct parse_arg *pa, struct _region *r) +{ + char buf[20]; + struct zone z1, z2; + size_t len; + + len = _region_size(r); + z1.begin = _bcs_skip_ws_len(_region_head(r), &len); + if (len == 0) + return EFTYPE; + z1.end = _bcs_skip_nonws_len(z1.begin, &len); + if (len == 0) + return EFTYPE; + z2.begin = _bcs_skip_ws_len(z1.end, &len); + if (len == 0) + return EFTYPE; + z2.end = _bcs_skip_nonws_len(z2.begin, &len); + + /* z1 : dst name, z2 : norm */ + snprintf(pa->dst, sizeof(pa->dst), + "%.*s", (int)(z1.end-z1.begin), z1.begin); + snprintf(buf, sizeof(buf), + "%.*s", (int)(z2.end-z2.begin), z2.begin); + pa->norm = strtoul(buf, NULL, 0); + + return 0; +} + +static int +find_dst(struct parse_arg *pasrc, const char *dst) +{ + int ret; + struct parse_arg padst; + struct _lookup *cl; + struct _region data; + + ret = _lookup_seq_open(&cl, CS_PIVOT, _LOOKUP_CASE_IGNORE); + if (ret) + return ret; + + ret = _lookup_seq_lookup(cl, pasrc->dst, &data); + while (ret == 0) { + ret = parse_line(&padst, &data); + if (ret) + break; + if (strcmp(dst, padst.dst) == 0) { + pasrc->norm += padst.norm; + break; + } + ret = _lookup_seq_next(cl, NULL, &data); + } + _lookup_seq_close(cl); + + return ret; +} + +static int +find_best_pivot_lookup(const char *src, const char *dst, char *pivot, + size_t pvlen, unsigned long *rnorm) +{ + int ret; + struct _lookup *cl; + struct _region data; + struct parse_arg pa; + unsigned long norm_min; + char pivot_min[PATH_MAX]; + + ret = _lookup_seq_open(&cl, CS_PIVOT, _LOOKUP_CASE_IGNORE); + if (ret) + return ret; + + norm_min = ULONG_MAX; + + /* find pivot code */ + ret = _lookup_seq_lookup(cl, src, &data); + while (ret == 0) { + ret = parse_line(&pa, &data); + if (ret) + break; + ret = find_dst(&pa, dst); + if (ret) + break; + if (pa.norm < norm_min) { + norm_min = pa.norm; + strlcpy(pivot_min, pa.dst, sizeof(pivot_min)); + } + ret = _lookup_seq_next(cl, NULL, &data); + } + _lookup_seq_close(cl); + + if (ret != ENOENT) + return ret; + if (norm_min == ULONG_MAX) + return ENOENT; + strlcpy(pivot, pivot_min, pvlen); + if (rnorm) + *rnorm = norm_min; + + return 0; +} + +static int +find_best_pivot(const char *src, const char *dst, char *pivot, size_t pvlen, + unsigned long *rnorm) +{ + int ret; + + ret = find_best_pivot_pvdb(src, dst, pivot, pvlen, rnorm); + if (ret == NO_SUCH_FILE) + ret = find_best_pivot_lookup(src, dst, pivot, pvlen, rnorm); + + return ret; +} + +static __inline int +open_serial_mapper(struct _citrus_mapper_area *__restrict ma, + struct _citrus_mapper * __restrict * __restrict rcm, + const char *src, const char *pivot, const char *dst) +{ + char buf[PATH_MAX]; + + snprintf(buf, sizeof(buf), "%s/%s,%s/%s", src, pivot, pivot, dst); + + return _mapper_open_direct(ma, rcm, "mapper_serial", buf); +} + +static struct _citrus_csmapper *csm_none = NULL; +static int +get_none(struct _citrus_mapper_area *__restrict ma, + struct _citrus_csmapper *__restrict *__restrict rcsm) +{ + int ret; + + _THREAD_PRIVATE_MUTEX_LOCK(citrus_csmapper); + if (csm_none) { + *rcsm = csm_none; + ret = 0; + goto quit; + } + + ret = _mapper_open_direct(ma, &csm_none, "mapper_none", ""); + if (ret) + goto quit; + _mapper_set_persistent(csm_none); + + *rcsm = csm_none; + ret = 0; +quit: + _THREAD_PRIVATE_MUTEX_UNLOCK(citrus_csmapper); + return ret; +} + +int +_citrus_csmapper_open(struct _citrus_csmapper * __restrict * __restrict rcsm, + const char * __restrict src, const char * __restrict dst, + uint32_t flags, unsigned long *rnorm) +{ + int ret; + char buf1[PATH_MAX], buf2[PATH_MAX], key[PATH_MAX], pivot[PATH_MAX]; + const char *realsrc, *realdst; + unsigned long norm; + + norm = 0; /* XXX gcc */ + + ret = _citrus_mapper_create_area(&maparea, _PATH_CSMAPPER); + if (ret) + return ret; + + realsrc = _lookup_alias(CS_ALIAS, src, buf1, sizeof(buf1), + _LOOKUP_CASE_IGNORE); + realdst = _lookup_alias(CS_ALIAS, dst, buf2, sizeof(buf2), + _LOOKUP_CASE_IGNORE); + if (!strcmp(realsrc, realdst)) { + ret = get_none(maparea, rcsm); + if (ret == 0 && rnorm != NULL) + *rnorm = 0; + return ret; + } + + snprintf(key, sizeof(key), "%s/%s", realsrc, realdst); + + ret = _mapper_open(maparea, rcsm, key); + if (ret == 0) { + if (rnorm != NULL) + *rnorm = 0; + return 0; + } + if (ret != ENOENT || (flags & _CSMAPPER_F_PREVENT_PIVOT)!=0) + return ret; + + ret = find_best_pivot(realsrc, realdst, pivot, sizeof(pivot), &norm); + if (ret) + return ret; + + ret = open_serial_mapper(maparea, rcsm, realsrc, pivot, realdst); + if (ret == 0 && rnorm != NULL) + *rnorm = norm; + + return ret; +} diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_csmapper.h src/lib/libc/citrus/citrus_csmapper.h --- src.orig/lib/libc/citrus/citrus_csmapper.h Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_csmapper.h Thu Jun 18 13:03:23 2009 @@ -0,0 +1,49 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_csmapper.h,v 1.2 2008/02/09 14:56:20 junyoung Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _CITRUS_CSMAPPER_H_ +#define _CITRUS_CSMAPPER_H + +#define _citrus_csmapper _citrus_mapper +#define _citrus_csmapper_close _citrus_mapper_close +#define _citrus_csmapper_convert _citrus_mapper_convert +#define _citrus_csmapper_init_state _citrus_mapper_init_state +#define _citrus_csmapper_get_state_size _citrus_mapper_get_state_size +#define _citrus_csmapper_get_src_max _citrus_mapper_get_src_max +#define _citrus_csmapper_get_dst_max _citrus_mapper_get_dst_max + +#define _CITRUS_CSMAPPER_F_PREVENT_PIVOT 0x00000001 +__BEGIN_DECLS +int _citrus_csmapper_open(struct _citrus_csmapper *__restrict *__restrict, + const char *__restrict, + const char *__restrict, uint32_t, + unsigned long *); +__END_DECLS + +#endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_ctype.c src/lib/libc/citrus/citrus_ctype.c --- src.orig/lib/libc/citrus/citrus_ctype.c Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_ctype.c Thu Jun 18 13:03:23 2009 @@ -0,0 +1,193 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_ctype.c,v 1.5 2008/06/14 16:01:07 tnozaki Exp $ */ + +/*- + * Copyright (c)1999, 2000, 2001, 2002 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include + +#include "citrus_module.h" +#include "citrus_ctype.h" +#include "citrus_ctype_fallback.h" +#include "citrus_none.h" +#include _CITRUS_DEFAULT_CTYPE_HEADER + +_citrus_ctype_rec_t _citrus_ctype_default = { + &_CITRUS_DEFAULT_CTYPE_OPS, /* cc_ops */ + NULL, /* cc_closure */ + NULL /* cc_module */ +}; + +#ifdef _I18N_DYNAMIC + +static int _initctypemodule(_citrus_ctype_t, char const *, _citrus_module_t, + void *, size_t, size_t); + +static int +_initctypemodule(_citrus_ctype_t cc, char const *modname, + _citrus_module_t handle, void *variable, size_t lenvar, + size_t szpriv) +{ + int ret; + _citrus_ctype_getops_t getops; + + cc->cc_module = handle; + + getops = (_citrus_ctype_getops_t)_citrus_find_getops(cc->cc_module, + modname, + "ctype"); + if (getops == NULL) + return (EINVAL); + + cc->cc_ops = (_citrus_ctype_ops_rec_t *)malloc(sizeof(*cc->cc_ops)); + if (cc->cc_ops == NULL) + return (ENOMEM); + + ret = (*getops)(cc->cc_ops, sizeof(*cc->cc_ops), + _CITRUS_CTYPE_ABI_VERSION); + if (ret) + goto bad; + + /* If return ABI version is not expected, fixup it here*/ + switch (cc->cc_ops->co_abi_version) { + case 0x00000001: + cc->cc_ops->co_btowc = &_citrus_ctype_btowc_fallback; + cc->cc_ops->co_wctob = &_citrus_ctype_wctob_fallback; + /* FALLTHROUGH */ + case 0x00000002: + /* FALLTHROUGH */ + default: + break; + } + + /* validation check */ + if (cc->cc_ops->co_init == NULL || + cc->cc_ops->co_uninit == NULL || + cc->cc_ops->co_get_mb_cur_max == NULL || + cc->cc_ops->co_mblen == NULL || + cc->cc_ops->co_mbrlen == NULL || + cc->cc_ops->co_mbrtowc == NULL || + cc->cc_ops->co_mbsinit == NULL || + cc->cc_ops->co_mbsrtowcs == NULL || + cc->cc_ops->co_mbstowcs == NULL || + cc->cc_ops->co_mbtowc == NULL || + cc->cc_ops->co_wcrtomb == NULL || + cc->cc_ops->co_wcsrtombs == NULL || + cc->cc_ops->co_wcstombs == NULL || + cc->cc_ops->co_wctomb == NULL || + cc->cc_ops->co_btowc == NULL || + cc->cc_ops->co_wctob == NULL) + goto bad; + + /* init and get closure */ + ret = (*cc->cc_ops->co_init)( + &cc->cc_closure, variable, lenvar, szpriv); + if (ret) + goto bad; + + return (0); + +bad: + if (cc->cc_ops) + free(cc->cc_ops); + cc->cc_ops = NULL; + + return (ret); +} + +int +_citrus_ctype_open(_citrus_ctype_t *rcc, + char const *encname, void *variable, size_t lenvar, + size_t szpriv) +{ + int ret; + _citrus_module_t handle; + _citrus_ctype_t cc; + + if (!strcmp(encname, _CITRUS_DEFAULT_CTYPE_NAME)) { + *rcc = &_citrus_ctype_default; + return (0); + } + ret = _citrus_load_module(&handle, encname); + if (ret) + return (ret); + + cc = calloc(1, sizeof(*cc)); + if (!cc) { + _citrus_unload_module(handle); + return (errno); + } + + ret = _initctypemodule(cc, encname, handle, variable, lenvar, szpriv); + if (ret) { + _citrus_unload_module(cc->cc_module); + free(cc); + return (ret); + } + + *rcc = cc; + + return (0); +} + +void +_citrus_ctype_close(_citrus_ctype_t cc) +{ + if (cc == &_citrus_ctype_default) + return; + (*cc->cc_ops->co_uninit)(cc->cc_closure); + free(cc->cc_ops); + _citrus_unload_module(cc->cc_module); + free(cc); +} + +#else +/* !_I18N_DYNAMIC */ + +int +/*ARGSUSED*/ +_citrus_ctype_open(_citrus_ctype_t *rcc, + char const *encname, void *variable, size_t lenvar, + size_t szpriv) +{ + if (!strcmp(encname, _CITRUS_DEFAULT_CTYPE_NAME)) { + *rcc = &_citrus_ctype_default; + return (0); + } + return (EINVAL); +} + +void +/*ARGSUSED*/ +_citrus_ctype_close(_citrus_ctype_t cc) +{ +} + +#endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_ctype.h src/lib/libc/citrus/citrus_ctype.h --- src.orig/lib/libc/citrus/citrus_ctype.h Sun Aug 7 19:16:23 2005 +++ src/lib/libc/citrus/citrus_ctype.h Thu Jun 18 13:03:23 2009 @@ -33,4 +33,111 @@ #include "citrus_ctype_local.h" +typedef struct _citrus_ctype_rec *_citrus_ctype_t; + +__BEGIN_DECLS +int _citrus_ctype_open(_citrus_ctype_t * __restrict, + char const * __restrict, void * __restrict, + size_t, size_t); +void _citrus_ctype_close(_citrus_ctype_t); +__END_DECLS + +static __inline unsigned +_citrus_ctype_get_mb_cur_max(_citrus_ctype_t cc) +{ + return (*cc->cc_ops->co_get_mb_cur_max)(cc->cc_closure); +} + +static __inline int +_citrus_ctype_mblen(_citrus_ctype_t cc, const char *s, size_t n, int *nresult) +{ + return (*cc->cc_ops->co_mblen)(cc->cc_closure, s, n, nresult); +} + +static __inline int +_citrus_ctype_mbrlen(_citrus_ctype_t cc, const char *s, size_t n, + void *pspriv, size_t *nresult) +{ + return (*cc->cc_ops->co_mbrlen)(cc->cc_closure, s, n, pspriv, nresult); +} + +static __inline int +_citrus_ctype_mbrtowc(_citrus_ctype_t cc, wchar_t *pwc, const char *s, + size_t n, void *pspriv, size_t *nresult) +{ + return (*cc->cc_ops->co_mbrtowc)(cc->cc_closure, pwc, s, n, pspriv, + nresult); +} + +static __inline int +_citrus_ctype_mbsinit(_citrus_ctype_t cc, void const *pspriv, int *nresult) +{ + return (*cc->cc_ops->co_mbsinit)(cc->cc_closure, pspriv, nresult); +} + +static __inline int +_citrus_ctype_mbsrtowcs(_citrus_ctype_t cc, wchar_t *pwcs, const char **s, + size_t n, void *pspriv, size_t *nresult) +{ + return (*cc->cc_ops->co_mbsrtowcs)(cc->cc_closure, pwcs, s, n, pspriv, + nresult); +} + +static __inline int +_citrus_ctype_mbstowcs(_citrus_ctype_t cc, wchar_t *pwcs, const char *s, + size_t n, size_t *nresult) +{ + return (*cc->cc_ops->co_mbstowcs)(cc->cc_closure, pwcs, s, n, nresult); +} + +static __inline int +_citrus_ctype_mbtowc(_citrus_ctype_t cc, wchar_t *pw, const char *s, size_t n, + int *nresult) +{ + return (*cc->cc_ops->co_mbtowc)(cc->cc_closure, pw, s, n, nresult); +} + +static __inline int +_citrus_ctype_wcrtomb(_citrus_ctype_t cc, char *s, wchar_t wc, + void *pspriv, size_t *nresult) +{ + return (*cc->cc_ops->co_wcrtomb)(cc->cc_closure, s, wc, pspriv, + nresult); +} + +static __inline int +_citrus_ctype_wcsrtombs(_citrus_ctype_t cc, char *s, const wchar_t **ppwcs, + size_t n, void *pspriv, size_t *nresult) +{ + return (*cc->cc_ops->co_wcsrtombs)(cc->cc_closure, s, ppwcs, n, + pspriv, nresult); +} + +static __inline int +_citrus_ctype_wcstombs(_citrus_ctype_t cc, char *s, const wchar_t *wcs, + size_t n, size_t *nresult) +{ + return (*cc->cc_ops->co_wcstombs)(cc->cc_closure, s, wcs, n, nresult); +} + +static __inline int +_citrus_ctype_wctomb(_citrus_ctype_t cc, char *s, wchar_t wc, int *nresult) +{ + return (*cc->cc_ops->co_wctomb)(cc->cc_closure, s, wc, nresult); +} + +static __inline int +_citrus_ctype_btowc(_citrus_ctype_t cc, int c, wint_t *wcresult) +{ + return (*cc->cc_ops->co_btowc)(cc, c, wcresult); +} + +static __inline int +_citrus_ctype_wctob(_citrus_ctype_t cc, wint_t c, int *cresult) +{ + return (*cc->cc_ops->co_wctob)(cc, c, cresult); +} + +extern _citrus_ctype_rec_t _citrus_ctype_default; + #endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_ctype_fallback.c src/lib/libc/citrus/citrus_ctype_fallback.c --- src.orig/lib/libc/citrus/citrus_ctype_fallback.c Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_ctype_fallback.c Thu Jun 18 13:03:23 2009 @@ -0,0 +1,98 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_ctype_fallback.c,v 1.2 2003/06/27 14:52:25 yamt Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include + +#include "citrus_module.h" +#include "citrus_ctype.h" +#include "citrus_ctype_fallback.h" + +/* + * for ABI version >= 0x00000002 + */ + +int +_citrus_ctype_btowc_fallback(_citrus_ctype_rec_t * __restrict cc, + int c, wint_t * __restrict wcresult) +{ + char mb; + /* + * what we need is _PRIVSIZE + * and we know that it's smaller than sizeof(mbstate_t). + */ + char pspriv[sizeof(mbstate_t)]; + wchar_t wc; + size_t nr; + int err; + + if (c == EOF) { + *wcresult = WEOF; + return 0; + } + + memset(&pspriv, 0, sizeof(pspriv)); + mb = (char)(unsigned)c; + err = _citrus_ctype_mbrtowc(cc, &wc, &mb, 1, (void *)&pspriv, &nr); + if (!err && (nr == 0 || nr == 1)) + *wcresult = wc; + else + *wcresult = WEOF; + + return 0; +} + +int +_citrus_ctype_wctob_fallback(_citrus_ctype_rec_t * __restrict cc, + wint_t wc, int * __restrict cresult) +{ + /* + * what we need is _PRIVSIZE + * and we know that it's smaller than sizeof(mbstate_t). + */ + char pspriv[sizeof(mbstate_t)]; + char buf[MB_LEN_MAX]; + size_t nr; + int err; + + if (wc == WEOF) { + *cresult = EOF; + return 0; + } + memset(&pspriv, 0, sizeof(pspriv)); + err = _citrus_ctype_wcrtomb(cc, buf, (wchar_t)wc, (void *)&pspriv, &nr); + if (!err && nr == 1) + *cresult = buf[0]; + else + *cresult = EOF; + + return 0; +} diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_ctype_fallback.h src/lib/libc/citrus/citrus_ctype_fallback.h --- src.orig/lib/libc/citrus/citrus_ctype_fallback.h Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_ctype_fallback.h Thu Jun 18 13:03:23 2009 @@ -0,0 +1,39 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_ctype_fallback.h,v 1.1 2003/03/05 20:18:15 tshiozak Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _CITRUS_CTYPE_FALLBACK_H_ +#define _CITRUS_CTYPE_FALLBACK_H_ + +/* fallback functions for 0x00000002 */ +int _citrus_ctype_btowc_fallback(_citrus_ctype_rec_t * __restrict, + int, wint_t * __restrict); +int _citrus_ctype_wctob_fallback(_citrus_ctype_rec_t * __restrict, + wint_t, int * __restrict); + +#endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_ctype_local.h src/lib/libc/citrus/citrus_ctype_local.h --- src.orig/lib/libc/citrus/citrus_ctype_local.h Sun Aug 7 19:16:23 2005 +++ src/lib/libc/citrus/citrus_ctype_local.h Thu Jun 18 13:03:23 2009 @@ -1,7 +1,5 @@ -#ifndef _CITRUS_CTYPE_LOCAL_H_ -#define _CITRUS_CTYPE_LOCAL_H_ /* $OpenBSD: citrus_ctype_local.h,v 1.1 2005/08/07 10:16:23 espie Exp $ */ -/* $NetBSD: citrus_ctype_local.h,v 1.2 2003/03/05 20:18:15 tshiozak Exp $ */ +/* $NetBSD: citrus_ctype_local.h,v 1.3 2008/02/09 14:56:20 junyoung Exp $ */ /*- * Copyright (c)2002 Citrus Project, @@ -30,7 +28,172 @@ * */ +#ifndef _CITRUS_CTYPE_LOCAL_H_ +#define _CITRUS_CTYPE_LOCAL_H_ + +#define _CITRUS_CTYPE_GETOPS_FUNC_BASE(_n_) \ +int _n_(_citrus_ctype_ops_rec_t *, size_t, uint32_t) +#define _CITRUS_CTYPE_GETOPS_FUNC(_n_) \ +_CITRUS_CTYPE_GETOPS_FUNC_BASE(_citrus_##_n_##_ctype_getops) + +#define _CITRUS_CTYPE_DECLS(_e_) \ +static int _citrus_##_e_##_ctype_init \ + (void ** __restrict, void * __restrict, size_t, size_t); \ +static void _citrus_##_e_##_ctype_uninit(void *); \ +static unsigned _citrus_##_e_##_ctype_get_mb_cur_max(void *); \ +static int _citrus_##_e_##_ctype_mblen(void * __restrict, \ + const char * __restrict, \ + size_t, int * __restrict); \ +static int _citrus_##_e_##_ctype_mbrlen(void * __restrict, \ + const char * __restrict, \ + size_t, void * __restrict, \ + size_t * __restrict); \ +static int _citrus_##_e_##_ctype_mbrtowc(void * __restrict, \ + wchar_t * __restrict, \ + const char * __restrict, size_t, \ + void * __restrict, \ + size_t * __restrict); \ +static int _citrus_##_e_##_ctype_mbsinit(void * __restrict, \ + void const * __restrict, \ + int * __restrict); \ +static int _citrus_##_e_##_ctype_mbsrtowcs(void * __restrict, \ + wchar_t * __restrict, \ + const char ** __restrict, \ + size_t, void * __restrict, \ + size_t * __restrict); \ +static int _citrus_##_e_##_ctype_mbstowcs(void * __restrict, \ + wchar_t * __restrict, \ + const char * __restrict, \ + size_t, size_t * __restrict); \ +static int _citrus_##_e_##_ctype_mbtowc(void * __restrict, \ + wchar_t * __restrict, \ + const char * __restrict, \ + size_t, int * __restrict); \ +static int _citrus_##_e_##_ctype_wcrtomb(void * __restrict, \ + char * __restrict, wchar_t, \ + void * __restrict, \ + size_t * __restrict); \ +static int _citrus_##_e_##_ctype_wcsrtombs(void * __restrict, \ + char * __restrict, \ + const wchar_t ** __restrict, \ + size_t, void * __restrict, \ + size_t * __restrict); \ +static int _citrus_##_e_##_ctype_wcstombs(void * __restrict, \ + char * __restrict, \ + const wchar_t * __restrict, \ + size_t, size_t * __restrict); \ +static int _citrus_##_e_##_ctype_wctomb(void * __restrict, \ + char * __restrict, \ + wchar_t, int * __restrict); \ +static int _citrus_##_e_##_ctype_btowc(_citrus_ctype_rec_t * __restrict, \ + int, wint_t * __restrict); \ +static int _citrus_##_e_##_ctype_wctob(_citrus_ctype_rec_t * __restrict, \ + wint_t, int * __restrict) + +#define _CITRUS_CTYPE_DEF_OPS(_e_) \ +_citrus_ctype_ops_rec_t _citrus_##_e_##_ctype_ops = { \ + /* co_abi_version */ _CITRUS_CTYPE_ABI_VERSION, \ + /* co_init */ &_citrus_##_e_##_ctype_init, \ + /* co_uninit */ &_citrus_##_e_##_ctype_uninit, \ + /* co_get_mb_cur_max */ &_citrus_##_e_##_ctype_get_mb_cur_max, \ + /* co_mblen */ &_citrus_##_e_##_ctype_mblen, \ + /* co_mbrlen */ &_citrus_##_e_##_ctype_mbrlen, \ + /* co_mbrtowc */ &_citrus_##_e_##_ctype_mbrtowc, \ + /* co_mbsinit */ &_citrus_##_e_##_ctype_mbsinit, \ + /* co_mbsrtowcs */ &_citrus_##_e_##_ctype_mbsrtowcs, \ + /* co_mbstowcs */ &_citrus_##_e_##_ctype_mbstowcs, \ + /* co_mbtowc */ &_citrus_##_e_##_ctype_mbtowc, \ + /* co_wcrtomb */ &_citrus_##_e_##_ctype_wcrtomb, \ + /* co_wcsrtombs */ &_citrus_##_e_##_ctype_wcsrtombs, \ + /* co_wcstombs */ &_citrus_##_e_##_ctype_wcstombs, \ + /* co_wctomb */ &_citrus_##_e_##_ctype_wctomb, \ + /* co_btowc */ &_citrus_##_e_##_ctype_btowc, \ + /* co_wctob */ &_citrus_##_e_##_ctype_wctob \ +} + +typedef struct _citrus_ctype_ops_rec _citrus_ctype_ops_rec_t; +typedef struct _citrus_ctype_rec _citrus_ctype_rec_t; + +typedef int (*_citrus_ctype_init_t) + (void ** __restrict, void * __restrict, size_t, size_t); +typedef void (*_citrus_ctype_uninit_t)(void *); +typedef unsigned (*_citrus_ctype_get_mb_cur_max_t)(void *); +typedef int (*_citrus_ctype_mblen_t) + (void * __restrict, const char * __restrict, size_t, int * __restrict); +typedef int (*_citrus_ctype_mbrlen_t) + (void * __restrict, const char * __restrict, size_t, + void * __restrict, size_t * __restrict); +typedef int (*_citrus_ctype_mbrtowc_t) + (void * __restrict, wchar_t * __restrict, const char * __restrict, + size_t, void * __restrict, size_t * __restrict); +typedef int (*_citrus_ctype_mbsinit_t) + (void * __restrict, const void * __restrict, int * __restrict); +typedef int (*_citrus_ctype_mbsrtowcs_t) + (void * __restrict, wchar_t * __restrict, const char ** __restrict, + size_t, void * __restrict, + size_t * __restrict); +typedef int (*_citrus_ctype_mbstowcs_t) + (void * __restrict, wchar_t * __restrict, const char * __restrict, + size_t, size_t * __restrict); +typedef int (*_citrus_ctype_mbtowc_t) + (void * __restrict, wchar_t * __restrict, const char * __restrict, + size_t, int * __restrict); +typedef int (*_citrus_ctype_wcrtomb_t) + (void * __restrict, char * __restrict, wchar_t, void * __restrict, + size_t * __restrict); +typedef int (*_citrus_ctype_wcsrtombs_t) + (void * __restrict, char * __restrict, const wchar_t ** __restrict, + size_t, void * __restrict, size_t * __restrict); +typedef int (*_citrus_ctype_wcstombs_t) + (void * __restrict, char * __restrict, const wchar_t * __restrict, + size_t, size_t * __restrict); +typedef int (*_citrus_ctype_wctomb_t) + (void * __restrict, char * __restrict, wchar_t, int * __restrict); +typedef int (*_citrus_ctype_btowc_t) + (_citrus_ctype_rec_t * __restrict, int, wint_t * __restrict); +typedef int (*_citrus_ctype_wctob_t) + (_citrus_ctype_rec_t * __restrict, wint_t, int * __restrict); + +/* + * ABI Version change log: + * 0x00000001 + * initial version + * 0x00000002 + * ops record: btowc and wctob are added. + * ctype record: unchanged. + */ +#define _CITRUS_CTYPE_ABI_VERSION 0x00000002 +struct _citrus_ctype_ops_rec { + uint32_t co_abi_version; + /* version 0x00000001 */ + _citrus_ctype_init_t co_init; + _citrus_ctype_uninit_t co_uninit; + _citrus_ctype_get_mb_cur_max_t co_get_mb_cur_max; + _citrus_ctype_mblen_t co_mblen; + _citrus_ctype_mbrlen_t co_mbrlen; + _citrus_ctype_mbrtowc_t co_mbrtowc; + _citrus_ctype_mbsinit_t co_mbsinit; + _citrus_ctype_mbsrtowcs_t co_mbsrtowcs; + _citrus_ctype_mbstowcs_t co_mbstowcs; + _citrus_ctype_mbtowc_t co_mbtowc; + _citrus_ctype_wcrtomb_t co_wcrtomb; + _citrus_ctype_wcsrtombs_t co_wcsrtombs; + _citrus_ctype_wcstombs_t co_wcstombs; + _citrus_ctype_wctomb_t co_wctomb; + /* version 0x00000002 */ + _citrus_ctype_btowc_t co_btowc; + _citrus_ctype_wctob_t co_wctob; +}; + #define _CITRUS_DEFAULT_CTYPE_NAME "NONE" +#define _CITRUS_DEFAULT_CTYPE_OPS _citrus_NONE_ctype_ops +#define _CITRUS_DEFAULT_CTYPE_HEADER "citrus_none.h" -#endif +typedef _CITRUS_CTYPE_GETOPS_FUNC_BASE((*_citrus_ctype_getops_t)); +struct _citrus_ctype_rec { + _citrus_ctype_ops_rec_t *cc_ops; + void *cc_closure; + _citrus_module_t cc_module; +}; +#endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_ctype_template.h src/lib/libc/citrus/citrus_ctype_template.h --- src.orig/lib/libc/citrus/citrus_ctype_template.h Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_ctype_template.h Thu Jun 18 13:03:23 2009 @@ -0,0 +1,733 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_ctype_template.h,v 1.35 2008/02/09 14:56:20 junyoung Exp $ */ + +/*- + * Copyright (c)2002 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/*- + * Copyright (c) 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Paul Borman at Krystal Technologies. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + + +/* + * CAUTION: THIS IS NOT STANDALONE FILE + * + * function templates of ctype encoding handler for each encodings. + * + * you need to define the macros below: + * + * _FUNCNAME(method) : + * It should convine the real function name for the method. + * e.g. _FUNCNAME(mbrtowc) should be expanded to + * _EUC_ctype_mbrtowc + * for EUC locale. + * + * _CEI_TO_STATE(cei, method) : + * It should be expanded to the pointer of the method-internal state + * structures. + * e.g. _CEI_TO_STATE(cei, mbrtowc) might be expanded to + * (cei)->states.s_mbrtowc + * This structure may use if the function is called as + * mbrtowc(&wc, s, n, NULL); + * Such individual structures are needed by: + * mblen + * mbrlen + * mbrtowc + * mbtowc + * mbsrtowcs + * wcrtomb + * wcsrtombs + * wctomb + * These need to be keeped in the ctype encoding information structure, + * pointed by "cei". + * + * _ENCODING_INFO : + * It should be expanded to the name of the encoding information structure. + * e.g. For EUC encoding, this macro is expanded to _EUCInfo. + * Encoding information structure need to contain the common informations + * for the codeset. + * + * _ENCODING_STATE : + * It should be expanded to the name of the encoding state structure. + * e.g. For EUC encoding, this macro is expanded to _EUCState. + * Encoding state structure need to contain the context-dependent states, + * which are "unpacked-form" of mbstate_t type and keeped during sequent + * calls of mb/wc functions, + * + * _ENCODING_IS_STATE_DEPENDENT : + * If the encoding is state dependent, this should be expanded to + * non-zero integral value. Otherwise, 0. + * + * _STATE_NEEDS_EXPLICIT_INIT(ps) : + * some encodings, states needs some explicit initialization. + * (ie. initialization with memset isn't enough.) + * If the encoding state pointed by "ps" needs to be initialized + * explicitly, return non-zero. Otherwize, 0. + * + */ + + +/* prototypes */ + +__BEGIN_DECLS +static void _FUNCNAME(init_state)(_ENCODING_INFO * __restrict, + _ENCODING_STATE * __restrict); +static void _FUNCNAME(pack_state)(_ENCODING_INFO * __restrict, + void * __restrict, + const _ENCODING_STATE * __restrict); +static void _FUNCNAME(unpack_state)(_ENCODING_INFO * __restrict, + _ENCODING_STATE * __restrict, + const void * __restrict); +#if _ENCODING_IS_STATE_DEPENDENT +static int _FUNCNAME(put_state_reset)(_ENCODING_INFO * __restrict, + char * __restrict, size_t, + _ENCODING_STATE * __restrict, + size_t * __restrict); +#endif + +/* + * standard form of mbrtowc_priv. + * + * note (differences from real mbrtowc): + * - 3rd parameter is not "const char *s" but "const char **s". + * after the call of the function, *s will point the first byte of + * the next character. + * - additional 4th parameter is the size of src buffer. + * - 5th parameter is unpacked encoding-dependent state structure. + * - additional 6th parameter is the storage to be stored + * the return value in the real mbrtowc context. + * - return value means "errno" in the real mbrtowc context. + */ + +static int _FUNCNAME(mbrtowc_priv)(_ENCODING_INFO * __restrict, + wchar_t * __restrict, + const char ** __restrict, + size_t, _ENCODING_STATE * __restrict, + size_t * __restrict); + +/* + * standard form of wcrtomb_priv. + * + * note (differences from real wcrtomb): + * - additional 3th parameter is the size of src buffer. + * - 5th parameter is unpacked encoding-dependent state structure. + * - additional 6th parameter is the storage to be stored + * the return value in the real mbrtowc context. + * - return value means "errno" in the real wcrtomb context. + * - caller should ensure that 2nd parameter isn't NULL. + * (XXX inconsist with mbrtowc_priv) + */ + +static int _FUNCNAME(wcrtomb_priv)(_ENCODING_INFO * __restrict, + char * __restrict, size_t, wchar_t, + _ENCODING_STATE * __restrict, + size_t * __restrict); +__END_DECLS + + +/* + * macros + */ + +#define _TO_CEI(_cl_) ((_CTYPE_INFO*)(_cl_)) + + +/* + * templates + */ + +/* internal routines */ + +static __inline int +_FUNCNAME(mbtowc_priv)(_ENCODING_INFO * __restrict ei, + wchar_t * __restrict pwc, const char * __restrict s, + size_t n, _ENCODING_STATE * __restrict psenc, + int * __restrict nresult) +{ + _ENCODING_STATE state; + size_t nr; + int err = 0; + + if (s == NULL) { + _FUNCNAME(init_state)(ei, psenc); + *nresult = _ENCODING_IS_STATE_DEPENDENT; + return (0); + } + + state = *psenc; + err = _FUNCNAME(mbrtowc_priv)(ei, pwc, (const char **)&s, n, psenc, &nr); + if (nr == (size_t)-2) + err = EILSEQ; + if (err) { + /* In error case, we should restore the state. */ + *psenc = state; + *nresult = -1; + return (err); + } + + *nresult = (int)nr; + + return (0); +} + +static int +_FUNCNAME(mbsrtowcs_priv)(_ENCODING_INFO * __restrict ei, + wchar_t * __restrict pwcs, + const char ** __restrict s, + size_t n, _ENCODING_STATE * __restrict psenc, + size_t * __restrict nresult) +{ + int err, cnt; + size_t siz; + const char *s0; + size_t mbcurmax; + + /* if pwcs is NULL, ignore n */ + if (pwcs == NULL) + n = 1; /* arbitrary >0 value */ + + err = cnt = 0; + s0 = *s; /* to keep *s unchanged for now, use copy instead. */ + mbcurmax = _ENCODING_MB_CUR_MAX(ei); + while (n > 0) { + err = _FUNCNAME(mbrtowc_priv)(ei, pwcs, &s0, mbcurmax, + psenc, &siz); + if (siz == (size_t)-2) + err = EILSEQ; + if (err) { + cnt = -1; + goto bye; + } + switch (siz) { + case 0: + if (pwcs) { + _FUNCNAME(init_state)(ei, psenc); + } + s0 = 0; + goto bye; + default: + if (pwcs) { + pwcs++; + n--; + } + cnt++; + break; + } + } +bye: + if (pwcs) + *s = s0; + + *nresult = (size_t)cnt; + + return err; +} + + +static int +_FUNCNAME(wcsrtombs_priv)(_ENCODING_INFO * __restrict ei, char * __restrict s, + const wchar_t ** __restrict pwcs, + size_t n, _ENCODING_STATE * __restrict psenc, + size_t * __restrict nresult) +{ + int cnt = 0, err; + char buf[MB_LEN_MAX]; + size_t siz; + const wchar_t* pwcs0; +#if _ENCODING_IS_STATE_DEPENDENT + _ENCODING_STATE state; +#endif + + pwcs0 = *pwcs; + + if (!s) + n = 1; + + while (n > 0) { +#if _ENCODING_IS_STATE_DEPENDENT + state = *psenc; +#endif + err = _FUNCNAME(wcrtomb_priv)(ei, buf, sizeof(buf), + *pwcs0, psenc, &siz); + if (siz == (size_t)-1) { + *nresult = siz; + return (err); + } + + if (s) { + if (n < siz) { +#if _ENCODING_IS_STATE_DEPENDENT + *psenc = state; +#endif + break; + } + memcpy(s, buf, siz); + s += siz; + n -= siz; + } + cnt += siz; + if (!*pwcs0) { + if (s) { + _FUNCNAME(init_state)(ei, psenc); + } + pwcs0 = 0; + cnt--; /* don't include terminating null */ + break; + } + pwcs0++; + } + if (s) + *pwcs = pwcs0; + + *nresult = (size_t)cnt; + return (0); +} + + +/* ---------------------------------------------------------------------- + * templates for public functions + */ + +#define _RESTART_BEGIN(_func_, _cei_, _pspriv_, _pse_) \ +do { \ + _ENCODING_STATE _state; \ + do { \ + if (_pspriv_ == NULL) { \ + _pse_ = &_CEI_TO_STATE(_cei_, _func_); \ + if (_STATE_NEEDS_EXPLICIT_INIT(_pse_)) \ + _FUNCNAME(init_state)(_CEI_TO_EI(_cei_), \ + (_pse_)); \ + } else { \ + _pse_ = &_state; \ + _FUNCNAME(unpack_state)(_CEI_TO_EI(_cei_), \ + _pse_, _pspriv_); \ + } \ + } while (/*CONSTCOND*/0) + +#define _RESTART_END(_func_, _cei_, _pspriv_, _pse_) \ + if (_pspriv_ != NULL) { \ + _FUNCNAME(pack_state)(_CEI_TO_EI(_cei_), _pspriv_, \ + _pse_); \ + } \ +} while (/*CONSTCOND*/0) + +int +_FUNCNAME(ctype_getops)(_citrus_ctype_ops_rec_t *ops, size_t lenops, + uint32_t expected_version) +{ + if (expected_version<_CITRUS_CTYPE_ABI_VERSION || lenops lenps) + return (EINVAL); + + cei = calloc(1, sizeof(_CTYPE_INFO)); + if (cei == NULL) + return (ENOMEM); + + *cl = (void *)cei; + + return _FUNCNAME(encoding_module_init)(_CEI_TO_EI(cei), var, lenvar); +} + +static void +_FUNCNAME(ctype_uninit)(void *cl) +{ + if (cl) { + _FUNCNAME(encoding_module_uninit)(_CEI_TO_EI(_TO_CEI(cl))); + free(cl); + } +} + +static unsigned +/*ARGSUSED*/ +_FUNCNAME(ctype_get_mb_cur_max)(void *cl) +{ + return _ENCODING_MB_CUR_MAX(_CEI_TO_EI(_TO_CEI(cl))); +} + +static int +_FUNCNAME(ctype_mblen)(void * __restrict cl, + const char * __restrict s, size_t n, + int * __restrict nresult) +{ + _ENCODING_STATE *psenc; + _ENCODING_INFO *ei; + + psenc = &_CEI_TO_STATE(_TO_CEI(cl), mblen); + ei = _CEI_TO_EI(_TO_CEI(cl)); + if (_STATE_NEEDS_EXPLICIT_INIT(psenc)) + _FUNCNAME(init_state)(ei, psenc); + return _FUNCNAME(mbtowc_priv)(ei, NULL, s, n, psenc, nresult); +} + +static int +_FUNCNAME(ctype_mbrlen)(void * __restrict cl, const char * __restrict s, + size_t n, void * __restrict pspriv, + size_t * __restrict nresult) +{ + _ENCODING_STATE *psenc; + _ENCODING_INFO *ei; + int err = 0; + + ei = _CEI_TO_EI(_TO_CEI(cl)); + _RESTART_BEGIN(mbrlen, _TO_CEI(cl), pspriv, psenc); + if (s == NULL) { + _FUNCNAME(init_state)(ei, psenc); + *nresult = 0; + } else { + err = _FUNCNAME(mbrtowc_priv)(ei, NULL, (const char **)&s, n, + (void *)psenc, nresult); + } + _RESTART_END(mbrlen, _TO_CEI(cl), pspriv, psenc); + + return (err); +} + +static int +_FUNCNAME(ctype_mbrtowc)(void * __restrict cl, wchar_t * __restrict pwc, + const char * __restrict s, size_t n, + void * __restrict pspriv, size_t * __restrict nresult) +{ + _ENCODING_STATE *psenc; + _ENCODING_INFO *ei; + int err = 0; + + ei = _CEI_TO_EI(_TO_CEI(cl)); + _RESTART_BEGIN(mbrtowc, _TO_CEI(cl), pspriv, psenc); + if (s == NULL) { + _FUNCNAME(init_state)(ei, psenc); + *nresult = 0; + } else { + err = _FUNCNAME(mbrtowc_priv)(ei, pwc, (const char **)&s, n, + (void *)psenc, nresult); + } + _RESTART_END(mbrtowc, _TO_CEI(cl), pspriv, psenc); + + return (err); +} + +static int +/*ARGSUSED*/ +_FUNCNAME(ctype_mbsinit)(void * __restrict cl, const void * __restrict pspriv, + int * __restrict nresult) +{ + _ENCODING_STATE state; + + if (pspriv == NULL) { + *nresult = 1; + return (0); + } + + _FUNCNAME(unpack_state)(_CEI_TO_EI(_TO_CEI(cl)), &state, pspriv); + + *nresult = (state.chlen == 0); /* XXX: FIXME */ + + return (0); +} + +static int +_FUNCNAME(ctype_mbsrtowcs)(void * __restrict cl, wchar_t * __restrict pwcs, + const char ** __restrict s, size_t n, + void * __restrict pspriv, + size_t * __restrict nresult) +{ + _ENCODING_STATE *psenc; + _ENCODING_INFO *ei; + int err = 0; + + ei = _CEI_TO_EI(_TO_CEI(cl)); + _RESTART_BEGIN(mbsrtowcs, _TO_CEI(cl), pspriv, psenc); + err = _FUNCNAME(mbsrtowcs_priv)(ei, pwcs, s, n, psenc, nresult); + _RESTART_END(mbsrtowcs, _TO_CEI(cl), pspriv, psenc); + + return (err); +} + +static int +_FUNCNAME(ctype_mbstowcs)(void * __restrict cl, wchar_t * __restrict pwcs, + const char * __restrict s, size_t n, + size_t * __restrict nresult) +{ + int err; + _ENCODING_STATE state; + _ENCODING_INFO *ei; + + ei = _CEI_TO_EI(_TO_CEI(cl)); + _FUNCNAME(init_state)(ei, &state); + err = _FUNCNAME(mbsrtowcs_priv)(ei, pwcs, (const char **)&s, n, + &state, nresult); + if (*nresult == (size_t)-2) { + err = EILSEQ; + *nresult = (size_t)-1; + } + + return (err); +} + +static int +_FUNCNAME(ctype_mbtowc)(void * __restrict cl, wchar_t * __restrict pwc, + const char * __restrict s, size_t n, + int * __restrict nresult) +{ + _ENCODING_STATE *psenc; + _ENCODING_INFO *ei; + + psenc = &_CEI_TO_STATE(_TO_CEI(cl), mbtowc); + ei = _CEI_TO_EI(_TO_CEI(cl)); + if (_STATE_NEEDS_EXPLICIT_INIT(psenc)) + _FUNCNAME(init_state)(ei, psenc); + return _FUNCNAME(mbtowc_priv)(ei, pwc, s, n, psenc, nresult); +} + +static int +_FUNCNAME(ctype_wcrtomb)(void * __restrict cl, char * __restrict s, wchar_t wc, + void * __restrict pspriv, size_t * __restrict nresult) +{ + _ENCODING_STATE *psenc; + char buf[MB_LEN_MAX]; + int err = 0; + size_t sz; +#if _ENCODING_IS_STATE_DEPENDENT + size_t rsz = 0; +#endif + + if (s == NULL) { + /* + * use internal buffer. + */ + s = buf; + wc = L'\0'; /* SUSv3 */ + } + + _RESTART_BEGIN(wcrtomb, _TO_CEI(cl), pspriv, psenc); + sz = _ENCODING_MB_CUR_MAX(_CEI_TO_EI(_TO_CEI(cl))); +#if _ENCODING_IS_STATE_DEPENDENT + if (wc == L'\0') { + /* reset state */ + err = _FUNCNAME(put_state_reset)(_CEI_TO_EI(_TO_CEI(cl)), s, + sz, psenc, &rsz); + if (err) { + *nresult = -1; + goto quit; + } + s += rsz; + sz -= rsz; + } +#endif + err = _FUNCNAME(wcrtomb_priv)(_CEI_TO_EI(_TO_CEI(cl)), s, sz, + wc, psenc, nresult); +#if _ENCODING_IS_STATE_DEPENDENT + if (err == 0) + *nresult += rsz; +quit: +#endif + if (err == E2BIG) + err = EINVAL; + _RESTART_END(wcrtomb, _TO_CEI(cl), pspriv, psenc); + + return err; +} + +static int +/*ARGSUSED*/ +_FUNCNAME(ctype_wcsrtombs)(void * __restrict cl, char * __restrict s, + const wchar_t ** __restrict pwcs, size_t n, + void * __restrict pspriv, + size_t * __restrict nresult) +{ + _ENCODING_STATE *psenc; + _ENCODING_INFO *ei; + int err = 0; + + ei = _CEI_TO_EI(_TO_CEI(cl)); + _RESTART_BEGIN(wcsrtombs, _TO_CEI(cl), pspriv, psenc); + err = _FUNCNAME(wcsrtombs_priv)(ei, s, pwcs, n, psenc, nresult); + _RESTART_END(wcsrtombs, _TO_CEI(cl), pspriv, psenc); + + return err; +} + +static int +/*ARGSUSED*/ +_FUNCNAME(ctype_wcstombs)(void * __restrict cl, char * __restrict s, + const wchar_t * __restrict pwcs, size_t n, + size_t * __restrict nresult) +{ + _ENCODING_STATE state; + _ENCODING_INFO *ei; + int err; + + ei = _CEI_TO_EI(_TO_CEI(cl)); + _FUNCNAME(init_state)(ei, &state); + err = _FUNCNAME(wcsrtombs_priv)(ei, s, (const wchar_t **)&pwcs, n, + &state, nresult); + + return err; +} + +static int +_FUNCNAME(ctype_wctomb)(void * __restrict cl, char * __restrict s, wchar_t wc, + int * __restrict nresult) +{ + _ENCODING_STATE *psenc; + _ENCODING_INFO *ei; + size_t nr, sz; +#if _ENCODING_IS_STATE_DEPENDENT + size_t rsz = 0; +#endif + int err = 0; + + ei = _CEI_TO_EI(_TO_CEI(cl)); + psenc = &_CEI_TO_STATE(_TO_CEI(cl), wctomb); + if (_STATE_NEEDS_EXPLICIT_INIT(psenc)) + _FUNCNAME(init_state)(ei, psenc); + if (s == NULL) { + _FUNCNAME(init_state)(ei, psenc); + *nresult = _ENCODING_IS_STATE_DEPENDENT; + return 0; + } + sz = _ENCODING_MB_CUR_MAX(_CEI_TO_EI(_TO_CEI(cl))); +#if _ENCODING_IS_STATE_DEPENDENT + if (wc == L'\0') { + /* reset state */ + err = _FUNCNAME(put_state_reset)(_CEI_TO_EI(_TO_CEI(cl)), s, + sz, psenc, &rsz); + if (err) { + *nresult = -1; /* XXX */ + return 0; + } + s += rsz; + sz -= rsz; + } +#endif + err = _FUNCNAME(wcrtomb_priv)(ei, s, sz, wc, psenc, &nr); +#if _ENCODING_IS_STATE_DEPENDENT + if (err == 0) + *nresult = (int)(nr + rsz); + else +#endif + *nresult = (int)nr; + + return 0; +} + +static int +/*ARGSUSED*/ +_FUNCNAME(ctype_btowc)(_citrus_ctype_rec_t * __restrict cc, + int c, wint_t * __restrict wcresult) +{ + _ENCODING_STATE state; + _ENCODING_INFO *ei; + char mb; + char const *s; + wchar_t wc; + size_t nr; + int err; + + if (c == EOF) { + *wcresult = WEOF; + return 0; + } + ei = _CEI_TO_EI(_TO_CEI(cc->cc_closure)); + _FUNCNAME(init_state)(ei, &state); + mb = (char)(unsigned)c; + s = &mb; + err = _FUNCNAME(mbrtowc_priv)(ei, &wc, &s, 1, &state, &nr); + if (!err && (nr == 0 || nr == 1)) + *wcresult = (wint_t)wc; + else + *wcresult = WEOF; + + return 0; +} + +static int +/*ARGSUSED*/ +_FUNCNAME(ctype_wctob)(_citrus_ctype_rec_t * __restrict cc, + wint_t wc, int * __restrict cresult) +{ + _ENCODING_STATE state; + _ENCODING_INFO *ei; + char buf[MB_LEN_MAX]; + size_t nr; + int err; + + if (wc == WEOF) { + *cresult = EOF; + return 0; + } + ei = _CEI_TO_EI(_TO_CEI(cc->cc_closure)); + _FUNCNAME(init_state)(ei, &state); + err = _FUNCNAME(wcrtomb_priv)(ei, buf, _ENCODING_MB_CUR_MAX(ei), + (wchar_t)wc, &state, &nr); + if (!err && nr == 1) + *cresult = buf[0]; + else + *cresult = EOF; + + return 0; +} diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_db.c src/lib/libc/citrus/citrus_db.c --- src.orig/lib/libc/citrus/citrus_db.c Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_db.c Thu Jun 18 13:03:23 2009 @@ -0,0 +1,335 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_db.c,v 1.5 2008/02/09 14:56:20 junyoung Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#define be16toh htobe16 +#define be32toh htobe32 +#include +#include +#include +#include +#include + +#include "citrus_namespace.h" +#include "citrus_bcs.h" +#include "citrus_region.h" +#include "citrus_memstream.h" +#include "citrus_mmap.h" +#include "citrus_db.h" +#include "citrus_db_file.h" + +struct _citrus_db { + /* private */ + struct _region db_region; + uint32_t (*db_hashfunc)(void *, struct _citrus_region *); + void *db_hashfunc_closure; +}; + +int +_citrus_db_open(struct _citrus_db **rdb, struct _region *r, const char *magic, + uint32_t (*hashfunc)(void *, struct _citrus_region *), + void *hashfunc_closure) +{ + struct _memstream ms; + struct _citrus_db *db; + struct _citrus_db_header_x *dhx; + + _memstream_bind(&ms, r); + + /* sanity check */ + dhx = _memstream_getregion(&ms, NULL, sizeof(*dhx)); + if (dhx == NULL) + return EFTYPE; + if (strncmp(dhx->dhx_magic, magic, _CITRUS_DB_MAGIC_SIZE) != 0) + return EFTYPE; + if (_memstream_seek(&ms, be32toh(dhx->dhx_entry_offset), SEEK_SET)) + return EFTYPE; + + if (be32toh(dhx->dhx_num_entries)*_CITRUS_DB_ENTRY_SIZE > + _memstream_remainder(&ms)) + return EFTYPE; + + db = malloc(sizeof(*db)); + if (db==NULL) + return errno; + db->db_region = *r; + db->db_hashfunc = hashfunc; + db->db_hashfunc_closure = hashfunc_closure; + *rdb = db; + + return 0; +} + +void +_citrus_db_close(struct _citrus_db *db) +{ + free(db); +} + +int +_citrus_db_lookup(struct _citrus_db *db, struct _citrus_region *key, + struct _citrus_region *data, struct _citrus_db_locator *dl) +{ + uint32_t hashval, num_entries; + size_t offset; + struct _memstream ms; + struct _citrus_db_header_x *dhx; + struct _citrus_db_entry_x *dex; + struct _citrus_region r; + + _memstream_bind(&ms, &db->db_region); + + dhx = _memstream_getregion(&ms, NULL, sizeof(*dhx)); + num_entries = be32toh(dhx->dhx_num_entries); + if (num_entries == 0) + return ENOENT; + + if (dl != NULL && dl->dl_offset>0) { + hashval = dl->dl_hashval; + offset = dl->dl_offset; + if (offset >= _region_size(&db->db_region)) + return ENOENT; + } else { + hashval = + db->db_hashfunc(db->db_hashfunc_closure, key)%num_entries; + offset = + be32toh(dhx->dhx_entry_offset) + + hashval * _CITRUS_DB_ENTRY_SIZE; + if (dl) + dl->dl_hashval = hashval; + } + do { + /* seek to the next entry */ + if (_citrus_memory_stream_seek(&ms, offset, SEEK_SET)) + return EFTYPE; + /* get the entry record */ + dex = _memstream_getregion(&ms, NULL, _CITRUS_DB_ENTRY_SIZE); + if (dex == NULL) + return EFTYPE; + + /* jump to next entry having the same hash value. */ + offset = be32toh(dex->dex_next_offset); + + /* save the current position */ + if (dl) { + dl->dl_offset = offset; + if (offset==0) + dl->dl_offset = _region_size(&db->db_region); + } + + /* compare hash value. */ + if (be32toh(dex->dex_hash_value) != hashval) + /* not found */ + break; + /* compare key length */ + if (be32toh(dex->dex_key_size) == _region_size(key)) { + /* seek to the head of the key. */ + if (_memstream_seek(&ms, be32toh(dex->dex_key_offset), + SEEK_SET)) + return EFTYPE; + /* get the region of the key */ + if (_memstream_getregion(&ms, &r, + _region_size(key)) == NULL) + return EFTYPE; + /* compare key byte stream */ + if (memcmp(_region_head(&r), _region_head(key), + _region_size(key)) == 0) { + /* match */ + if (_memstream_seek( + &ms, be32toh(dex->dex_data_offset), + SEEK_SET)) + return EFTYPE; + if (_memstream_getregion( + &ms, data, + be32toh(dex->dex_data_size)) == NULL) + return EFTYPE; + return 0; + } + } + } while (offset != 0); + + return ENOENT; +} + +int +_citrus_db_lookup_by_string(struct _citrus_db *db, const char *key, + struct _citrus_region *data, + struct _citrus_db_locator *dl) +{ + struct _region r; + + _region_init(&r, /*LINTED*/(void *)key, strlen(key)); + + return _citrus_db_lookup(db, &r, data, dl); +} + +int +_citrus_db_lookup8_by_string(struct _citrus_db *db, const char *key, + uint8_t *rval, struct _citrus_db_locator *dl) +{ + int ret; + struct _region r; + + ret = _citrus_db_lookup_by_string(db, key, &r, dl); + if (ret) + return ret; + + if (_region_size(&r) != 1) + return EFTYPE; + + if (rval) + memcpy(rval, _region_head(&r), 1); + + return 0; +} + +int +_citrus_db_lookup16_by_string(struct _citrus_db *db, const char *key, + uint16_t *rval, struct _citrus_db_locator *dl) +{ + int ret; + struct _region r; + uint16_t val; + + ret = _citrus_db_lookup_by_string(db, key, &r, dl); + if (ret) + return ret; + + if (_region_size(&r) != 2) + return EFTYPE; + + if (rval) { + memcpy(&val, _region_head(&r), 2); + *rval = be16toh(val); + } + + return 0; +} + +int +_citrus_db_lookup32_by_string(struct _citrus_db *db, const char *key, + uint32_t *rval, struct _citrus_db_locator *dl) +{ + int ret; + struct _region r; + uint32_t val; + + ret = _citrus_db_lookup_by_string(db, key, &r, dl); + if (ret) + return ret; + + if (_region_size(&r) != 4) + return EFTYPE; + + if (rval) { + memcpy(&val, _region_head(&r), 4); + *rval = be32toh(val); + } + + return 0; +} + +int +_citrus_db_lookup_string_by_string(struct _citrus_db *db, const char *key, + const char **rdata, + struct _citrus_db_locator *dl) +{ + int ret; + struct _region r; + + ret = _citrus_db_lookup_by_string(db, key, &r, dl); + if (ret) + return ret; + + /* check whether the string is null terminated */ + if (_region_size(&r) == 0) + return EFTYPE; + if (*((const char*)_region_head(&r)+_region_size(&r)-1) != '\0') + return EFTYPE; + + if (rdata) + *rdata = _region_head(&r); + + return 0; +} + +int +_citrus_db_get_number_of_entries(struct _citrus_db *db) +{ + struct _memstream ms; + struct _citrus_db_header_x *dhx; + + _memstream_bind(&ms, &db->db_region); + + dhx = _memstream_getregion(&ms, NULL, sizeof(*dhx)); + return (int)be32toh(dhx->dhx_num_entries); +} + +int +_citrus_db_get_entry(struct _citrus_db *db, int idx, + struct _region *key, struct _region *data) +{ + uint32_t num_entries; + size_t offset; + struct _memstream ms; + struct _citrus_db_header_x *dhx; + struct _citrus_db_entry_x *dex; + + _memstream_bind(&ms, &db->db_region); + + dhx = _memstream_getregion(&ms, NULL, sizeof(*dhx)); + num_entries = be32toh(dhx->dhx_num_entries); + if (idx < 0 || (uint32_t)idx >= num_entries) + return EINVAL; + + /* seek to the next entry */ + offset = be32toh(dhx->dhx_entry_offset) + idx * _CITRUS_DB_ENTRY_SIZE; + if (_citrus_memory_stream_seek(&ms, offset, SEEK_SET)) + return EFTYPE; + /* get the entry record */ + dex = _memstream_getregion(&ms, NULL, _CITRUS_DB_ENTRY_SIZE); + if (dex == NULL) + return EFTYPE; + /* seek to the head of the key. */ + if (_memstream_seek(&ms, be32toh(dex->dex_key_offset), SEEK_SET)) + return EFTYPE; + /* get the region of the key. */ + if (_memstream_getregion(&ms, key, be32toh(dex->dex_key_size))==NULL) + return EFTYPE; + /* seek to the head of the data. */ + if (_memstream_seek(&ms, be32toh(dex->dex_data_offset), SEEK_SET)) + return EFTYPE; + /* get the region of the data. */ + if (_memstream_getregion(&ms, data, be32toh(dex->dex_data_size))==NULL) + return EFTYPE; + + return 0; +} diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_db.h src/lib/libc/citrus/citrus_db.h --- src.orig/lib/libc/citrus/citrus_db.h Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_db.h Thu Jun 18 13:03:23 2009 @@ -0,0 +1,75 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_db.h,v 1.2 2008/02/09 14:56:20 junyoung Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _CITRUS_DB_H_ +#define _CITRUS_DB_H_ + +struct _citrus_db; +struct _citrus_db_locator { + uint32_t dl_hashval; + size_t dl_offset; +}; + +__BEGIN_DECLS +int _citrus_db_open(struct _citrus_db **, struct _citrus_region *, + const char *, + uint32_t (*)(void *, struct _citrus_region *), + void *); +void _citrus_db_close(struct _citrus_db *); +int _citrus_db_lookup(struct _citrus_db *, struct _citrus_region *, + struct _citrus_region *, + struct _citrus_db_locator *); +int _citrus_db_lookup_by_string(struct _citrus_db *, const char *, + struct _citrus_region *, + struct _citrus_db_locator *); +int _citrus_db_lookup8_by_string(struct _citrus_db *, const char *, + uint8_t *, + struct _citrus_db_locator *); +int _citrus_db_lookup16_by_string(struct _citrus_db *, const char *, + uint16_t *, + struct _citrus_db_locator *); +int _citrus_db_lookup32_by_string(struct _citrus_db *, const char *, + uint32_t *, + struct _citrus_db_locator *); +int _citrus_db_lookup_string_by_string(struct _citrus_db *, const char *, + const char **, + struct _citrus_db_locator *); +int _citrus_db_get_number_of_entries(struct _citrus_db *); +int _citrus_db_get_entry(struct _citrus_db *, int, + struct _citrus_region *, struct _citrus_region *); +__END_DECLS + +static __inline void +_citrus_db_locator_init(struct _citrus_db_locator *dl) +{ + dl->dl_hashval = 0; + dl->dl_offset = 0; +} + +#endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_db_factory.c src/lib/libc/citrus/citrus_db_factory.c --- src.orig/lib/libc/citrus/citrus_db_factory.c Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_db_factory.c Thu Jun 18 13:03:23 2009 @@ -0,0 +1,342 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_db_factory.c,v 1.9 2008/02/09 14:56:20 junyoung Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include + +#include "citrus_namespace.h" +#include "citrus_region.h" +#include "citrus_db_file.h" +#include "citrus_db_factory.h" + +struct _citrus_db_factory_entry { + SIMPLEQ_ENTRY(_citrus_db_factory_entry) de_entry; + struct _citrus_db_factory_entry *de_next; + uint32_t de_hashvalue; + struct _region de_key; + int de_key_free; + struct _region de_data; + int de_data_free; + int de_idx; +}; + +struct _citrus_db_factory { + size_t df_num_entries; + SIMPLEQ_HEAD(, _citrus_db_factory_entry) df_entries; + size_t df_total_key_size; + size_t df_total_data_size; + uint32_t (*df_hashfunc)(void *, struct _citrus_region *); + void *df_hashfunc_closure; +}; + +#define DB_ALIGN 16 + +int +_citrus_db_factory_create(struct _citrus_db_factory **rdf, + _citrus_db_hash_func_t hashfunc, + void *hashfunc_closure) +{ + struct _citrus_db_factory *df; + + df = malloc(sizeof(*df)); + if (df == NULL) + return errno; + df->df_num_entries = 0; + df->df_total_key_size = df->df_total_data_size = 0; + SIMPLEQ_INIT(&df->df_entries); + df->df_hashfunc = hashfunc; + df->df_hashfunc_closure = hashfunc_closure; + + *rdf = df; + + return 0; +} + +void +_citrus_db_factory_free(struct _citrus_db_factory *df) +{ + struct _citrus_db_factory_entry *de; + + while ((de = SIMPLEQ_FIRST(&df->df_entries)) != NULL) { + SIMPLEQ_REMOVE_HEAD(&df->df_entries, de_entry); + if (de->de_key_free) + free(_region_head(&de->de_key)); + if (de->de_data_free) + free(_region_head(&de->de_data)); + free(de); + } + free(df); +} + +static __inline size_t +ceilto(size_t sz) +{ + return (sz+DB_ALIGN-1) & ~(DB_ALIGN-1); +} + +int +_citrus_db_factory_add(struct _citrus_db_factory *df, + struct _region *key, int keyfree, + struct _region *data, int datafree) +{ + struct _citrus_db_factory_entry *de; + + de = malloc(sizeof(*de)); + if (de == NULL) + return -1; + + de->de_hashvalue = df->df_hashfunc(df->df_hashfunc_closure, key); + de->de_key = *key; + de->de_key_free = keyfree; + de->de_data = *data; + de->de_data_free = datafree; + de->de_idx = -1; + + SIMPLEQ_INSERT_TAIL(&df->df_entries, de, de_entry); + df->df_total_key_size += _region_size(key); + df->df_total_data_size += ceilto(_region_size(data)); + df->df_num_entries++; + + return 0; + +} + +int +_citrus_db_factory_add_by_string(struct _citrus_db_factory *df, + const char *key, + struct _citrus_region *data, int datafree) +{ + struct _region r; + char *tmp; + tmp = strdup(key); + if (tmp == NULL) + return errno; + _region_init(&r, tmp, strlen(key)); + return _citrus_db_factory_add(df, &r, 1, data, datafree); +} + +int +_citrus_db_factory_add8_by_string(struct _citrus_db_factory *df, + const char *key, uint8_t val) +{ + struct _region r; + uint8_t *p; + + p = malloc(sizeof(*p)); + if (p == NULL) + return errno; + *p = val; + _region_init(&r, p, 1); + return _citrus_db_factory_add_by_string(df, key, &r, 1); +} + +int +_citrus_db_factory_add16_by_string(struct _citrus_db_factory *df, + const char *key, uint16_t val) +{ + struct _region r; + uint16_t *p; + + p = malloc(sizeof(*p)); + if (p == NULL) + return errno; + *p = htons(val); + _region_init(&r, p, 2); + return _citrus_db_factory_add_by_string(df, key, &r, 1); +} + +int +_citrus_db_factory_add32_by_string(struct _citrus_db_factory *df, + const char *key, uint32_t val) +{ + struct _region r; + uint32_t *p; + + p = malloc(sizeof(*p)); + if (p == NULL) + return errno; + *p = htonl(val); + _region_init(&r, p, 4); + return _citrus_db_factory_add_by_string(df, key, &r, 1); +} + +int +_citrus_db_factory_add_string_by_string(struct _citrus_db_factory *df, + const char *key, const char *data) +{ + char *p; + struct _region r; + + p = strdup(data); + if (p == NULL) + return errno; + _region_init(&r, p, strlen(p)+1); + return _citrus_db_factory_add_by_string(df, key, &r, 1); +} + +size_t +_citrus_db_factory_calc_size(struct _citrus_db_factory *df) +{ + size_t sz; + + sz = ceilto(_CITRUS_DB_HEADER_SIZE); + sz += ceilto(_CITRUS_DB_ENTRY_SIZE * df->df_num_entries); + sz += ceilto(df->df_total_key_size); + sz += df->df_total_data_size; + + return sz; +} + +static __inline void +put8(struct _region *r, size_t *rofs, uint8_t val) +{ + *(uint8_t *)_region_offset(r, *rofs) = val; + *rofs += 1; +} + +static __inline void +put16(struct _region *r, size_t *rofs, uint16_t val) +{ + val = htons(val); + memcpy(_region_offset(r, *rofs), &val, 2); + *rofs += 2; +} + +static __inline void +put32(struct _region *r, size_t *rofs, uint32_t val) +{ + val = htonl(val); + memcpy(_region_offset(r, *rofs), &val, 4); + *rofs += 4; +} + +static __inline void +putpad(struct _region *r, size_t *rofs) +{ + size_t i; + for (i = ceilto(*rofs) - *rofs; i > 0; i--) + put8(r, rofs, 0); +} + +static __inline void +dump_header(struct _region *r, const char *magic, size_t *rofs, + size_t num_entries) +{ + while (*rofs<_CITRUS_DB_MAGIC_SIZE) + put8(r, rofs, *magic++); + put32(r, rofs, num_entries); + put32(r, rofs, _CITRUS_DB_HEADER_SIZE); +} + +int +_citrus_db_factory_serialize(struct _citrus_db_factory *df, const char *magic, + struct _region *r) +{ + size_t i, ofs, keyofs, dataofs, nextofs; + struct _citrus_db_factory_entry *de, **depp, *det; + + ofs = 0; + /* check whether more than 0 entries exist */ + if (df->df_num_entries == 0) { + dump_header(r, magic, &ofs, 0); + return 0; + } + /* allocate hash table */ + depp = malloc(sizeof(*depp) * df->df_num_entries); + if (depp == NULL) + return -1; + for (i = 0; i < df->df_num_entries; i++) + depp[i] = NULL; + + /* step1: store the entries which are not conflicting */ + SIMPLEQ_FOREACH(de, &df->df_entries, de_entry) { + de->de_hashvalue %= df->df_num_entries; + de->de_idx = -1; + de->de_next = NULL; + if (depp[de->de_hashvalue] == NULL) { + depp[de->de_hashvalue] = de; + de->de_idx = (int)de->de_hashvalue; + } + } + + /* step2: resolve conflicts */ + i = 0; + SIMPLEQ_FOREACH(de, &df->df_entries, de_entry) { + if (de->de_idx == -1) { + det = depp[de->de_hashvalue]; + while (det->de_next != NULL) + det = det->de_next; + det->de_next = de; + while (depp[i] != NULL) + i++; + depp[i] = de; + de->de_idx = (int)i; + } + } + + keyofs = + _CITRUS_DB_HEADER_SIZE + + ceilto(df->df_num_entries*_CITRUS_DB_ENTRY_SIZE); + dataofs = keyofs + ceilto(df->df_total_key_size); + + /* dump header */ + dump_header(r, magic, &ofs, df->df_num_entries); + + /* dump entries */ + for (i = 0; i < df->df_num_entries; i++) { + de = depp[i]; + nextofs = 0; + if (de->de_next) { + nextofs = + _CITRUS_DB_HEADER_SIZE + + de->de_next->de_idx * _CITRUS_DB_ENTRY_SIZE; + } + put32(r, &ofs, de->de_hashvalue); + put32(r, &ofs, nextofs); + put32(r, &ofs, keyofs); + put32(r, &ofs, _region_size(&de->de_key)); + put32(r, &ofs, dataofs); + put32(r, &ofs, _region_size(&de->de_data)); + memcpy(_region_offset(r, keyofs), + _region_head(&de->de_key), _region_size(&de->de_key)); + keyofs += _region_size(&de->de_key); + memcpy(_region_offset(r, dataofs), + _region_head(&de->de_data), _region_size(&de->de_data)); + dataofs += _region_size(&de->de_data); + putpad(r, &dataofs); + } + putpad(r, &ofs); + putpad(r, &keyofs); + free(depp); + + return 0; +} diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_db_factory.h src/lib/libc/citrus/citrus_db_factory.h --- src.orig/lib/libc/citrus/citrus_db_factory.h Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_db_factory.h Thu Jun 18 13:03:23 2009 @@ -0,0 +1,59 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_db_factory.h,v 1.3 2008/02/09 14:56:20 junyoung Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _CITRUS_DB_FACTORY_H_ +#define _CITRUS_DB_FACTORY_H_ + +struct _citrus_db_factory; +typedef uint32_t (*_citrus_db_hash_func_t)(void *, struct _citrus_region *); + +__BEGIN_DECLS +int _citrus_db_factory_create(struct _citrus_db_factory **, + _citrus_db_hash_func_t, void *); +void _citrus_db_factory_free(struct _citrus_db_factory *); +int _citrus_db_factory_add(struct _citrus_db_factory *, + struct _citrus_region *, int, + struct _citrus_region *, int); +int _citrus_db_factory_add_by_string(struct _citrus_db_factory *, + const char *, + struct _citrus_region *, int); +int _citrus_db_factory_add8_by_string(struct _citrus_db_factory *, + const char *, uint8_t); +int _citrus_db_factory_add16_by_string(struct _citrus_db_factory *, + const char *, uint16_t); +int _citrus_db_factory_add32_by_string(struct _citrus_db_factory *, + const char *, uint32_t); +int _citrus_db_factory_add_string_by_string(struct _citrus_db_factory *, + const char *, const char *); +size_t _citrus_db_factory_calc_size(struct _citrus_db_factory *); +int _citrus_db_factory_serialize(struct _citrus_db_factory *, + const char *, struct _citrus_region *); +__END_DECLS + +#endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_db_file.h src/lib/libc/citrus/citrus_db_file.h --- src.orig/lib/libc/citrus/citrus_db_file.h Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_db_file.h Thu Jun 18 13:03:23 2009 @@ -0,0 +1,85 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_db_file.h,v 1.4 2008/02/10 05:58:22 junyoung Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _CITRUS_DB_FILE_H_ +#define _CITRUS_DB_FILE_H_ + +/* + * db format: + * +--- + * | header + * | - magic + * | - num entries + * +--- + * | entry directory + * | +------------ + * | | entry0 + * | | - hash value + * | | - next entry + * | | - key offset + * | | - key len + * | | - data offset + * | | - data size + * | |--- + * | | entry1 + * | | .. + * | | entryN + * | +--- + * +--- + * | key table + * | - key0 + * | ... + * | - keyN + * +--- + * | data table + * | - data0 + * | ... + * | - dataN + * +--- + */ + +#define _CITRUS_DB_MAGIC_SIZE 8 +#define _CITRUS_DB_HEADER_SIZE 16 +struct _citrus_db_header_x { + char dhx_magic[_CITRUS_DB_MAGIC_SIZE]; + uint32_t dhx_num_entries; + uint32_t dhx_entry_offset; +} __packed; + +struct _citrus_db_entry_x { + uint32_t dex_hash_value; + uint32_t dex_next_offset; + uint32_t dex_key_offset; + uint32_t dex_key_size; + uint32_t dex_data_offset; + uint32_t dex_data_size; +} __packed; +#define _CITRUS_DB_ENTRY_SIZE 24 + +#endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_db_hash.c src/lib/libc/citrus/citrus_db_hash.c --- src.orig/lib/libc/citrus/citrus_db_hash.c Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_db_hash.c Thu Jun 18 13:03:23 2009 @@ -0,0 +1,58 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_db_hash.c,v 1.5 2008/02/09 14:56:20 junyoung Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include + +#include "citrus_namespace.h" +#include "citrus_types.h" +#include "citrus_bcs.h" +#include "citrus_region.h" +#include "citrus_db_hash.h" + +uint32_t +/*ARGSUSED*/ +_citrus_db_hash_std(void *closure, struct _region *r) +{ + const uint8_t *p = _region_head(r); + uint32_t hash = 0, tmp; + size_t i; + + for (i = _region_size(r); i > 0; i--) { + hash <<= 4; + hash += _bcs_tolower(*p); + tmp = hash & 0xF0000000; + if (tmp != 0) { + hash ^= tmp; + hash ^= tmp >> 24; + } + p++; + } + return hash; +} diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_db_hash.h src/lib/libc/citrus/citrus_db_hash.h --- src.orig/lib/libc/citrus/citrus_db_hash.h Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_db_hash.h Thu Jun 18 13:03:23 2009 @@ -0,0 +1,37 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_db_hash.h,v 1.2 2008/02/09 14:56:20 junyoung Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _CITRUS_DB_HASH_H_ +#define _CITRUS_DB_HASH_H_ + +__BEGIN_DECLS +uint32_t _citrus_db_hash_std(void *, struct _citrus_region *); +__END_DECLS + +#endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_esdb.c src/lib/libc/citrus/citrus_esdb.c --- src.orig/lib/libc/citrus/citrus_esdb.c Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_esdb.c Thu Jun 18 13:03:23 2009 @@ -0,0 +1,343 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_esdb.c,v 1.5 2008/02/09 14:56:20 junyoung Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include + +#include "citrus_namespace.h" +#include "citrus_types.h" +#include "citrus_bcs.h" +#include "citrus_region.h" +#include "citrus_memstream.h" +#include "citrus_mmap.h" +#include "citrus_lookup.h" +#include "citrus_db.h" +#include "citrus_db_hash.h" +#include "citrus_esdb.h" +#include "citrus_esdb_file.h" + +#define ESDB_DIR "esdb.dir" +#define ESDB_ALIAS "esdb.alias" + +/* + * _citrus_esdb_alias: + * resolve encoding scheme name aliases. + */ +const char * +_citrus_esdb_alias(const char *esname, char *buf, size_t bufsize) +{ + return _lookup_alias(_PATH_ESDB "/" ESDB_ALIAS, esname, buf, bufsize, + _LOOKUP_CASE_IGNORE); +} + + +/* + * conv_esdb: + * external representation -> local structure. + */ +static int +conv_esdb(struct _citrus_esdb *esdb, struct _region *fr) +{ + int ret; + struct _citrus_db *db; + uint32_t version, num_charsets, csid, i, tmp; + char buf[100]; + const char *str; + + /* open db */ + ret = _db_open(&db, fr, _CITRUS_ESDB_MAGIC, &_db_hash_std, NULL); + if (ret) + goto err0; + + /* check version */ + ret = _db_lookup32_by_s(db, _CITRUS_ESDB_SYM_VERSION, &version, NULL); + if (ret) + goto err1; + switch (version) { + case 0x00000001: + /* current version */ + /* initial version */ + break; + default: + ret = EFTYPE; + goto err1; + } + + /* get encoding/variable */ + ret = _db_lookupstr_by_s(db, _CITRUS_ESDB_SYM_ENCODING, &str, NULL); + if (ret) + goto err1; + esdb->db_encname = strdup(str); + if (esdb->db_encname == NULL) { + ret = errno; + goto err1; + } + + esdb->db_len_variable = 0; + esdb->db_variable = NULL; + ret = _db_lookupstr_by_s(db, _CITRUS_ESDB_SYM_VARIABLE, &str, NULL); + if (ret == 0) { + esdb->db_len_variable = strlen(str)+1; + esdb->db_variable = strdup(str); + if (esdb->db_variable == NULL) { + ret = errno; + goto err2; + } + } else if (ret != ENOENT) + goto err2; + + /* get number of charsets */ + ret = _db_lookup32_by_s(db, _CITRUS_ESDB_SYM_NUM_CHARSETS, + &num_charsets, NULL); + if (ret) + goto err3; + esdb->db_num_charsets = num_charsets; + + /* get invalid character */ + ret = _db_lookup32_by_s(db, _CITRUS_ESDB_SYM_INVALID, &tmp, NULL); + if (ret == 0) { + esdb->db_use_invalid = 1; + esdb->db_invalid = tmp; + } else if (ret == ENOENT) + esdb->db_use_invalid = 0; + else + goto err3; + + /* get charsets */ + esdb->db_charsets = malloc(num_charsets * sizeof(*esdb->db_charsets)); + if (esdb->db_charsets == NULL) { + ret = errno; + goto err3; + } + for (i = 0; i < num_charsets; i++) { + snprintf(buf, sizeof(buf), + _CITRUS_ESDB_SYM_CSID_PREFIX "%d", i); + ret = _db_lookup32_by_s(db, buf, &csid, NULL); + if (ret) + goto err4; + esdb->db_charsets[i].ec_csid = csid; + + snprintf(buf, sizeof(buf), + _CITRUS_ESDB_SYM_CSNAME_PREFIX "%d", i); + ret = _db_lookupstr_by_s(db, buf, &str, NULL); + if (ret) + goto err4; + esdb->db_charsets[i].ec_csname = strdup(str); + if (esdb->db_charsets[i].ec_csname == NULL) { + ret = errno; + goto err4; + } + } + + _db_close(db); + return 0; + +err4: + for (; i > 0; i--) + free(esdb->db_charsets[i - 1].ec_csname); + free(esdb->db_charsets); +err3: + free(esdb->db_variable); +err2: + free(esdb->db_encname); +err1: + _db_close(db); + if (ret == ENOENT) + ret = EFTYPE; +err0: + return ret; +} + +/* + * _citrus_esdb_open: + * open an ESDB file. + */ +int +_citrus_esdb_open(struct _citrus_esdb *db, const char *esname) +{ + int ret; + const char *realname, *encfile; + char buf1[PATH_MAX], buf2[PATH_MAX], path[PATH_MAX]; + struct _region fr; + + snprintf(path, sizeof(path), "%s/%s", _PATH_ESDB, ESDB_ALIAS); + realname = _lookup_alias(path, esname, buf1, sizeof(buf1), + _LOOKUP_CASE_IGNORE); + + snprintf(path, sizeof(path), "%s/%s", _PATH_ESDB, ESDB_DIR); + encfile = _lookup_simple(path, realname, buf2, sizeof(buf2), + _LOOKUP_CASE_IGNORE); + if (encfile==NULL) + return ENOENT; + + /* open file */ + snprintf(path, sizeof(path), "%s/%s", _PATH_ESDB, encfile); + ret = _map_file(&fr, path); + if (ret) + return ret; + + ret = conv_esdb(db, &fr); + + _unmap_file(&fr); + + return ret; +} + +/* + * _citrus_esdb_close: + * free an ESDB. + */ +void +_citrus_esdb_close(struct _citrus_esdb *db) +{ + int i; + + for (i = 0; i < db->db_num_charsets; i++) + free(db->db_charsets[i].ec_csname); + db->db_num_charsets = 0; + free(db->db_charsets); db->db_charsets = NULL; + free(db->db_encname); db->db_encname = NULL; + db->db_len_variable = 0; + free(db->db_variable); db->db_variable = NULL; +} + +/* + * _citrus_esdb_free_list: + * free the list. + */ +void +_citrus_esdb_free_list(char **list, size_t num) +{ + size_t i; + + for (i = 0; i < num; i++) + free(list[i]); + free(list); +} + +/* + * _citrus_esdb_get_list: + * get esdb entries. + */ +int +_citrus_esdb_get_list(char ***rlist, size_t *rnum) +{ + int ret; + struct _region key; + size_t num; + struct _citrus_lookup *cla, *cld; + char **list, **q; + char buf[PATH_MAX]; + + num = 0; + + ret = _lookup_seq_open(&cla, _PATH_ESDB "/" ESDB_ALIAS, + _LOOKUP_CASE_IGNORE); + if (ret) + goto quit0; + + ret = _lookup_seq_open(&cld, _PATH_ESDB "/" ESDB_DIR, + _LOOKUP_CASE_IGNORE); + if (ret) + goto quit1; + + /* count number of entries */ + num = _lookup_get_num_entries(cla) + _lookup_get_num_entries(cld); + + _lookup_seq_rewind(cla); + _lookup_seq_rewind(cld); + + /* allocate list pointer space */ + list = malloc(num * sizeof(char *)); + num = 0; + if (list == NULL) { + ret = errno; + goto quit3; + } + + /* get alias entries */ + while ((ret = _lookup_seq_next(cla, &key, NULL)) == 0) { + snprintf(buf, sizeof(buf), "%.*s", + (int)_region_size(&key), + (const char *)_region_head(&key)); + _bcs_convert_to_lower(buf); + list[num] = strdup(buf); + if (list[num] == NULL) { + ret = errno; + goto quit3; + } + num++; + } + if (ret != ENOENT) + goto quit3; + /* get dir entries */ + while ((ret = _lookup_seq_next(cld, &key, NULL)) == 0) { + /* check duplicated entry */ + snprintf(buf, sizeof(buf), "%.*s", + (int)_region_size(&key), + (const char *)_region_head(&key)); + _bcs_convert_to_lower(buf); + ret = _lookup_seq_lookup(cla, buf, NULL); + if (ret) { + if (ret != ENOENT) + goto quit3; + /* not duplicated */ + list[num] = strdup(buf); + if (list[num] == NULL) { + ret = errno; + goto quit3; + } + num++; + } + } + if (ret != ENOENT) + goto quit3; + + ret = 0; + q = realloc(list, num * sizeof(char *)); + if (!q) { + ret = ENOMEM; + goto quit3; + } + list = q; + *rlist = list; + *rnum = num; +quit3: + if (ret) + _citrus_esdb_free_list(list, num); + _lookup_seq_close(cld); +quit1: + _lookup_seq_close(cla); +quit0: + return ret; +} diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_esdb.h src/lib/libc/citrus/citrus_esdb.h --- src.orig/lib/libc/citrus/citrus_esdb.h Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_esdb.h Thu Jun 18 13:03:23 2009 @@ -0,0 +1,56 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_esdb.h,v 1.1 2003/06/25 09:51:32 tshiozak Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _CITRUS_ESDB_H_ +#define _CITRUS_ESDB_H_ + +struct _citrus_esdb_charset { + _citrus_csid_t ec_csid; + char *ec_csname; +}; + +struct _citrus_esdb { + char *db_encname; + void *db_variable; + size_t db_len_variable; + int db_num_charsets; + struct _citrus_esdb_charset *db_charsets; + int db_use_invalid; + _citrus_wc_t db_invalid; +}; + +__BEGIN_DECLS +const char *_citrus_esdb_alias(const char *, char *, size_t); +int _citrus_esdb_open(struct _citrus_esdb *, const char *); +void _citrus_esdb_close(struct _citrus_esdb *); +void _citrus_esdb_free_list(char **, size_t); +int _citrus_esdb_get_list(char ***, size_t *); +__END_DECLS + +#endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_esdb_file.h src/lib/libc/citrus/citrus_esdb_file.h --- src.orig/lib/libc/citrus/citrus_esdb_file.h Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_esdb_file.h Thu Jun 18 13:03:23 2009 @@ -0,0 +1,45 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_esdb_file.h,v 1.1 2003/06/25 09:51:32 tshiozak Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _CITRUS_ESDB_FILE_H_ +#define _CITRUS_ESDB_FILE_H_ + +#define _CITRUS_ESDB_MAGIC "ESDB\0\0\0\0" + +#define _CITRUS_ESDB_SYM_VERSION "version" +#define _CITRUS_ESDB_SYM_ENCODING "encoding" +#define _CITRUS_ESDB_SYM_VARIABLE "variable" +#define _CITRUS_ESDB_SYM_NUM_CHARSETS "num_charsets" +#define _CITRUS_ESDB_SYM_INVALID "invalid" +#define _CITRUS_ESDB_SYM_CSNAME_PREFIX "csname_" +#define _CITRUS_ESDB_SYM_CSID_PREFIX "csid_" + +#define _CITRUS_ESDB_VERSION 0x00000001 + +#endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_hash.c src/lib/libc/citrus/citrus_hash.c --- src.orig/lib/libc/citrus/citrus_hash.c Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_hash.c Thu Jun 18 13:03:23 2009 @@ -0,0 +1,47 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_hash.c,v 1.3 2008/02/09 14:56:20 junyoung Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include + +#include "citrus_namespace.h" +#include "citrus_types.h" +#include "citrus_region.h" +#include "citrus_hash.h" +#include "citrus_db_hash.h" + +int +_citrus_string_hash_func(const char *key, int hashsize) +{ + struct _region r; + + _region_init(&r, /*LINTED*/(void *)key, strlen(key)); + + return (int)(_db_hash_std(NULL, &r) % (uint32_t)hashsize); +} diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_hash.h src/lib/libc/citrus/citrus_hash.h --- src.orig/lib/libc/citrus/citrus_hash.h Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_hash.h Thu Jun 18 13:03:23 2009 @@ -0,0 +1,59 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_hash.h,v 1.3 2004/01/02 21:49:35 itojun Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _CITRUS_HASH_H_ +#define _CITRUS_HASH_H_ + +#define _CITRUS_HASH_ENTRY(type) LIST_ENTRY(type) +#define _CITRUS_HASH_HEAD(headname, type, hashsize) \ +struct headname { \ + LIST_HEAD(, type) chh_table[hashsize]; \ +} +#define _CITRUS_HASH_INIT(head, hashsize) \ +do { \ + int _ch_loop; \ + for (_ch_loop = 0; _ch_loop < hashsize; _ch_loop++) \ + LIST_INIT(&(head)->chh_table[_ch_loop]); \ +} while (/*CONSTCOND*/0) +#define _CITRUS_HASH_REMOVE(elm, field) LIST_REMOVE(elm, field) +#define _CITRUS_HASH_INSERT(head, elm, field, hashval) \ +LIST_INSERT_HEAD(&(head)->chh_table[hashval], elm, field) +#define _CITRUS_HASH_SEARCH(head, elm, field, matchfunc, key, hashval) \ +do { \ + LIST_FOREACH((elm), &(head)->chh_table[hashval], field) { \ + if (matchfunc((elm), key)==0) \ + break; \ + } \ +} while (/*CONSTCOND*/0) + +__BEGIN_DECLS +int _citrus_string_hash_func(const char *, int); +__END_DECLS + +#endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_iconv.c src/lib/libc/citrus/citrus_iconv.c --- src.orig/lib/libc/citrus/citrus_iconv.c Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_iconv.c Thu Jun 18 13:03:23 2009 @@ -0,0 +1,375 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_iconv.c,v 1.6 2004/12/30 05:03:48 christos Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include "thread_private.h" + +#include "citrus_namespace.h" +#include "citrus_bcs.h" +#include "citrus_region.h" +#include "citrus_memstream.h" +#include "citrus_mmap.h" +#include "citrus_module.h" +#include "citrus_lookup.h" +#include "citrus_hash.h" +#include "citrus_iconv.h" + +#define _CITRUS_ICONV_DIR "iconv.dir" +#define _CITRUS_ICONV_ALIAS "iconv.alias" + +#define CI_HASH_SIZE 101 +#define CI_INITIAL_MAX_REUSE 5 +#define CI_ENV_MAX_REUSE "ICONV_MAX_REUSE" + +_THREAD_PRIVATE_MUTEX(citrus_iconv); +static int isinit = 0; +static _CITRUS_HASH_HEAD(, _citrus_iconv_shared, CI_HASH_SIZE) shared_pool; +static TAILQ_HEAD(, _citrus_iconv_shared) shared_unused; +static int shared_num_unused, shared_max_reuse; + +static __inline void +init_cache(void) +{ + _THREAD_PRIVATE_MUTEX_LOCK(citrus_iconv); + if (!isinit) { + _CITRUS_HASH_INIT(&shared_pool, CI_HASH_SIZE); + TAILQ_INIT(&shared_unused); + shared_max_reuse = -1; + if (!issetugid() && getenv(CI_ENV_MAX_REUSE)) + shared_max_reuse = atoi(getenv(CI_ENV_MAX_REUSE)); + if (shared_max_reuse < 0) + shared_max_reuse = CI_INITIAL_MAX_REUSE; + isinit = 1; + } + _THREAD_PRIVATE_MUTEX_UNLOCK(citrus_iconv); +} + +/* + * lookup_iconv_entry: + * lookup iconv.dir entry in the specified directory. + * + * line format of iconv.dir file: + * key module arg + * key : lookup key. + * module : iconv module name. + * arg : argument for the module (generally, description file name) + * + */ +static __inline int +lookup_iconv_entry(const char *curdir, const char *key, + char *linebuf, size_t linebufsize, + const char **module, const char **variable) +{ + const char *cp, *cq; + char *p, path[PATH_MAX]; + + /* iconv.dir path */ + snprintf(path, (size_t)PATH_MAX, "%s/" _CITRUS_ICONV_DIR, curdir); + + /* lookup db */ + cp = p = _lookup_simple(path, key, linebuf, linebufsize, + _LOOKUP_CASE_IGNORE); + if (p == NULL) + return ENOENT; + + /* get module name */ + *module = p; + cq = _bcs_skip_nonws(cp); + p[cq-cp] = '\0'; + p += cq-cp+1; + cq++; + + /* get variable */ + cp = _bcs_skip_ws(cq); + *variable = p += cp - cq; + cq = _bcs_skip_nonws(cp); + p[cq-cp] = '\0'; + + return 0; +} + +static __inline void +close_shared(struct _citrus_iconv_shared *ci) +{ + if (ci) { + if (ci->ci_module) { + if (ci->ci_ops) { + if (ci->ci_closure) + (*ci->ci_ops->io_uninit_shared)(ci); + free(ci->ci_ops); + } + _citrus_unload_module(ci->ci_module); + } + free(ci); + } +} + +static __inline int +open_shared(struct _citrus_iconv_shared * __restrict * __restrict rci, + const char * __restrict basedir, const char * __restrict convname, + const char * __restrict src, const char * __restrict dst) +{ + int ret; + struct _citrus_iconv_shared *ci; + _citrus_iconv_getops_t getops; + char linebuf[LINE_MAX]; + const char *module, *variable; + size_t len_convname; + + /* search converter entry */ + ret = lookup_iconv_entry(basedir, convname, linebuf, sizeof(linebuf), + &module, &variable); + if (ret) { + if (ret == ENOENT) + /* fallback */ + ret = lookup_iconv_entry(basedir, "*", + linebuf, sizeof(linebuf), + &module, &variable); + if (ret) + return ret; + } + + /* initialize iconv handle */ + len_convname = strlen(convname); + ci = malloc(sizeof(*ci)+len_convname+1); + if (!ci) { + ret = errno; + goto err; + } + ci->ci_module = NULL; + ci->ci_ops = NULL; + ci->ci_closure = NULL; + ci->ci_convname = (void *)&ci[1]; + memcpy(ci->ci_convname, convname, len_convname+1); + + /* load module */ + ret = _citrus_load_module(&ci->ci_module, module); + if (ret) + goto err; + + /* get operators */ + getops = (_citrus_iconv_getops_t) + _citrus_find_getops(ci->ci_module, module, "iconv"); + if (!getops) { + ret = EOPNOTSUPP; + goto err; + } + ci->ci_ops = malloc(sizeof(*ci->ci_ops)); + if (!ci->ci_ops) { + ret = errno; + goto err; + } + ret = (*getops)(ci->ci_ops, sizeof(*ci->ci_ops), + _CITRUS_ICONV_ABI_VERSION); + if (ret) + goto err; + + /* version check */ + if (ci->ci_ops->io_abi_version == 1) { + /* binary compatibility broken at ver.2 */ + ret = EINVAL; + goto err; + } + + if (ci->ci_ops->io_init_shared == NULL || + ci->ci_ops->io_uninit_shared == NULL || + ci->ci_ops->io_init_context == NULL || + ci->ci_ops->io_uninit_context == NULL || + ci->ci_ops->io_convert == NULL) + goto err; + + /* initialize the converter */ + ret = (*ci->ci_ops->io_init_shared)(ci, basedir, src, dst, + (const void *)variable, + strlen(variable)+1); + if (ret) + goto err; + + *rci = ci; + + return 0; +err: + close_shared(ci); + return ret; +} + +static __inline int +hash_func(const char *key) +{ + return _string_hash_func(key, CI_HASH_SIZE); +} + +static __inline int +match_func(struct _citrus_iconv_shared * __restrict ci, + const char * __restrict key) +{ + return strcmp(ci->ci_convname, key); +} + +static int +get_shared(struct _citrus_iconv_shared * __restrict * __restrict rci, + const char *basedir, const char *src, const char *dst) +{ + int ret = 0; + int hashval; + struct _citrus_iconv_shared * ci; + char convname[PATH_MAX]; + + snprintf(convname, sizeof(convname), "%s/%s", src, dst); + + _THREAD_PRIVATE_MUTEX_LOCK(citrus_iconv); + + /* lookup alread existing entry */ + hashval = hash_func(convname); + _CITRUS_HASH_SEARCH(&shared_pool, ci, ci_hash_entry, match_func, + convname, hashval); + if (ci != NULL) { + /* found */ + if (ci->ci_used_count == 0) { + TAILQ_REMOVE(&shared_unused, ci, ci_tailq_entry); + shared_num_unused--; + } + ci->ci_used_count++; + *rci = ci; + goto quit; + } + + /* create new entry */ + ret = open_shared(&ci, basedir, convname, src, dst); + if (ret) + goto quit; + + _CITRUS_HASH_INSERT(&shared_pool, ci, ci_hash_entry, hashval); + ci->ci_used_count = 1; + *rci = ci; + +quit: + _THREAD_PRIVATE_MUTEX_UNLOCK(citrus_iconv); + + return ret; +} + +static void +release_shared(struct _citrus_iconv_shared * __restrict ci) +{ + _THREAD_PRIVATE_MUTEX_LOCK(citrus_iconv); + + ci->ci_used_count--; + if (ci->ci_used_count == 0) { + /* put it into unused list */ + shared_num_unused++; + TAILQ_INSERT_TAIL(&shared_unused, ci, ci_tailq_entry); + /* flood out */ + while (shared_num_unused > shared_max_reuse) { + ci = TAILQ_FIRST(&shared_unused); + TAILQ_REMOVE(&shared_unused, ci, ci_tailq_entry); + _CITRUS_HASH_REMOVE(ci, ci_hash_entry); + shared_num_unused--; + close_shared(ci); + } + } + + _THREAD_PRIVATE_MUTEX_UNLOCK(citrus_iconv); +} + +/* + * _citrus_iconv_open: + * open a converter for the specified in/out codes. + */ +int +_citrus_iconv_open(struct _citrus_iconv * __restrict * __restrict rcv, + const char * __restrict basedir, + const char * __restrict src, const char * __restrict dst) +{ + int ret; + struct _citrus_iconv_shared *ci; + struct _citrus_iconv *cv; + char realsrc[PATH_MAX], realdst[PATH_MAX]; + char buf[PATH_MAX], path[PATH_MAX]; + + init_cache(); + + /* resolve codeset name aliases */ + snprintf(path, sizeof(path), "%s/%s", basedir, _CITRUS_ICONV_ALIAS); + strlcpy(realsrc, + _lookup_alias(path, src, buf, (size_t)PATH_MAX, + _LOOKUP_CASE_IGNORE), + (size_t)PATH_MAX); + strlcpy(realdst, + _lookup_alias(path, dst, buf, (size_t)PATH_MAX, + _LOOKUP_CASE_IGNORE), + (size_t)PATH_MAX); + + /* sanity check */ + if (strchr(realsrc, '/') != NULL || strchr(realdst, '/')) + return EINVAL; + + /* get shared record */ + ret = get_shared(&ci, basedir, realsrc, realdst); + if (ret) + return ret; + + /* create/init context */ + cv = malloc(sizeof(*cv)); + if (cv == NULL) { + ret = errno; + release_shared(ci); + return ret; + } + cv->cv_shared = ci; + ret = (*ci->ci_ops->io_init_context)(cv); + if (ret) { + release_shared(ci); + free(cv); + return ret; + } + *rcv = cv; + + return 0; +} + +/* + * _citrus_iconv_close: + * close the specified converter. + */ +void +_citrus_iconv_close(struct _citrus_iconv *cv) +{ + if (cv) { + (*cv->cv_shared->ci_ops->io_uninit_context)(cv); + release_shared(cv->cv_shared); + free(cv); + } +} diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_iconv.h src/lib/libc/citrus/citrus_iconv.h --- src.orig/lib/libc/citrus/citrus_iconv.h Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_iconv.h Thu Jun 18 13:03:23 2009 @@ -0,0 +1,65 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_iconv.h,v 1.5 2008/02/09 14:56:20 junyoung Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _CITRUS_ICONV_H_ +#define _CITRUS_ICONV_H_ + +struct _citrus_iconv_shared; +struct _citrus_iconv_ops; +struct _citrus_iconv; + +__BEGIN_DECLS +int _citrus_iconv_open(struct _citrus_iconv * __restrict * __restrict, + const char * __restrict, + const char * __restrict, const char * __restrict); +void _citrus_iconv_close(struct _citrus_iconv *); +__END_DECLS + + +#include "citrus_iconv_local.h" + +#define _CITRUS_ICONV_F_HIDE_INVALID 0x0001 + +/* + * _citrus_iconv_convert: + * convert a string. + */ +static __inline int +_citrus_iconv_convert(struct _citrus_iconv * __restrict cv, + const char * __restrict * __restrict in, + size_t * __restrict inbytes, + char * __restrict * __restrict out, + size_t * __restrict outbytes, uint32_t flags, + size_t * __restrict nresults) +{ + return (*cv->cv_shared->ci_ops->io_convert)(cv, in, inbytes, out, + outbytes, flags, nresults); +} + +#endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_iconv_local.h src/lib/libc/citrus/citrus_iconv_local.h --- src.orig/lib/libc/citrus/citrus_iconv_local.h Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_iconv_local.h Thu Jun 18 13:03:23 2009 @@ -0,0 +1,108 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_iconv_local.h,v 1.3 2008/02/09 14:56:20 junyoung Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _CITRUS_ICONV_LOCAL_H_ +#define _CITRUS_ICONV_LOCAL_H_ + +#define _CITRUS_ICONV_GETOPS_FUNC_BASE(_n_) \ +int _n_(struct _citrus_iconv_ops *, size_t, uint32_t) +#define _CITRUS_ICONV_GETOPS_FUNC(_n_) \ +_CITRUS_ICONV_GETOPS_FUNC_BASE(_citrus_##_n_##_iconv_getops) + +#define _CITRUS_ICONV_DECLS(_m_) \ +static int _citrus_##_m_##_iconv_init_shared \ + (struct _citrus_iconv_shared * __restrict, \ + const char * __restrict, \ + const char * __restrict, const char * __restrict, \ + const void * __restrict, size_t); \ +static void _citrus_##_m_##_iconv_uninit_shared \ + (struct _citrus_iconv_shared *); \ +static int _citrus_##_m_##_iconv_convert \ + (struct _citrus_iconv * __restrict, \ + const char * __restrict * __restrict, size_t * __restrict, \ + char * __restrict * __restrict, size_t * __restrict outbytes, \ + uint32_t, size_t * __restrict); \ +static int _citrus_##_m_##_iconv_init_context \ + (struct _citrus_iconv *); \ +static void _citrus_##_m_##_iconv_uninit_context \ + (struct _citrus_iconv *) + + +#define _CITRUS_ICONV_DEF_OPS(_m_) \ +struct _citrus_iconv_ops _citrus_##_m_##_iconv_ops = { \ + /* io_abi_version */ _CITRUS_ICONV_ABI_VERSION, \ + /* io_init_shared */ &_citrus_##_m_##_iconv_init_shared, \ + /* io_uninit_shared */ &_citrus_##_m_##_iconv_uninit_shared, \ + /* io_init_context */ &_citrus_##_m_##_iconv_init_context, \ + /* io_uninit_context */ &_citrus_##_m_##_iconv_uninit_context, \ + /* io_convert */ &_citrus_##_m_##_iconv_convert \ +} + +typedef _CITRUS_ICONV_GETOPS_FUNC_BASE((*_citrus_iconv_getops_t)); +typedef int (*_citrus_iconv_init_shared_t) + (struct _citrus_iconv_shared * __restrict, + const char * __restrict, const char * __restrict, + const char * __restrict, const void * __restrict, size_t); +typedef void (*_citrus_iconv_uninit_shared_t) + (struct _citrus_iconv_shared *); +typedef int (*_citrus_iconv_convert_t) + (struct _citrus_iconv * __restrict, + const char *__restrict* __restrict, size_t * __restrict, + char * __restrict * __restrict, size_t * __restrict, uint32_t, + size_t * __restrict); +typedef int (*_citrus_iconv_init_context_t)(struct _citrus_iconv *); +typedef void (*_citrus_iconv_uninit_context_t)(struct _citrus_iconv *); + +struct _citrus_iconv_ops { + uint32_t io_abi_version; + _citrus_iconv_init_shared_t io_init_shared; + _citrus_iconv_uninit_shared_t io_uninit_shared; + _citrus_iconv_init_context_t io_init_context; + _citrus_iconv_uninit_context_t io_uninit_context; + _citrus_iconv_convert_t io_convert; +}; +#define _CITRUS_ICONV_ABI_VERSION 2 + +struct _citrus_iconv_shared { + struct _citrus_iconv_ops *ci_ops; + void *ci_closure; + /* private */ + _CITRUS_HASH_ENTRY(_citrus_iconv_shared) ci_hash_entry; + TAILQ_ENTRY(_citrus_iconv_shared) ci_tailq_entry; + _citrus_module_t ci_module; + unsigned int ci_used_count; + char *ci_convname; +}; + +struct _citrus_iconv { + struct _citrus_iconv_shared *cv_shared; + void *cv_closure; +}; + +#endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_lookup.c src/lib/libc/citrus/citrus_lookup.c --- src.orig/lib/libc/citrus/citrus_lookup.c Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_lookup.c Thu Jun 18 13:03:23 2009 @@ -0,0 +1,345 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_lookup.c,v 1.5 2006/03/27 01:09:11 christos Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include + +#include "citrus_namespace.h" +#include "citrus_bcs.h" +#include "citrus_region.h" +#include "citrus_memstream.h" +#include "citrus_mmap.h" +#include "citrus_db.h" +#include "citrus_db_hash.h" +#include "citrus_lookup.h" +#include "citrus_lookup_file.h" + +struct _citrus_lookup { + union { + struct { + struct _citrus_db *db; + struct _citrus_region file; + int num, idx; + struct _db_locator locator; + } db; + struct { + struct _region r; + struct _memstream ms; + } plain; + } u; +#define cl_db u.db.db +#define cl_dbidx u.db.idx +#define cl_dbfile u.db.file +#define cl_dbnum u.db.num +#define cl_dblocator u.db.locator +#define cl_plainr u.plain.r +#define cl_plainms u.plain.ms + int cl_ignore_case; + int cl_rewind; + char *cl_key; + size_t cl_keylen; + int (*cl_next)(struct _citrus_lookup *, struct _region *, + struct _region *); + int (*cl_lookup)(struct _citrus_lookup *, const char *, + struct _region *); + int (*cl_num_entries)(struct _citrus_lookup *); + void (*cl_close)(struct _citrus_lookup *); +}; + +static int +seq_get_num_entries_db(struct _citrus_lookup *cl) +{ + return cl->cl_dbnum; +} + +static int +seq_next_db(struct _citrus_lookup *cl, + struct _region *key, struct _region *data) +{ + + if (cl->cl_key) { + if (key) + _region_init(key, cl->cl_key, cl->cl_keylen); + return _db_lookup_by_s(cl->cl_db, cl->cl_key, data, + &cl->cl_dblocator); + } + + if (cl->cl_rewind) { + cl->cl_dbidx = 0; + } + cl->cl_rewind = 0; + if (cl->cl_dbidx >= cl->cl_dbnum) + return ENOENT; + + return _db_get_entry(cl->cl_db, cl->cl_dbidx++, key, data); +} + +static int +seq_lookup_db(struct _citrus_lookup *cl, const char *key, + struct _region *data) +{ + cl->cl_rewind = 0; + free(cl->cl_key); + cl->cl_key = strdup(key); + if (cl->cl_ignore_case) + _bcs_convert_to_lower(cl->cl_key); + cl->cl_keylen = strlen(cl->cl_key); + _db_locator_init(&cl->cl_dblocator); + return _db_lookup_by_s(cl->cl_db, cl->cl_key, data, &cl->cl_dblocator); +} + +static void +seq_close_db(struct _citrus_lookup *cl) +{ + _db_close(cl->cl_db); + _unmap_file(&cl->cl_dbfile); +} + +static int +seq_open_db(struct _citrus_lookup *cl, const char *name) +{ + int ret; + struct _region r; + char path[PATH_MAX]; + + snprintf(path, sizeof(path), "%s.db", name); + ret = _map_file(&r, path); + if (ret) + return ret; + + ret = _db_open(&cl->cl_db, &r, _CITRUS_LOOKUP_MAGIC, + _db_hash_std, NULL); + if (ret) { + _unmap_file(&r); + return ret; + } + + cl->cl_dbfile = r; + cl->cl_dbnum = _db_get_num_entries(cl->cl_db); + cl->cl_dbidx = 0; + cl->cl_rewind = 1; + cl->cl_lookup = &seq_lookup_db; + cl->cl_next = &seq_next_db; + cl->cl_num_entries = &seq_get_num_entries_db; + cl->cl_close = &seq_close_db; + + return 0; +} + +#define T_COMM '#' +static int +seq_next_plain(struct _citrus_lookup *cl, struct _region *key, + struct _region *data) +{ + const char *p, *q; + size_t len; + + if (cl->cl_rewind) + _memstream_bind(&cl->cl_plainms, &cl->cl_plainr); + cl->cl_rewind = 0; + +retry: + p = _memstream_getln(&cl->cl_plainms, &len); + if (p == NULL) + return ENOENT; + /* ignore comment */ + q = memchr(p, T_COMM, len); + if (q) { + len = q-p; + } + /* ignore trailing spaces */ + _bcs_trunc_rws_len(p, &len); + p = _bcs_skip_ws_len(p, &len); + q = _bcs_skip_nonws_len(p, &len); + if (p==q) + goto retry; + if (cl->cl_key && (q-p != cl->cl_keylen || + memcmp(p, cl->cl_key, (size_t)(q-p)) != 0)) + goto retry; + + /* found a entry */ + if (key) + _region_init(key, /*LINTED*/(void *)p, (size_t)(q-p)); + p = _bcs_skip_ws_len(q, &len); + if (data) + _region_init(data, len ? /*LINTED*/(void *)p : NULL, len); + + return 0; +} + +static int +seq_get_num_entries_plain(struct _citrus_lookup *cl) +{ + int num; + + num = 0; + while (seq_next_plain(cl, NULL, NULL) == 0) + num++; + + return num; +} + +static int +seq_lookup_plain(struct _citrus_lookup *cl, const char *key, + struct _region *data) +{ + size_t len; + const char *p; + + cl->cl_rewind = 0; + free(cl->cl_key); + cl->cl_key = strdup(key); + if (cl->cl_ignore_case) + _bcs_convert_to_lower(cl->cl_key); + cl->cl_keylen = strlen(cl->cl_key); + _memstream_bind(&cl->cl_plainms, &cl->cl_plainr); + p = _memstream_matchline(&cl->cl_plainms, cl->cl_key, &len, 0); + if (p == NULL) + return ENOENT; + if (data) + _region_init(data, /*LINTED*/(void *)p, len); + + return 0; +} + +static void +seq_close_plain(struct _citrus_lookup *cl) +{ + _unmap_file(&cl->cl_plainr); +} + +static int +seq_open_plain(struct _citrus_lookup *cl, const char *name) +{ + int ret; + + /* open read stream */ + ret = _map_file(&cl->cl_plainr, name); + if (ret) + return ret; + + cl->cl_rewind = 1; + cl->cl_next = &seq_next_plain; + cl->cl_lookup = &seq_lookup_plain; + cl->cl_num_entries = &seq_get_num_entries_plain; + cl->cl_close = &seq_close_plain; + + return 0; +} + +int +_citrus_lookup_seq_open(struct _citrus_lookup **rcl, const char *name, + int ignore_case) +{ + int ret; + struct _citrus_lookup *cl; + + cl = malloc(sizeof(*cl)); + if (cl == NULL) + return errno; + + cl->cl_key = NULL; + cl->cl_keylen = 0; + cl->cl_ignore_case = ignore_case; + ret = seq_open_db(cl, name); + if (ret == ENOENT) + ret = seq_open_plain(cl, name); + if (!ret) + *rcl = cl; + else + free(cl); + + return ret; +} + +void +_citrus_lookup_seq_rewind(struct _citrus_lookup *cl) +{ + cl->cl_rewind = 1; + free(cl->cl_key); + cl->cl_key = NULL; + cl->cl_keylen = 0; +} + +int +_citrus_lookup_seq_next(struct _citrus_lookup *cl, + struct _region *key, struct _region *data) +{ + return (*cl->cl_next)(cl, key, data); +} + +int +_citrus_lookup_seq_lookup(struct _citrus_lookup *cl, const char *key, + struct _region *data) +{ + return (*cl->cl_lookup)(cl, key, data); +} + +int +_citrus_lookup_get_number_of_entries(struct _citrus_lookup *cl) +{ + return (*cl->cl_num_entries)(cl); +} + +void +_citrus_lookup_seq_close(struct _citrus_lookup *cl) +{ + free(cl->cl_key); + (*cl->cl_close)(cl); + free(cl); +} + +char * +_citrus_lookup_simple(const char *name, const char *key, + char *linebuf, size_t linebufsize, int ignore_case) +{ + int ret; + struct _citrus_lookup *cl; + struct _region data; + + ret = _citrus_lookup_seq_open(&cl, name, ignore_case); + if (ret) + return NULL; + + ret = _citrus_lookup_seq_lookup(cl, key, &data); + if (ret) { + _citrus_lookup_seq_close(cl); + return NULL; + } + + snprintf(linebuf, linebufsize, "%.*s", + (int)_region_size(&data), (const char *)_region_head(&data)); + + _citrus_lookup_seq_close(cl); + + return linebuf; +} diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_lookup.h src/lib/libc/citrus/citrus_lookup.h --- src.orig/lib/libc/citrus/citrus_lookup.h Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_lookup.h Thu Jun 18 13:03:23 2009 @@ -0,0 +1,62 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_lookup.h,v 1.2 2004/07/21 14:16:34 tshiozak Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _CITRUS_LOOKUP_H_ +#define _CITRUS_LOOKUP_H_ + +#define _CITRUS_LOOKUP_CASE_SENSITIVE 0 +#define _CITRUS_LOOKUP_CASE_IGNORE 1 + +struct _citrus_lookup; +__BEGIN_DECLS +char *_citrus_lookup_simple(const char *, const char *, char *, size_t, int); +int _citrus_lookup_seq_open(struct _citrus_lookup **, const char *, int); +void _citrus_lookup_seq_rewind(struct _citrus_lookup *); +int _citrus_lookup_seq_next(struct _citrus_lookup *, + struct _region *, struct _region *); +int _citrus_lookup_seq_lookup(struct _citrus_lookup *, const char *, + struct _region *); +int _citrus_lookup_get_number_of_entries(struct _citrus_lookup *); +void _citrus_lookup_seq_close(struct _citrus_lookup *); +__END_DECLS + +static __inline const char * +_citrus_lookup_alias(const char *path, const char *key, char *buf, size_t n, + int ignore_case) +{ + const char *ret; + + ret = _citrus_lookup_simple(path, key, buf, n, ignore_case); + if (ret == NULL) + ret = key; + + return ret; +} + +#endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_lookup_factory.c src/lib/libc/citrus/citrus_lookup_factory.c --- src.orig/lib/libc/citrus/citrus_lookup_factory.c Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_lookup_factory.c Thu Jun 18 13:03:23 2009 @@ -0,0 +1,117 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_lookup_factory.c,v 1.4 2003/10/27 00:12:42 lukem Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include + +#include "citrus_namespace.h" +#include "citrus_region.h" +#include "citrus_bcs.h" +#include "citrus_db_factory.h" +#include "citrus_db_hash.h" +#include "citrus_lookup_factory.h" +#include "citrus_lookup_file.h" + +#define T_COMM '#' +static int +convert_line(struct _citrus_db_factory *df, const char *line, size_t len) +{ + const char *p; + char key[LINE_MAX], data[LINE_MAX]; + + /* cut off trailing comment */ + p = memchr(line, T_COMM, len); + if (p) + len = p - line; + + /* key */ + line = _bcs_skip_ws_len(line, &len); + if (len == 0) + return 0; + p = _bcs_skip_nonws_len(line, &len); + if (p==line) + return 0; + snprintf(key, sizeof(key), "%.*s", (int)(p-line), line); + _bcs_convert_to_lower(key); + + /* data */ + line = _bcs_skip_ws_len(p, &len); + _bcs_trunc_rws_len(line, &len); + snprintf(data, sizeof(data), "%.*s", (int)len, line); + + return _db_factory_addstr_by_s(df, key, data); +} + +static int +dump_db(struct _citrus_db_factory *df, struct _region *r) +{ + size_t size; + void *ptr; + + size = _db_factory_calc_size(df); + ptr = malloc(size); + if (ptr == NULL) + return errno; + _region_init(r, ptr, size); + + return _db_factory_serialize(df, _CITRUS_LOOKUP_MAGIC, r); +} + +int +_citrus_lookup_factory_convert(FILE *out, FILE *in) +{ + struct _citrus_db_factory *df; + struct _region r; + char *line; + size_t size; + int ret; + + ret = _db_factory_create(&df, &_db_hash_std, NULL); + if (ret) + return ret; + + while ((line = fgetln(in, &size)) != NULL) + if ((ret = convert_line(df, line, size))) { + _db_factory_free(df); + return ret; + } + + ret = dump_db(df, &r); + _db_factory_free(df); + if (ret) + return ret; + + if (fwrite(_region_head(&r), _region_size(&r), 1, out) != 1) + return errno; + + return 0; +} diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_lookup_factory.h src/lib/libc/citrus/citrus_lookup_factory.h --- src.orig/lib/libc/citrus/citrus_lookup_factory.h Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_lookup_factory.h Thu Jun 18 13:03:23 2009 @@ -0,0 +1,37 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_lookup_factory.h,v 1.1 2003/06/25 09:51:35 tshiozak Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _CITRUS_LOOKUP_FACTORY_H_ +#define _CITRUS_LOOKUP_FACTORY_H_ + +__BEGIN_DECLS +int _citrus_lookup_factory_convert(FILE *, FILE *); +__END_DECLS + +#endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_lookup_file.h src/lib/libc/citrus/citrus_lookup_file.h --- src.orig/lib/libc/citrus/citrus_lookup_file.h Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_lookup_file.h Thu Jun 18 13:03:23 2009 @@ -0,0 +1,35 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_lookup_file.h,v 1.1 2003/06/25 09:51:36 tshiozak Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _CITRUS_LOOKUP_FILE_H_ +#define _CITRUS_LOOKUP_FILE_H_ + +#define _CITRUS_LOOKUP_MAGIC "LOOKUP\0\0" + +#endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_mapper.c src/lib/libc/citrus/citrus_mapper.c --- src.orig/lib/libc/citrus/citrus_mapper.c Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_mapper.c Thu Jun 18 13:03:23 2009 @@ -0,0 +1,395 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_mapper.c,v 1.6 2004/12/30 05:05:01 christos Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include "thread_private.h" + +#include "citrus_namespace.h" +#include "citrus_types.h" +#include "citrus_region.h" +#include "citrus_memstream.h" +#include "citrus_bcs.h" +#include "citrus_mmap.h" +#include "citrus_module.h" +#include "citrus_hash.h" +#include "citrus_mapper.h" + +#define _CITRUS_MAPPER_DIR "mapper.dir" + +#define CM_HASH_SIZE 101 +#define REFCOUNT_PERSISTENT -1 + +_THREAD_PRIVATE_MUTEX(citrus_mapper); + +struct _citrus_mapper_area { + _CITRUS_HASH_HEAD(, _citrus_mapper, CM_HASH_SIZE) ma_cache; + char *ma_dir; +}; + +/* + * _citrus_mapper_create_area: + * create mapper area + */ + +int +_citrus_mapper_create_area( + struct _citrus_mapper_area *__restrict *__restrict rma, + const char *__restrict area) +{ + struct stat st; + int ret; + char path[PATH_MAX]; + struct _citrus_mapper_area *ma; + + _THREAD_PRIVATE_MUTEX_LOCK(citrus_mapper); + + if (*rma != NULL) { + ret = 0; + goto quit; + } + + snprintf(path, (size_t)PATH_MAX, "%s/%s", area, _CITRUS_MAPPER_DIR); + + ret = stat(path, &st); + if (ret) + goto quit; + + ma = malloc(sizeof(*ma)); + if (ma == NULL) { + ret = errno; + goto quit; + } + ma->ma_dir = strdup(area); + if (ma->ma_dir == NULL) { + ret = errno; + free(ma->ma_dir); + goto quit; + } + _CITRUS_HASH_INIT(&ma->ma_cache, CM_HASH_SIZE); + + *rma = ma; + ret = 0; +quit: + _THREAD_PRIVATE_MUTEX_UNLOCK(citrus_mapper); + + return ret; +} + + +/* + * lookup_mapper_entry: + * lookup mapper.dir entry in the specified directory. + * + * line format of iconv.dir file: + * mapper module arg + * mapper : mapper name. + * module : mapper module name. + * arg : argument for the module (generally, description file name) + */ + +static int +lookup_mapper_entry(const char *dir, const char *mapname, + void *linebuf, size_t linebufsize, + const char **module, const char **variable) +{ + struct _region r; + struct _memstream ms; + int ret; + const char *cp, *cq; + char *p; + size_t len; + char path[PATH_MAX]; + + /* create mapper.dir path */ + snprintf(path, (size_t)PATH_MAX, "%s/%s", dir, _CITRUS_MAPPER_DIR); + + /* open read stream */ + ret = _map_file(&r, path); + if (ret) + return ret; + + _memstream_bind(&ms, &r); + + /* search the line matching to the map name */ + cp = _memstream_matchline(&ms, mapname, &len, 0); + if (!cp) { + ret = ENOENT; + goto quit; + } + if (!len || len>linebufsize-1) { + ret = EINVAL; + goto quit; + } + + p = linebuf; + /* get module name */ + *module = p; + cq = _bcs_skip_nonws_len(cp, &len); + strlcpy(p, cp, (size_t)(cq-cp+1)); + p += cq-cp+1; + + /* get variable */ + *variable = p; + cp = _bcs_skip_ws_len(cq, &len); + strlcpy(p, cp, len+1); + + ret = 0; + +quit: + _unmap_file(&r); + return ret; +} + +/* + * mapper_close: + * simply close a mapper. (without handling hash) + */ +static void +mapper_close(struct _citrus_mapper *cm) +{ + if (cm->cm_module) { + if (cm->cm_ops) { + if (cm->cm_closure) + (*cm->cm_ops->mo_uninit)(cm); + free(cm->cm_ops); + } + _citrus_unload_module(cm->cm_module); + } + free(cm->cm_traits); + free(cm); +} + +/* + * mapper_open: + * simply open a mapper. (without handling hash) + */ +static int +mapper_open(struct _citrus_mapper_area *__restrict ma, + struct _citrus_mapper * __restrict * __restrict rcm, + const char * __restrict module, + const char * __restrict variable) +{ + int ret; + struct _citrus_mapper *cm; + _citrus_mapper_getops_t getops; + + /* initialize mapper handle */ + cm = malloc(sizeof(*cm)); + if (!cm) + return errno; + + cm->cm_module = NULL; + cm->cm_ops = NULL; + cm->cm_closure = NULL; + cm->cm_traits = NULL; + cm->cm_refcount = 0; + cm->cm_key = NULL; + + /* load module */ + ret = _citrus_load_module(&cm->cm_module, module); + if (ret) + goto err; + + /* get operators */ + getops = (_citrus_mapper_getops_t) + _citrus_find_getops(cm->cm_module, module, "mapper"); + if (!getops) { + ret = EOPNOTSUPP; + goto err; + } + cm->cm_ops = malloc(sizeof(*cm->cm_ops)); + if (!cm->cm_ops) { + ret = errno; + goto err; + } + ret = (*getops)(cm->cm_ops, sizeof(*cm->cm_ops), + _CITRUS_MAPPER_ABI_VERSION); + if (ret) + goto err; + + if (!cm->cm_ops->mo_init || + !cm->cm_ops->mo_uninit || + !cm->cm_ops->mo_convert || + !cm->cm_ops->mo_init_state) + goto err; + + /* allocate traits structure */ + cm->cm_traits = malloc(sizeof(*cm->cm_traits)); + if (cm->cm_traits == NULL) { + ret = errno; + goto err; + } + /* initialize the mapper */ + ret = (*cm->cm_ops->mo_init)(ma, cm, ma->ma_dir, + (const void *)variable, + strlen(variable)+1, + cm->cm_traits, sizeof(*cm->cm_traits)); + if (ret) + goto err; + + *rcm = cm; + + return 0; + +err: + mapper_close(cm); + return ret; +} + +/* + * _citrus_mapper_open_direct: + * open a mapper. + */ +int +_citrus_mapper_open_direct(struct _citrus_mapper_area *__restrict ma, + struct _citrus_mapper * __restrict * __restrict rcm, + const char * __restrict module, + const char * __restrict variable) +{ + return mapper_open(ma, rcm, module, variable); +} + +/* + * hash_func + */ +static __inline int +hash_func(const char *key) +{ + return _string_hash_func(key, CM_HASH_SIZE); +} + +/* + * match_func + */ +static __inline int +match_func(struct _citrus_mapper *cm, const char *key) +{ + return strcmp(cm->cm_key, key); +} + +/* + * _citrus_mapper_open: + * open a mapper with looking up "mapper.dir". + */ +int +_citrus_mapper_open(struct _citrus_mapper_area *__restrict ma, + struct _citrus_mapper * __restrict * __restrict rcm, + const char * __restrict mapname) +{ + int ret; + char linebuf[PATH_MAX]; + const char *module, *variable; + struct _citrus_mapper *cm; + int hashval; + + _THREAD_PRIVATE_MUTEX_LOCK(citrus_mapper); + + /* search in the cache */ + hashval = hash_func(mapname); + _CITRUS_HASH_SEARCH(&ma->ma_cache, cm, cm_entry, match_func, mapname, + hashval); + if (cm) { + /* found */ + cm->cm_refcount++; + *rcm = cm; + ret = 0; + goto quit; + } + + /* search mapper entry */ + ret = lookup_mapper_entry(ma->ma_dir, mapname, linebuf, + (size_t)PATH_MAX, &module, &variable); + if (ret) + goto quit; + + /* open mapper */ + ret = mapper_open(ma, &cm, module, variable); + if (ret) + goto quit; + cm->cm_key = strdup(mapname); + if (cm->cm_key == NULL) { + ret = errno; + _THREAD_PRIVATE_MUTEX_UNLOCK(citrus_mapper); + _mapper_close(cm); + return ret; + } + + /* insert to the cache */ + cm->cm_refcount = 1; + _CITRUS_HASH_INSERT(&ma->ma_cache, cm, cm_entry, hashval); + + *rcm = cm; + ret = 0; +quit: + _THREAD_PRIVATE_MUTEX_UNLOCK(citrus_mapper); + return ret; +} + +/* + * _citrus_mapper_close: + * close the specified mapper. + */ +void +_citrus_mapper_close(struct _citrus_mapper *cm) +{ + if (cm) { + _THREAD_PRIVATE_MUTEX_LOCK(citrus_mapper); + if (cm->cm_refcount == REFCOUNT_PERSISTENT) + goto quit; + if (cm->cm_refcount > 0) { + if (--cm->cm_refcount > 0) + goto quit; + _CITRUS_HASH_REMOVE(cm, cm_entry); + free(cm->cm_key); + } + _THREAD_PRIVATE_MUTEX_UNLOCK(citrus_mapper); + mapper_close(cm); + return; +quit: + _THREAD_PRIVATE_MUTEX_UNLOCK(citrus_mapper); + } +} + +/* + * _citrus_mapper_set_persistent: + * set persistent count. + */ +void +_citrus_mapper_set_persistent(struct _citrus_mapper * __restrict cm) +{ + _THREAD_PRIVATE_MUTEX_LOCK(citrus_mapper); + cm->cm_refcount = REFCOUNT_PERSISTENT; + _THREAD_PRIVATE_MUTEX_UNLOCK(citrus_mapper); +} diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_mapper.h src/lib/libc/citrus/citrus_mapper.h --- src.orig/lib/libc/citrus/citrus_mapper.h Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_mapper.h Thu Jun 18 13:03:23 2009 @@ -0,0 +1,128 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_mapper.h,v 1.3 2003/07/12 15:39:19 tshiozak Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _CITRUS_MAPPER_H_ +#define _CITRUS_MAPPER_H_ + +struct _citrus_mapper_area; +struct _citrus_mapper; +struct _citrus_mapper_ops; +struct _citrus_mapper_traits; + +__BEGIN_DECLS +int _citrus_mapper_create_area( + struct _citrus_mapper_area *__restrict *__restrict, + const char *__restrict); +int _citrus_mapper_open(struct _citrus_mapper_area *__restrict, + struct _citrus_mapper *__restrict *__restrict, + const char *__restrict); +int _citrus_mapper_open_direct( + struct _citrus_mapper_area *__restrict, + struct _citrus_mapper *__restrict *__restrict, + const char *__restrict, const char *__restrict); +void _citrus_mapper_close(struct _citrus_mapper *); +void _citrus_mapper_set_persistent(struct _citrus_mapper * __restrict); +__END_DECLS + +#include "citrus_mapper_local.h" + +/* return values of _citrus_mapper_convert */ +#define _CITRUS_MAPPER_CONVERT_SUCCESS (0) +#define _CITRUS_MAPPER_CONVERT_NONIDENTICAL (1) +#define _CITRUS_MAPPER_CONVERT_SRC_MORE (2) +#define _CITRUS_MAPPER_CONVERT_DST_MORE (3) +#define _CITRUS_MAPPER_CONVERT_ILSEQ (4) +#define _CITRUS_MAPPER_CONVERT_FATAL (5) + +/* + * _citrus_mapper_convert: + * convert an index. + * - if the converter supports M:1 converter, the function may return + * _CITRUS_MAPPER_CONVERT_SRC_MORE and the storage pointed by dst + * may be unchanged in this case, although the internal status of + * the mapper is affected. + * - if the converter supports 1:N converter, the function may return + * _CITRUS_MAPPER_CONVERT_DST_MORE. In this case, the contiguous + * call of this function ignores src and changes the storage pointed + * by dst. + * - if the converter supports M:N converter, the function may behave + * the combination of the above. + * + */ +static __inline int +_citrus_mapper_convert(struct _citrus_mapper * __restrict cm, + _citrus_index_t * __restrict dst, + _citrus_index_t src, + void * __restrict ps) +{ + return (*cm->cm_ops->mo_convert)(cm, dst, src, ps); +} + +/* + * _citrus_mapper_init_state: + * initialize the state. + */ +static __inline void +_citrus_mapper_init_state(struct _citrus_mapper * __restrict cm, + void * __restrict ps) +{ + (*cm->cm_ops->mo_init_state)(cm, ps); +} + +/* + * _citrus_mapper_get_state_size: + * get the size of state storage. + */ +static __inline size_t +_citrus_mapper_get_state_size(struct _citrus_mapper * __restrict cm) +{ + return cm->cm_traits->mt_state_size; +} + +/* + * _citrus_mapper_get_src_max: + * get the maximum number of suspended sources. + */ +static __inline size_t +_citrus_mapper_get_src_max(struct _citrus_mapper * __restrict cm) +{ + return cm->cm_traits->mt_src_max; +} + +/* + * _citrus_mapper_get_dst_max: + * get the maximum number of suspended destinations. + */ +static __inline size_t +_citrus_mapper_get_dst_max(struct _citrus_mapper * __restrict cm) +{ + return cm->cm_traits->mt_dst_max; +} + +#endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_mapper_local.h src/lib/libc/citrus/citrus_mapper_local.h --- src.orig/lib/libc/citrus/citrus_mapper_local.h Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_mapper_local.h Thu Jun 18 13:03:23 2009 @@ -0,0 +1,106 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_mapper_local.h,v 1.2 2008/02/09 14:56:20 junyoung Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _CITRUS_MAPPER_LOCAL_H_ +#define _CITRUS_MAPPER_LOCAL_H_ + +#define _CITRUS_MAPPER_GETOPS_FUNC_BASE(_n_) \ +int _n_(struct _citrus_mapper_ops *, size_t, uint32_t) +#define _CITRUS_MAPPER_GETOPS_FUNC(_n_) \ +_CITRUS_MAPPER_GETOPS_FUNC_BASE(_citrus_##_n_##_mapper_getops) + +#define _CITRUS_MAPPER_DECLS(_m_) \ +static int _citrus_##_m_##_mapper_init \ + (struct _citrus_mapper_area *__restrict, \ + struct _citrus_mapper * __restrict, const char * __restrict, \ + const void * __restrict, size_t, \ + struct _citrus_mapper_traits * __restrict, size_t); \ +static void _citrus_##_m_##_mapper_uninit(struct _citrus_mapper *); \ +static int _citrus_##_m_##_mapper_convert \ + (struct _citrus_mapper * __restrict, \ + _citrus_index_t * __restrict, _citrus_index_t, \ + void * __restrict); \ +static void _citrus_##_m_##_mapper_init_state \ + (struct _citrus_mapper * __restrict, void * __restrict); + +#define _CITRUS_MAPPER_DEF_OPS(_m_) \ +struct _citrus_mapper_ops _citrus_##_m_##_mapper_ops = { \ + /* mo_abi_version */ _CITRUS_MAPPER_ABI_VERSION, \ + /* mo_init */ &_citrus_##_m_##_mapper_init, \ + /* mo_uninit */ &_citrus_##_m_##_mapper_uninit, \ + /* mo_convert */ &_citrus_##_m_##_mapper_convert, \ + /* mo_init_state */ &_citrus_##_m_##_mapper_init_state \ +} + +typedef _CITRUS_MAPPER_GETOPS_FUNC_BASE((*_citrus_mapper_getops_t)); +typedef int (*_citrus_mapper_init_t)( + struct _citrus_mapper_area *__restrict, + struct _citrus_mapper *__restrict, const char *__restrict, + const void *__restrict, size_t, + struct _citrus_mapper_traits * __restrict, size_t); +typedef void (*_citrus_mapper_uninit_t)(struct _citrus_mapper *); +typedef int (*_citrus_mapper_convert_t)(struct _citrus_mapper * __restrict, + _citrus_index_t * __restrict, + _citrus_index_t, + void * __restrict); +typedef void (*_citrus_mapper_init_state_t)( + struct _citrus_mapper * __restrict, void * __restrict); + +/* + * ABI version change log + * 0x00000001 + * initial version + */ +#define _CITRUS_MAPPER_ABI_VERSION 0x00000001 +struct _citrus_mapper_ops { + uint32_t mo_abi_version; + /* version 0x00000001 */ + _citrus_mapper_init_t mo_init; + _citrus_mapper_uninit_t mo_uninit; + _citrus_mapper_convert_t mo_convert; + _citrus_mapper_init_state_t mo_init_state; +}; + +struct _citrus_mapper_traits { + /* version 0x00000001 */ + size_t mt_state_size; + size_t mt_src_max; + size_t mt_dst_max; +}; + +struct _citrus_mapper { + struct _citrus_mapper_ops *cm_ops; + void *cm_closure; + _citrus_module_t cm_module; + struct _citrus_mapper_traits *cm_traits; + _CITRUS_HASH_ENTRY(_citrus_mapper) cm_entry; + int cm_refcount; + char *cm_key; +}; +#endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_memstream.c src/lib/libc/citrus/citrus_memstream.c --- src.orig/lib/libc/citrus/citrus_memstream.c Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_memstream.c Thu Jun 18 13:03:23 2009 @@ -0,0 +1,147 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_memstream.c,v 1.3 2008/02/09 14:56:20 junyoung Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include + +#include "citrus_namespace.h" +#include "citrus_region.h" +#include "citrus_memstream.h" +#include "citrus_bcs.h" + +const char * +_citrus_memory_stream_getln(struct _citrus_memory_stream * __restrict ms, + size_t * __restrict rlen) +{ + int i; + const uint8_t *h, *p; + size_t ret; + + if (ms->ms_pos>=_region_size(&ms->ms_region)) + return (NULL); + + h = p = (uint8_t *)_region_offset(&ms->ms_region, ms->ms_pos); + ret = 0; + for (i = _region_size(&ms->ms_region) - ms->ms_pos; i > 0; i--) { + ret++; + if (_bcs_iseol(*p)) + break; + p++; + } + + ms->ms_pos += ret; + *rlen = ret; + return ((const char *)h); +} + +#define T_COMM '#' + +const char * +_citrus_memory_stream_matchline(struct _citrus_memory_stream * __restrict ms, + const char * __restrict key, + size_t * __restrict rlen, + int iscasesensitive) +{ + const char *p, *q; + size_t len, keylen; + + keylen = strlen(key); + while (/*CONSTCOND*/ 1) { + p = _citrus_memory_stream_getln(ms, &len); + if (p == NULL) + return (NULL); + + /* ignore comment */ + q = memchr(p, T_COMM, len); + if (q) { + len = q-p; + } + /* ignore trailing white space and newline */ + _bcs_trunc_rws_len(p, &len); + if (len == 0) + continue; /* ignore null line */ + + /* skip white spaces at the head of the line */ + p = _bcs_skip_ws_len(p, &len); + q = _bcs_skip_nonws_len(p, &len); + + if (q-p == keylen) { + if (iscasesensitive) { + if (memcmp(key, p, keylen) == 0) + break; /* match */ + } else { + if (_bcs_strncasecmp(key, p, keylen) == 0) + break; /* match */ + } + } + } + + p = _bcs_skip_ws_len(q, &len); + *rlen = len; + + return (p); +} + +void * +_citrus_memory_stream_chr(struct _citrus_memory_stream *ms, + struct _citrus_region *r, char ch) +{ + void *head, *chr; + size_t sz; + + if (ms->ms_pos >= _region_size(&ms->ms_region)) + return NULL; + + head = _region_offset(&ms->ms_region, ms->ms_pos); + chr = memchr(head, ch, _memstream_remainder(ms)); + if (chr == NULL) { + _region_init(r, head, _memstream_remainder(ms)); + ms->ms_pos = _region_size(&ms->ms_region); + return NULL; + } + sz = (char *)chr - (char *)head; + + _region_init(r, head, sz); + ms->ms_pos += sz+1; + + return chr; +} + +void +_citrus_memory_stream_skip_ws(struct _citrus_memory_stream *ms) +{ + int ch; + + while ((ch = _memstream_peek(ms)) != EOF) { + if (!_bcs_isspace(ch)) + break; + _memstream_getc(ms); + } +} diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_memstream.h src/lib/libc/citrus/citrus_memstream.h --- src.orig/lib/libc/citrus/citrus_memstream.h Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_memstream.h Thu Jun 18 13:03:23 2009 @@ -0,0 +1,214 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_memstream.h,v 1.3 2005/05/14 17:55:42 tshiozak Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#ifndef _CITRUS_MEMSTREAM_H_ +#define _CITRUS_MEMSTREAM_H_ + +struct _citrus_memory_stream { + struct _citrus_region ms_region; + size_t ms_pos; +}; + +__BEGIN_DECLS +const char * _citrus_memory_stream_getln( + struct _citrus_memory_stream * __restrict, size_t * __restrict); +const char * _citrus_memory_stream_matchline( + struct _citrus_memory_stream * __restrict, const char * __restrict, + size_t * __restrict, int); +void * _citrus_memory_stream_chr(struct _citrus_memory_stream *, + struct _citrus_region *, char); +void _citrus_memory_stream_skip_ws(struct _citrus_memory_stream *); +__END_DECLS + +static __inline int +_citrus_memory_stream_iseof(struct _citrus_memory_stream *ms) +{ + return ms->ms_pos >= _citrus_region_size(&ms->ms_region); +} + +static __inline void +_citrus_memory_stream_bind(struct _citrus_memory_stream * __restrict ms, + const struct _citrus_region * __restrict r) +{ + ms->ms_region = *r; + ms->ms_pos = 0; +} + +static __inline void +_citrus_memory_stream_bind_ptr(struct _citrus_memory_stream * __restrict ms, + void *ptr, size_t sz) +{ + struct _citrus_region r; + + _citrus_region_init(&r, ptr, sz); + _citrus_memory_stream_bind(ms, &r); +} + +static __inline void +_citrus_memory_stream_rewind(struct _citrus_memory_stream *ms) +{ + ms->ms_pos = 0; +} + +static __inline size_t +_citrus_memory_stream_tell(struct _citrus_memory_stream *ms) +{ + return ms->ms_pos; +} + +static __inline size_t +_citrus_memory_stream_remainder(struct _citrus_memory_stream *ms) +{ + size_t sz; + sz = _citrus_region_size(&ms->ms_region); + if (ms->ms_pos>sz) + return 0; + return sz-ms->ms_pos; +} + +static __inline int +_citrus_memory_stream_seek(struct _citrus_memory_stream *ms, size_t pos, int w) +{ + size_t sz = _citrus_region_size(&ms->ms_region); + switch (w) { + case SEEK_SET: + if (pos>=sz) + return -1; + ms->ms_pos = pos; + break; + case SEEK_CUR: + pos += (ssize_t)ms->ms_pos; + if (pos>=sz) + return -1; + ms->ms_pos = pos; + break; + case SEEK_END: + if (szms_pos = sz - pos; + break; + } + return 0; +} + +static __inline int +_citrus_memory_stream_getc(struct _citrus_memory_stream *ms) +{ + if (_citrus_memory_stream_iseof(ms)) + return (EOF); + return _citrus_region_peek8(&ms->ms_region, ms->ms_pos++); +} + +static __inline void +_citrus_memory_stream_ungetc(struct _citrus_memory_stream *ms, int ch) +{ + if (ch != EOF && ms->ms_pos > 0) + ms->ms_pos--; +} + +static __inline int +_citrus_memory_stream_peek(struct _citrus_memory_stream *ms) +{ + if (_citrus_memory_stream_iseof(ms)) + return (EOF); + return _citrus_region_peek8(&ms->ms_region, ms->ms_pos); +} + +static __inline void * +_citrus_memory_stream_getregion(struct _citrus_memory_stream *ms, + struct _citrus_region *r, size_t sz) +{ + void *ret; + + if (ms->ms_pos + sz > _citrus_region_size(&ms->ms_region)) + return NULL; + + ret = _citrus_region_offset(&ms->ms_region, ms->ms_pos); + ms->ms_pos += sz; + if (r) + _citrus_region_init(r, ret, sz); + + return ret; +} + +static __inline int +_citrus_memory_stream_get8(struct _citrus_memory_stream *ms, uint8_t *rval) +{ + + if (ms->ms_pos + 1 > _citrus_region_size(&ms->ms_region)) + return -1; + + *rval = _citrus_region_peek8(&ms->ms_region, ms->ms_pos); + ms->ms_pos += 2; + + return 0; +} + +static __inline int +_citrus_memory_stream_get16(struct _citrus_memory_stream *ms, uint16_t *rval) +{ + + if (ms->ms_pos + 2 > _citrus_region_size(&ms->ms_region)) + return -1; + + *rval = _citrus_region_peek16(&ms->ms_region, ms->ms_pos); + ms->ms_pos += 2; + + return 0; +} + +static __inline int +_citrus_memory_stream_get32(struct _citrus_memory_stream *ms, uint32_t *rval) +{ + + if (ms->ms_pos + 4 > _citrus_region_size(&ms->ms_region)) + return -1; + + *rval = _citrus_region_peek32(&ms->ms_region, ms->ms_pos); + ms->ms_pos += 4; + + return 0; +} + +static __inline int +_citrus_memory_stream_getln_region(struct _citrus_memory_stream *ms, + struct _citrus_region *r) +{ + const char *ptr; + size_t sz; + + ptr = _citrus_memory_stream_getln(ms, &sz); + if (ptr) + _citrus_region_init(r, /*LINTED*/(void *)ptr, sz); + + return ptr == NULL; +} + +#endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_mmap.c src/lib/libc/citrus/citrus_mmap.c --- src.orig/lib/libc/citrus/citrus_mmap.c Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_mmap.c Thu Jun 18 13:03:23 2009 @@ -0,0 +1,88 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_mmap.c,v 1.3 2005/01/19 00:52:37 mycroft Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "citrus_namespace.h" +#include "citrus_region.h" +#include "citrus_mmap.h" + +int +_citrus_map_file(struct _citrus_region * __restrict r, + const char * __restrict path) +{ + int fd, ret = 0; + struct stat st; + void *head; + + _region_init(r, NULL, 0); + + if ((fd = open(path, O_RDONLY)) == -1) + return errno; + if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) { + ret = errno; + goto error; + } + + if (fstat(fd, &st) == -1) { + ret = errno; + goto error; + } + if (!S_ISREG(st.st_mode)) { + ret = EOPNOTSUPP; + goto error; + } + + head = mmap(NULL, (size_t)st.st_size, PROT_READ, MAP_FILE|MAP_PRIVATE, + fd, (off_t)0); + if (head == MAP_FAILED) { + ret = errno; + goto error; + } + _region_init(r, head, (size_t)st.st_size); + +error: + (void)close(fd); + return ret; +} + +void +_citrus_unmap_file(struct _citrus_region *r) +{ + if (_region_head(r) != NULL) { + (void)munmap(_region_head(r), _region_size(r)); + _region_init(r, NULL, 0); + } +} diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_mmap.h src/lib/libc/citrus/citrus_mmap.h --- src.orig/lib/libc/citrus/citrus_mmap.h Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_mmap.h Thu Jun 18 13:03:23 2009 @@ -0,0 +1,40 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_mmap.h,v 1.1 2003/06/25 09:51:38 tshiozak Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#ifndef _CITRUS_MMAP_H_ +#define _CITRUS_MMAP_H_ + +__BEGIN_DECLS +int _citrus_map_file(struct _citrus_region * __restrict, + const char * __restrict); +void _citrus_unmap_file(struct _citrus_region *); +__END_DECLS + +#endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_module.c src/lib/libc/citrus/citrus_module.c --- src.orig/lib/libc/citrus/citrus_module.c Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_module.c Thu Jun 18 13:03:23 2009 @@ -0,0 +1,335 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_module.c,v 1.7 2008/06/14 16:01:07 tnozaki Exp $ */ + +/*- + * Copyright (c)1999, 2000, 2001, 2002 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/*- + * Copyright (c) 1998 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Paul Kranenburg. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/*- + * Copyright (c) 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Paul Borman at Krystal Technologies. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "citrus_module.h" + +#ifdef _I18N_DYNAMIC + +static int _getdewey(int [], char *); +static int _cmpndewey(int [], int, int [], int); +static const char *_findshlib(char *, int *, int *); + +static const char *_pathI18nModule = NULL; + +/* from libexec/ld.aout_so/shlib.c */ +#undef major +#undef minor +#define MAXDEWEY 3 /*ELF*/ + +static int +_getdewey(int dewey[], char *cp) +{ + int i, n; + + for (n = 0, i = 0; i < MAXDEWEY; i++) { + if (*cp == '\0') + break; + + if (*cp == '.') cp++; + if (*cp < '0' || '9' < *cp) + return 0; + + dewey[n++] = (int)strtol(cp, &cp, 10); + } + + return n; +} + +/* + * Compare two dewey arrays. + * Return -1 if `d1' represents a smaller value than `d2'. + * Return 1 if `d1' represents a greater value than `d2'. + * Return 0 if equal. + */ +static int +_cmpndewey(int d1[], int n1, int d2[], int n2) +{ + register int i; + + for (i = 0; i < n1 && i < n2; i++) { + if (d1[i] < d2[i]) + return -1; + if (d1[i] > d2[i]) + return 1; + } + + if (n1 == n2) + return 0; + + if (i == n1) + return -1; + + if (i == n2) + return 1; + + /* XXX cannot happen */ + return 0; +} + +static const char * +_findshlib(char *name, int *majorp, int *minorp) +{ + int dewey[MAXDEWEY]; + int ndewey; + int tmp[MAXDEWEY]; + int i; + int len; + char *lname; + static char path[PATH_MAX]; + int major, minor; + const char *search_dirs[1]; + const int n_search_dirs = 1; + + major = *majorp; + minor = *minorp; + path[0] = '\0'; + search_dirs[0] = _pathI18nModule; + len = strlen(name); + lname = name; + + ndewey = 0; + + for (i = 0; i < n_search_dirs; i++) { + DIR *dd = opendir(search_dirs[i]); + struct dirent *dp; + int found_dot_a = 0; + int found_dot_so = 0; + + if (dd == NULL) + continue; + + while ((dp = readdir(dd)) != NULL) { + int n; + + if (dp->d_namlen < len + 4) + continue; + if (strncmp(dp->d_name, lname, (size_t)len) != 0) + continue; + if (strncmp(dp->d_name+len, ".so.", 4) != 0) + continue; + + if ((n = _getdewey(tmp, dp->d_name+len+4)) == 0) + continue; + + if (major != -1 && found_dot_a) + found_dot_a = 0; + + /* XXX should verify the library is a.out/ELF? */ + + if (major == -1 && minor == -1) { + goto compare_version; + } else if (major != -1 && minor == -1) { + if (tmp[0] == major) + goto compare_version; + } else if (major != -1 && minor != -1) { + if (tmp[0] == major) { + if (n == 1 || tmp[1] >= minor) + goto compare_version; + } + } + + /* else, this file does not qualify */ + continue; + + compare_version: + if (_cmpndewey(tmp, n, dewey, ndewey) <= 0) + continue; + + /* We have a better version */ + found_dot_so = 1; + snprintf(path, sizeof(path), "%s/%s", search_dirs[i], + dp->d_name); + found_dot_a = 0; + bcopy(tmp, dewey, sizeof(dewey)); + ndewey = n; + *majorp = dewey[0]; + *minorp = dewey[1]; + } + closedir(dd); + + if (found_dot_a || found_dot_so) + /* + * There's a lib in this dir; take it. + */ + return path[0] ? path : NULL; + } + + return path[0] ? path : NULL; +} + +void * +_citrus_find_getops(_citrus_module_t handle, const char *modname, + const char *ifname) +{ + char name[PATH_MAX]; + void *p; + + snprintf(name, sizeof(name), +#ifndef __ELF__ + "_" +#endif + "_citrus_%s_%s_getops", modname, ifname); + p = dlsym((void *)handle, name); + return p; +} + +int +_citrus_load_module(_citrus_module_t *rhandle, const char *encname) +{ + const char *p; + char path[PATH_MAX]; + int maj, min; + void *handle; + + if (_pathI18nModule == NULL) { + p = getenv("PATH_I18NMODULE"); + if (p != NULL && !issetugid()) { + _pathI18nModule = strdup(p); + if (_pathI18nModule == NULL) + return ENOMEM; + } else + _pathI18nModule = _PATH_I18NMODULE; + } + + (void)snprintf(path, sizeof(path), "lib%s", encname); + maj = I18NMODULE_MAJOR; + min = -1; + p = _findshlib(path, &maj, &min); + if (!p) + return (EINVAL); + handle = dlopen(p, RTLD_LAZY); + if (!handle) + return (EINVAL); + + *rhandle = (_citrus_module_t)handle; + + return (0); +} + +void +_citrus_unload_module(_citrus_module_t handle) +{ + if (handle) + dlclose((void *)handle); +} +#else +/* !_I18N_DYNAMIC */ + +void * +/*ARGSUSED*/ +_citrus_find_getops(_citrus_module_t handle, const char *modname, + const char *ifname) +{ + return (NULL); +} + +int +/*ARGSUSED*/ +_citrus_load_module(_citrus_module_t *rhandle, char const *modname) +{ + return (EINVAL); +} + +void +/*ARGSUSED*/ +_citrus_unload_module(_citrus_module_t handle) +{ +} +#endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_module.h src/lib/libc/citrus/citrus_module.h --- src.orig/lib/libc/citrus/citrus_module.h Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_module.h Thu Jun 18 13:03:23 2009 @@ -0,0 +1,44 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_module.h,v 1.1 2002/03/17 22:14:20 tshiozak Exp $ */ + +/*- + * Copyright (c)2002 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#ifndef _CITRUS_MODULE_H_ +#define _CITRUS_MODULE_H_ + +typedef struct _citrus_module_rec *_citrus_module_t; + +__BEGIN_DECLS +void *_citrus_find_getops(_citrus_module_t __restrict, + const char * __restrict, const char * __restrict); +int _citrus_load_module(_citrus_module_t * __restrict, + const char * __restrict); +void _citrus_unload_module(_citrus_module_t); +__END_DECLS + +#endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_namespace.h src/lib/libc/citrus/citrus_namespace.h --- src.orig/lib/libc/citrus/citrus_namespace.h Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_namespace.h Thu Jun 18 13:03:23 2009 @@ -0,0 +1,237 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_namespace.h,v 1.6 2005/10/29 18:02:04 tshiozak Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _CITRUS_NAMESPACE_H_ +#define _CITRUS_NAMESPACE_H_ + +/* citrus_alias */ +#ifndef _CITRUS_ALIAS_NO_NAMESPACE +#define _alias_lookup _citrus_alias_lookup +#endif /* _CITRUS_ALIAS_NO_NAMESPACE */ + +/* citrus_bcs */ +#ifndef _CITRUS_BCS_NO_NAMESPACE +#define _bcs_isalnum _citrus_bcs_isalnum +#define _bcs_isalpha _citrus_bcs_isalpha +#define _bcs_isblank _citrus_bcs_isblank +#define _bcs_isdigit _citrus_bcs_isdigit +#define _bcs_islower _citrus_bcs_islower +#define _bcs_iseol _citrus_bcs_iseol +#define _bcs_isspace _citrus_bcs_isspace +#define _bcs_isupper _citrus_bcs_isupper +#define _bcs_isxdigit _citrus_bcs_isxdigit +#define _bcs_skip_nonws _citrus_bcs_skip_nonws +#define _bcs_skip_nonws_len _citrus_bcs_skip_nonws_len +#define _bcs_skip_ws _citrus_bcs_skip_ws +#define _bcs_skip_ws_len _citrus_bcs_skip_ws_len +#define _bcs_strcasecmp _citrus_bcs_strcasecmp +#define _bcs_strncasecmp _citrus_bcs_strncasecmp +#define _bcs_tolower _citrus_bcs_tolower +#define _bcs_toupper _citrus_bcs_toupper +#define _bcs_trunc_rws_len _citrus_bcs_trunc_rws_len +#define _bcs_convert_to_lower _citrus_bcs_convert_to_lower +#define _bcs_convert_to_upper _citrus_bcs_convert_to_upper +#endif /* _CITRUS_BCS_NO_NAMESPACE */ + +/* citrus_csmapper */ +#ifndef _CITRUS_CSMAPPER_NO_NAMESPACE +#define _csmapper _citrus_csmapper +#define _csmapper_open _citrus_csmapper_open +#define _csmapper_close _citrus_csmapper_close +#define _csmapper_convert _citrus_csmapper_convert +#define _csmapper_init_state _citrus_csmapper_init_state +#define _csmapper_get_state_size _citrus_csmapper_get_state_size +#define _csmapper_get_src_max _citrus_csmapper_get_src_max +#define _csmapper_get_dst_max _citrus_csmapper_get_dst_max +#define _CSMAPPER_F_PREVENT_PIVOT _CITRUS_CSMAPPER_F_PREVENT_PIVOT +#endif /* _CITRUS_CSMAPPER_NO_NAMESPACE */ + +/* citrus_db */ +#ifndef _CITRUS_DB_NO_NAMESPACE +#define _db_open _citrus_db_open +#define _db_close _citrus_db_close +#define _db_lookup _citrus_db_lookup +#define _db_lookup_by_s _citrus_db_lookup_by_string +#define _db_lookup8_by_s _citrus_db_lookup8_by_string +#define _db_lookup16_by_s _citrus_db_lookup16_by_string +#define _db_lookup32_by_s _citrus_db_lookup32_by_string +#define _db_lookupstr_by_s _citrus_db_lookup_string_by_string +#define _db_hash_std _citrus_db_hash_std +#define _db_get_num_entries _citrus_db_get_number_of_entries +#define _db_get_entry _citrus_db_get_entry +#define _db_locator _citrus_db_locator +#define _db_locator_init _citrus_db_locator_init +#endif /* _CITRUS_DB_NO_NAMESPACE */ + +/* citrus_db_factory */ +#ifndef _CITRUS_DB_FACTORY_NO_NAMESPACE +#define _db_factory _citrus_db_factory +#define _db_factory_create _citrus_db_factory_create +#define _db_factory_free _citrus_db_factory_free +#define _db_factory_add _citrus_db_factory_add +#define _db_factory_add_by_s _citrus_db_factory_add_by_string +#define _db_factory_add8_by_s _citrus_db_factory_add8_by_string +#define _db_factory_add16_by_s _citrus_db_factory_add16_by_string +#define _db_factory_add32_by_s _citrus_db_factory_add32_by_string +#define _db_factory_addstr_by_s _citrus_db_factory_add_string_by_string +#define _db_factory_calc_size _citrus_db_factory_calc_size +#define _db_factory_serialize _citrus_db_factory_serialize +#endif /* _CITRUS_DB_FACTORY_NO_NAMESPACE */ + +/* citrus_lookup */ +#ifndef _CITRUS_DB_NO_NAMESPACE +#define _LOOKUP_CASE_SENSITIVE _CITRUS_LOOKUP_CASE_SENSITIVE +#define _LOOKUP_CASE_IGNORE _CITRUS_LOOKUP_CASE_IGNORE +#define _lookup _citrus_lookup +#define _lookup_simple _citrus_lookup_simple +#define _lookup_alias _citrus_lookup_alias +#define _lookup_seq_open _citrus_lookup_seq_open +#define _lookup_seq_rewind _citrus_lookup_seq_rewind +#define _lookup_seq_next _citrus_lookup_seq_next +#define _lookup_seq_lookup _citrus_lookup_seq_lookup +#define _lookup_get_num_entries _citrus_lookup_get_number_of_entries +#define _lookup_seq_close _citrus_lookup_seq_close +#define _lookup_factory_convert _citrus_lookup_factory_convert +#endif /* _CITRUS_DB_NO_NAMESPACE */ + +/* citrus_esdb */ +#ifndef _CITRUS_ESDB_NO_NAMESPACE +#define _esdb _citrus_esdb +#define _esdb_charset _citrus_esdb_charset +#define _esdb_open _citrus_esdb_open +#define _esdb_close _citrus_esdb_close +#define _esdb_get_list _citrus_esdb_get_list +#define _esdb_free_list _citrus_esdb_free_list +#endif /* _CITRUS_ESDB_NO_NAMESPACE */ + +/* citrus_hash */ +#ifndef _CITRUS_HASH_NO_NAMESPACE +#define _citrus_string_hash_func _string_hash_func +#endif /* _CITRUS_HASH_NO_NAMESPACE */ + +/* citrus_mapper */ +#ifndef _CITRUS_MAPPER_NO_NAMESPACE +#define _mapper _citrus_mapper +#define _mapper_ops _citrus_mapper_ops +#define _mapper_traits _citrus_mapper_traits +#define _mapper_open _citrus_mapper_open +#define _mapper_open_direct _citrus_mapper_open_direct +#define _mapper_close _citrus_mapper_close +#define _MAPPER_CONVERT_SUCCESS _CITRUS_MAPPER_CONVERT_SUCCESS +#define _MAPPER_CONVERT_NONIDENTICAL _CITRUS_MAPPER_CONVERT_NONIDENTICAL +#define _MAPPER_CONVERT_SRC_MORE _CITRUS_MAPPER_CONVERT_SRC_MORE +#define _MAPPER_CONVERT_DST_MORE _CITRUS_MAPPER_CONVERT_DST_MORE +#define _MAPPER_CONVERT_ILSEQ _CITRUS_MAPPER_CONVERT_ILSEQ +#define _MAPPER_CONVERT_FATAL _CITRUS_MAPPER_CONVERT_FATAL +#define _mapper_convert _citrus_mapper_convert +#define _mapper_init_state _citrus_mapper_init_state +#define _mapper_get_state_size _citrus_mapper_get_state_size +#define _mapper_get_src_max _citrus_mapper_get_src_max +#define _mapper_get_dst_max _citrus_mapper_get_dst_max +#define _mapper_set_persistent _citrus_mapper_set_persistent +#endif /* _CITRUS_MAPPER_NO_NAMESPACE */ + +/* citrus_memstream */ +#ifndef _CITRUS_MEMSTREAM_NO_NAMESPACE +#define _memstream _citrus_memory_stream +#define _memstream_getln _citrus_memory_stream_getln +#define _memstream_matchline _citrus_memory_stream_matchline +#define _memstream_chr _citrus_memory_stream_chr +#define _memstream_skip_ws _citrus_memory_stream_skip_ws +#define _memstream_iseof _citrus_memory_stream_iseof +#define _memstream_bind _citrus_memory_stream_bind +#define _memstream_bind_ptr _citrus_memory_stream_bind_ptr +#define _memstream_seek _citrus_memory_stream_seek +#define _memstream_rewind _citrus_memory_stream_rewind +#define _memstream_tell _citrus_memory_stream_tell +#define _memstream_remainder _citrus_memory_stream_remainder +#define _memstream_getc _citrus_memory_stream_getc +#define _memstream_ungetc _citrus_memory_stream_ungetc +#define _memstream_peek _citrus_memory_stream_peek +#define _memstream_getregion _citrus_memory_stream_getregion +#define _memstream_getln_region _citrus_memory_stream_getln_region +#endif /* _CITRUS_MEMSTREAM_NO_NAMESPACE */ + +/* citrus_mmap */ +#ifndef _CITRUS_MMAP_NO_NAMESPACE +#define _map_file _citrus_map_file +#define _unmap_file _citrus_unmap_file +#endif /* _CITRUS_MMAP_NO_NAMESPACE */ + +#ifndef _CITRUS_PIVOT_NO_NAMESPACE +#define _pivot_factory_convert _citrus_pivot_factory_convert +#endif /* _CITRUS_PIVOT_NO_NAMESPACE */ + +/* citrus_region.h */ +#ifndef _CITRUS_REGION_NO_NAMESPACE +#define _region _citrus_region +#define _region_init _citrus_region_init +#define _region_head _citrus_region_head +#define _region_size _citrus_region_size +#define _region_check _citrus_region_check +#define _region_offset _citrus_region_offset +#define _region_peek8 _citrus_region_peek8 +#define _region_peek16 _citrus_region_peek16 +#define _region_peek32 _citrus_region_peek32 +#define _region_get_subregion _citrus_region_get_subregion +#endif /* _CITRUS_REGION_NO_NAMESPACE */ + +/* citrus_stdenc.h */ +#ifndef _CITRUS_STDENC_NO_NAMESPACE +#define _stdenc _citrus_stdenc +#define _stdenc_ops _citrus_stdenc_ops +#define _stdenc_traits _citrus_stdenc_traits +#define _stdenc_state_desc _citrus_stdenc_state_desc +#define _stdenc_open _citrus_stdenc_open +#define _stdenc_close _citrus_stdenc_close +#define _stdenc_init_state _citrus_stdenc_init_state +#define _stdenc_mbtocs _citrus_stdenc_mbtocs +#define _stdenc_cstomb _citrus_stdenc_cstomb +#define _stdenc_mbtowc _citrus_stdenc_mbtowc +#define _stdenc_wctomb _citrus_stdenc_wctomb +#define _stdenc_put_state_reset _citrus_stdenc_put_state_reset +#define _stdenc_get_state_size _citrus_stdenc_get_state_size +#define _stdenc_get_mb_cur_max _citrus_stdenc_get_mb_cur_max +#define _stdenc_get_state_desc _citrus_stdenc_get_state_desc +#define _STDENC_SDID_GENERIC _CITRUS_STDENC_SDID_GENERIC +#define _STDENC_SDGEN_UNKNOWN _CITRUS_STDENC_SDGEN_UNKNOWN +#define _STDENC_SDGEN_INITIAL _CITRUS_STDENC_SDGEN_INITIAL +#define _STDENC_SDGEN_STABLE _CITRUS_STDENC_SDGEN_STABLE +#define _STDENC_SDGEN_INCOMPLETE_CHAR _CITRUS_STDENC_SDGEN_INCOMPLETE_CHAR +#define _STDENC_SDGEN_INCOMPLETE_SHIFT _CITRUS_STDENC_SDGEN_INCOMPLETE_SHIFT +#endif /* _CITRUS_STDENC_NO_NAMESPACE */ + +/* citrus_types.h */ +#ifndef _CITRUS_TYPES_NO_NAMESPACE +#define _index_t _citrus_index_t +#define _csid_t _citrus_csid_t +#define _wc_t _citrus_wc_t +#endif /* _CITRUS_TYPES_NO_NAMESPACE */ + +#endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_none.c src/lib/libc/citrus/citrus_none.c --- src.orig/lib/libc/citrus/citrus_none.c Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_none.c Thu Jun 18 13:03:23 2009 @@ -0,0 +1,490 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_none.c,v 1.18 2008/06/14 16:01:07 tnozaki Exp $ */ + +/*- + * Copyright (c)2002 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include + +#include "citrus_namespace.h" +#include "citrus_types.h" +#include "citrus_module.h" +#include "citrus_ctype.h" +#include "citrus_none.h" +#include "citrus_stdenc.h" + +/* ---------------------------------------------------------------------- */ + +_CITRUS_CTYPE_DECLS(NONE); +_CITRUS_CTYPE_DEF_OPS(NONE); + + +/* ---------------------------------------------------------------------- */ + +static int +/*ARGSUSED*/ +_citrus_NONE_ctype_init(void ** __restrict cl, void * __restrict var, + size_t lenvar, size_t lenps) +{ + *cl = NULL; + return (0); +} + +static void +/*ARGSUSED*/ +_citrus_NONE_ctype_uninit(void *cl) +{ +} + +static unsigned +/*ARGSUSED*/ +_citrus_NONE_ctype_get_mb_cur_max(void *cl) +{ + return (1); +} + +static int +/*ARGSUSED*/ +_citrus_NONE_ctype_mblen(void * __restrict cl, const char * __restrict s, + size_t n, int * __restrict nresult) +{ + if (!s) { + *nresult = 0; /* state independent */ + return (0); + } + if (n==0) { + *nresult = -1; + return (EILSEQ); + } + *nresult = (*s == 0) ? 0 : 1; + return (0); +} + +static int +/*ARGSUSED*/ +_citrus_NONE_ctype_mbrlen(void * __restrict cl, const char * __restrict s, + size_t n, void * __restrict pspriv, + size_t * __restrict nresult) +{ + if (!s) { + *nresult = 0; + return (0); + } + if (n==0) { + *nresult = (size_t)-2; + return (0); + } + *nresult = (*s == 0) ? 0 : 1; + return (0); +} + +static int +/*ARGSUSED*/ +_citrus_NONE_ctype_mbrtowc(void * __restrict cl, wchar_t * __restrict pwc, + const char * __restrict s, size_t n, + void * __restrict pspriv, + size_t * __restrict nresult) +{ + if (s == NULL) { + *nresult = 0; + return (0); + } + if (n == 0) { + *nresult = (size_t)-2; + return (0); + } + + if (pwc != NULL) + *pwc = (wchar_t)(unsigned char) *s; + + *nresult = *s == '\0' ? 0 : 1; + return (0); +} + +static int +/*ARGSUSED*/ +_citrus_NONE_ctype_mbsinit(void * __restrict cl, + const void * __restrict pspriv, + int * __restrict nresult) +{ + *nresult = 1; /* always initial state */ + return (0); +} + +static int +/*ARGSUSED*/ +_citrus_NONE_ctype_mbsrtowcs(void * __restrict cl, wchar_t * __restrict pwcs, + const char ** __restrict s, size_t n, + void * __restrict pspriv, + size_t * __restrict nresult) +{ + int cnt; + const char *s0; + + /* if pwcs is NULL, ignore n */ + if (pwcs == NULL) + n = 1; /* arbitrary >0 value */ + + cnt = 0; + s0 = *s; /* to keep *s unchanged for now, use copy instead. */ + while (n > 0) { + if (pwcs != NULL) { + *pwcs = (wchar_t)(unsigned char)*s0; + } + if (*s0 == '\0') { + s0 = NULL; + break; + } + s0++; + if (pwcs != NULL) { + pwcs++; + n--; + } + cnt++; + } + if (pwcs) + *s = s0; + + *nresult = (size_t)cnt; + + return (0); +} + +static int +_citrus_NONE_ctype_mbstowcs(void * __restrict cl, wchar_t * __restrict wcs, + const char * __restrict s, size_t n, + size_t * __restrict nresult) +{ + const char *rs = s; + + return (_citrus_NONE_ctype_mbsrtowcs(cl, wcs, &rs, n, NULL, nresult)); +} + +static int +/*ARGSUSED*/ +_citrus_NONE_ctype_mbtowc(void * __restrict cl, wchar_t * __restrict pwc, + const char * __restrict s, size_t n, + int * __restrict nresult) +{ + + if (s == NULL) { + *nresult = 0; /* state independent */ + return (0); + } + if (n == 0) { + return (EILSEQ); + } + if (pwc == NULL) { + if (*s == '\0') { + *nresult = 0; + } else { + *nresult = 1; + } + return (0); + } + + *pwc = (wchar_t)(unsigned char)*s; + *nresult = *s == '\0' ? 0 : 1; + + return (0); +} + +static int +/*ARGSUSED*/ +_citrus_NONE_ctype_wcrtomb(void * __restrict cl, char * __restrict s, + wchar_t wc, void * __restrict pspriv, + size_t * __restrict nresult) +{ + if ((wc&~0xFFU) != 0) { + *nresult = (size_t)-1; + return (EILSEQ); + } + + *nresult = 1; + if (s!=NULL) + *s = (char)wc; + + return (0); +} + +static int +/*ARGSUSED*/ +_citrus_NONE_ctype_wcsrtombs(void * __restrict cl, char * __restrict s, + const wchar_t ** __restrict pwcs, size_t n, + void * __restrict pspriv, + size_t * __restrict nresult) +{ + size_t count; + const wchar_t *pwcs0; + + pwcs0 = *pwcs; + count = 0; + + if (s == NULL) + n = 1; + + while (n > 0) { + if ((*pwcs0 & ~0xFFU) != 0) { + *nresult = (size_t)-1; + return (EILSEQ); + } + if (s != NULL) { + *s++ = (char)*pwcs0; + n--; + } + if (*pwcs0 == L'\0') { + pwcs0 = NULL; + break; + } + count++; + pwcs0++; + } + if (s != NULL) + *pwcs = pwcs0; + + *nresult = count; + + return (0); +} + +static int +_citrus_NONE_ctype_wcstombs(void * __restrict cl, char * __restrict s, + const wchar_t * __restrict pwcs, size_t n, + size_t * __restrict nresult) +{ + const wchar_t *rpwcs = pwcs; + + return (_citrus_NONE_ctype_wcsrtombs(cl, s, &rpwcs, n, NULL, nresult)); +} + +static int +_citrus_NONE_ctype_wctomb(void * __restrict cl, char * __restrict s, + wchar_t wc, int * __restrict nresult) +{ + int ret; + size_t nr; + + if (s == 0) { + /* + * initialize state here. + * (nothing to do for us.) + */ + *nresult = 0; /* we're state independent */ + return (0); + } + + ret = _citrus_NONE_ctype_wcrtomb(cl, s, wc, NULL, &nr); + *nresult = (int)nr; + + return (ret); +} + +static int +/*ARGSUSED*/ +_citrus_NONE_ctype_btowc(_citrus_ctype_rec_t * __restrict cc, + int c, wint_t * __restrict wcresult) +{ + if (c == EOF || c & ~0xFF) + *wcresult = WEOF; + else + *wcresult = (wint_t)c; + return (0); +} + +static int +/*ARGSUSED*/ +_citrus_NONE_ctype_wctob(_citrus_ctype_rec_t * __restrict cc, + wint_t wc, int * __restrict cresult) +{ + if (wc == WEOF || wc & ~0xFF) + *cresult = EOF; + else + *cresult = (int)wc; + return (0); +} + +/* ---------------------------------------------------------------------- */ + +_CITRUS_STDENC_DECLS(NONE); +_CITRUS_STDENC_DEF_OPS(NONE); +struct _citrus_stdenc_traits _citrus_NONE_stdenc_traits = { + 0, /* et_state_size */ + 1, /* mb_cur_max */ +}; + +static int +/*ARGSUSED*/ +_citrus_NONE_stdenc_init(struct _citrus_stdenc * __restrict ce, + const void *var, size_t lenvar, + struct _citrus_stdenc_traits * __restrict et) +{ + + et->et_state_size = 0; + et->et_mb_cur_max = 1; + + ce->ce_closure = NULL; + + return (0); +} + +static void +/*ARGSUSED*/ +_citrus_NONE_stdenc_uninit(struct _citrus_stdenc *ce) +{ +} + +static int +/*ARGSUSED*/ +_citrus_NONE_stdenc_init_state(struct _citrus_stdenc * __restrict ce, + void * __restrict ps) +{ + return (0); +} + +static int +/*ARGSUSED*/ +_citrus_NONE_stdenc_mbtocs(struct _citrus_stdenc * __restrict ce, + _csid_t *csid, _index_t *idx, + const char **s, size_t n, + void *ps, size_t *nresult) +{ + if (n<1) { + *nresult = (size_t)-2; + return (0); + } + + *csid = 0; + *idx = (_index_t)(unsigned char)*(*s)++; + *nresult = *idx == 0 ? 0 : 1; + + return (0); +} + +static int +/*ARGSUSED*/ +_citrus_NONE_stdenc_cstomb(struct _citrus_stdenc * __restrict ce, + char *s, size_t n, + _csid_t csid, _index_t idx, + void *ps, size_t *nresult) +{ + + if (csid == _CITRUS_CSID_INVALID) { + *nresult = 0; + return (0); + } + if (n<1) { + *nresult = (size_t)-1; + return (E2BIG); + } + if (csid != 0 || (idx&0xFF) != idx) + return (EILSEQ); + + *s = (char)idx; + *nresult = 1; + + return (0); +} + +static int +/*ARGSUSED*/ +_citrus_NONE_stdenc_mbtowc(struct _citrus_stdenc * __restrict ce, + _wc_t * __restrict pwc, + const char ** __restrict s, size_t n, + void * __restrict pspriv, + size_t * __restrict nresult) +{ + if (s == NULL) { + *nresult = 0; + return (0); + } + if (n == 0) { + *nresult = (size_t)-2; + return (0); + } + + if (pwc != NULL) + *pwc = (_wc_t)(unsigned char) **s; + + *nresult = *s == '\0' ? 0 : 1; + return (0); +} + +static int +/*ARGSUSED*/ +_citrus_NONE_stdenc_wctomb(struct _citrus_stdenc * __restrict ce, + char * __restrict s, size_t n, + _wc_t wc, void * __restrict pspriv, + size_t * __restrict nresult) +{ + if ((wc&~0xFFU) != 0) { + *nresult = (size_t)-1; + return (EILSEQ); + } + if (n==0) { + *nresult = (size_t)-1; + return (E2BIG); + } + + *nresult = 1; + if (s!=NULL && n>0) + *s = (char)wc; + + return (0); +} + +static int +/*ARGSUSED*/ +_citrus_NONE_stdenc_put_state_reset(struct _citrus_stdenc * __restrict ce, + char * __restrict s, size_t n, + void * __restrict pspriv, + size_t * __restrict nresult) +{ + + *nresult = 0; + + return (0); +} + +static int +/*ARGSUSED*/ +_citrus_NONE_stdenc_get_state_desc(struct _stdenc * __restrict ce, + void * __restrict ps, + int id, + struct _stdenc_state_desc * __restrict d) +{ + int ret = 0; + + switch (id) { + case _STDENC_SDID_GENERIC: + d->u.generic.state = _STDENC_SDGEN_INITIAL; + break; + default: + ret = EOPNOTSUPP; + } + + return ret; +} diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_none.h src/lib/libc/citrus/citrus_none.h --- src.orig/lib/libc/citrus/citrus_none.h Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_none.h Thu Jun 18 13:03:23 2009 @@ -0,0 +1,37 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_none.h,v 1.3 2003/06/25 09:51:38 tshiozak Exp $ */ + +/*- + * Copyright (c)2002 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _CITRUS_NONE_H_ +#define _CITRUS_NONE_H_ + +extern struct _citrus_ctype_ops_rec _citrus_NONE_ctype_ops; +extern struct _citrus_stdenc_ops _citrus_NONE_stdenc_ops; +extern struct _citrus_stdenc_traits _citrus_NONE_stdenc_traits; + +#endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_pivot_factory.c src/lib/libc/citrus/citrus_pivot_factory.c --- src.orig/lib/libc/citrus/citrus_pivot_factory.c Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_pivot_factory.c Thu Jun 18 13:03:23 2009 @@ -0,0 +1,222 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_pivot_factory.c,v 1.6 2008/02/09 14:56:20 junyoung Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "citrus_namespace.h" +#include "citrus_region.h" +#include "citrus_bcs.h" +#include "citrus_db_factory.h" +#include "citrus_db_hash.h" +#include "citrus_pivot_file.h" +#include "citrus_pivot_factory.h" + +struct src_entry { + char *se_name; + struct _citrus_db_factory *se_df; + SIMPLEQ_ENTRY(src_entry) se_entry; +}; +SIMPLEQ_HEAD(src_head, src_entry); + +static int +find_src(struct src_head *sh, struct src_entry **rse, const char *name) +{ + int ret; + struct src_entry *se; + + SIMPLEQ_FOREACH(se, sh, se_entry) { + if (_bcs_strcasecmp(se->se_name, name) == 0) { + *rse = se; + return 0; + } + } + se = malloc(sizeof(*se)); + if (se == NULL) + return errno; + se->se_name = strdup(name); + if (se->se_name == NULL) { + ret = errno; + free(se); + return ret; + } + ret = _db_factory_create(&se->se_df, &_db_hash_std, NULL); + if (ret) { + free(se->se_name); + free(se); + return ret; + } + SIMPLEQ_INSERT_TAIL(sh, se, se_entry); + *rse = se; + + return 0; +} + +static void +free_src(struct src_head *sh) +{ + struct src_entry *se; + + while ((se = SIMPLEQ_FIRST(sh)) != NULL) { + SIMPLEQ_REMOVE_HEAD(sh, se_entry); + _db_factory_free(se->se_df); + free(se->se_name); + free(se); + } +} + + +#define T_COMM '#' +static int +convert_line(struct src_head *sh, const char *line, size_t len) +{ + int ret; + struct src_entry *se; + const char *p; + char key1[LINE_MAX], key2[LINE_MAX], data[LINE_MAX], *q; + uint32_t val; + + se = NULL; /* XXX gcc */ + + /* cut off trailing comment */ + p = memchr(line, T_COMM, len); + if (p) + len = p - line; + + /* key1 */ + line = _bcs_skip_ws_len(line, &len); + if (len == 0) + return 0; + p = _bcs_skip_nonws_len(line, &len); + if (p==line) + return 0; + snprintf(key1, sizeof(key1), "%.*s", (int)(p-line), line); + + /* key2 */ + line = _bcs_skip_ws_len(p, &len); + if (len == 0) + return 0; + p = _bcs_skip_nonws_len(line, &len); + if (p==line) + return 0; + snprintf(key2, sizeof(key2), "%.*s", (int)(p-line), line); + + /* data */ + line = _bcs_skip_ws_len(p, &len); + _bcs_trunc_rws_len(line, &len); + snprintf(data, sizeof(data), "%.*s", (int)len, line); + p = (const char *)&data[0]; + val = strtoul(p, (char **)&q, 0); + if (*q != '\0') + return EFTYPE; + + /* insert to DB */ + ret = find_src(sh, &se, key1); + if (ret) + return ret; + + return _db_factory_add32_by_s(se->se_df, key2, val); +} + +static int +dump_db(struct src_head *sh, struct _region *r) +{ + int ret; + struct _db_factory *df; + struct src_entry *se; + size_t size; + void *ptr; + struct _region subr; + + ret = _db_factory_create(&df, &_db_hash_std, NULL); + if (ret) + return ret; + + SIMPLEQ_FOREACH(se, sh, se_entry) { + size = _db_factory_calc_size(se->se_df); + ptr = malloc(size); + if (ptr == NULL) + goto quit; + _region_init(&subr, ptr, size); + ret = _db_factory_serialize(se->se_df, _CITRUS_PIVOT_SUB_MAGIC, + &subr); + if (ret) + goto quit; + ret = _db_factory_add_by_s(df, se->se_name, &subr, 1); + if (ret) + goto quit; + } + + size = _db_factory_calc_size(df); + ptr = malloc(size); + if (ptr == NULL) + goto quit; + _region_init(r, ptr, size); + + ret = _db_factory_serialize(df, _CITRUS_PIVOT_MAGIC, r); + ptr = NULL; + +quit: + free(ptr); + _db_factory_free(df); + return ret; +} + +int +_citrus_pivot_factory_convert(FILE *out, FILE *in) +{ + struct src_head sh; + struct _region r; + char *line; + size_t size; + int ret; + + SIMPLEQ_INIT(&sh); + + while ((line = fgetln(in, &size)) != NULL) + if ((ret = convert_line(&sh, line, size))) { + free_src(&sh); + return ret; + } + + ret = dump_db(&sh, &r); + free_src(&sh); + if (ret) + return ret; + + if (fwrite(_region_head(&r), _region_size(&r), 1, out) != 1) + return errno; + + return 0; +} diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_pivot_factory.h src/lib/libc/citrus/citrus_pivot_factory.h --- src.orig/lib/libc/citrus/citrus_pivot_factory.h Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_pivot_factory.h Thu Jun 18 13:03:23 2009 @@ -0,0 +1,37 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_pivot_factory.h,v 1.1 2003/06/25 09:51:39 tshiozak Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _CITRUS_PIVOT_FACTORY_H_ +#define _CITRUS_PIVOT_FACTORY_H_ + +__BEGIN_DECLS +int _citrus_pivot_factory_convert(FILE *, FILE *); +__END_DECLS + +#endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_pivot_file.h src/lib/libc/citrus/citrus_pivot_file.h --- src.orig/lib/libc/citrus/citrus_pivot_file.h Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_pivot_file.h Thu Jun 18 13:03:23 2009 @@ -0,0 +1,36 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_pivot_file.h,v 1.1 2003/06/25 09:51:39 tshiozak Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _CITRUS_PIVOT_FILE_H_ +#define _CITRUS_PIVOT_FILE_H_ + +#define _CITRUS_PIVOT_MAGIC "CSPIVOT\0" +#define _CITRUS_PIVOT_SUB_MAGIC "CSPIVSUB" + +#endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_prop.c src/lib/libc/citrus/citrus_prop.c --- src.orig/lib/libc/citrus/citrus_prop.c Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_prop.c Thu Jun 18 13:03:23 2009 @@ -0,0 +1,414 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_prop.c,v 1.3 2006/11/22 23:47:21 tnozaki Exp $ */ + +/*- + * Copyright (c)2006 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include +#include +#include +#include +#include +#include + +#include "citrus_namespace.h" +#include "citrus_bcs.h" +#include "citrus_region.h" +#include "citrus_memstream.h" +#include "citrus_prop.h" + +typedef struct { + _citrus_prop_type_t type; + union { + const char *str; + int bool, chr; + uint64_t num; + } u; +} _citrus_prop_object_t; + +static __inline void +_citrus_prop_object_init(_citrus_prop_object_t *obj, _citrus_prop_type_t type) +{ + obj->type = type; + memset(&obj->u, 0, sizeof(obj->u)); +} + +static __inline void +_citrus_prop_object_uninit(_citrus_prop_object_t *obj) +{ + if (obj->type == _CITRUS_PROP_STR) + free(/*LINTED*/(void *)obj->u.str); +} + +static const char *xdigit = "0123456789ABCDEF"; + +#define _CITRUS_PROP_READ_UINT_COMMON(_func_, _type_, _max_) \ +static int \ +_citrus_prop_read_##_func_##_common(struct _memstream * __restrict ms, \ + _type_ * __restrict result, int base) \ +{ \ + _type_ acc, cutoff; \ + int n, ch, cutlim; \ + char *p; \ + \ + acc = (_type_)0; \ + cutoff = _max_ / base; \ + cutlim = _max_ % base; \ + for (;;) { \ + ch = _memstream_getc(ms); \ + p = strchr(xdigit, _bcs_toupper(ch)); \ + if (p == NULL || (n = (p - xdigit)) >= base) \ + break; \ + if (acc > cutoff || (acc == cutoff && n > cutlim)) \ + break; \ + acc *= base; \ + acc += n; \ + } \ + _memstream_ungetc(ms, ch); \ + *result = acc; \ + return 0; \ +} +_CITRUS_PROP_READ_UINT_COMMON(chr, int, UCHAR_MAX) +_CITRUS_PROP_READ_UINT_COMMON(num, uint64_t, UINT64_MAX) +#undef _CITRUS_PROP_READ_UINT_COMMON + +#define _CITRUS_PROP_READ_INT(_func_, _type_) \ +static int \ +_citrus_prop_read_##_func_(struct _memstream * __restrict ms, \ + _citrus_prop_object_t * __restrict obj) \ +{ \ + int ch, neg, base; \ + \ + _memstream_skip_ws(ms); \ + ch = _memstream_getc(ms); \ + neg = 0; \ + switch (ch) { \ + case '-': \ + neg = 1; \ + case '+': \ + ch = _memstream_getc(ms); \ + } \ + base = 10; \ + if (ch == '0') { \ + base -= 2; \ + ch = _memstream_getc(ms); \ + if (ch == 'x' || ch == 'X') { \ + ch = _memstream_getc(ms); \ + if (_bcs_isxdigit(ch) == 0) { \ + _memstream_ungetc(ms, ch); \ + obj->u._func_ = 0; \ + return 0; \ + } \ + base += 8; \ + } \ + } else if (_bcs_isdigit(ch) == 0) \ + return EINVAL; \ + _memstream_ungetc(ms, ch); \ + return _citrus_prop_read_##_func_##_common \ + (ms, &obj->u._func_, base); \ +} +_CITRUS_PROP_READ_INT(chr, int) +_CITRUS_PROP_READ_INT(num, uint64_t) +#undef _CITRUS_PROP_READ_INT + +static int +_citrus_prop_read_character_common(struct _memstream * __restrict ms, + int * __restrict result) +{ + int ch, base; + + ch = _memstream_getc(ms); + if (ch != '\\') { + *result = ch; + } else { + ch = _memstream_getc(ms); + base = 16; + switch (ch) { + case 'a': *result = '\a'; break; + case 'b': *result = '\b'; break; + case 'f': *result = '\f'; break; + case 'n': *result = '\n'; break; + case 'r': *result = '\r'; break; + case 't': *result = '\t'; break; + case 'v': *result = '\v'; break; + /*FALLTHROUGH*/ + case '0': case '1': case '2': case '3': + case '4': case '5': case '6': case '7': + _memstream_ungetc(ms, ch); + base -= 8; + case 'x': + return _citrus_prop_read_chr_common(ms, result, base); + + default: + /* unknown escape */ + *result = ch; + } + } + return 0; +} + +static int +_citrus_prop_read_character(struct _memstream * __restrict ms, + _citrus_prop_object_t * __restrict obj) +{ + int ch, errnum; + + _memstream_skip_ws(ms); + ch = _memstream_getc(ms); + if (ch != '\'') { + _memstream_ungetc(ms, ch); + return _citrus_prop_read_chr(ms, obj); + } + errnum = _citrus_prop_read_character_common(ms, &ch); + if (errnum != 0) + return errnum; + obj->u.chr = ch; + ch = _memstream_getc(ms); + if (ch != '\'') + return EINVAL; + return 0; +} + +static int +_citrus_prop_read_bool(struct _memstream * __restrict ms, + _citrus_prop_object_t * __restrict obj) +{ + _memstream_skip_ws(ms); + switch (_bcs_tolower(_memstream_getc(ms))) { + case 't': + if (_bcs_tolower(_memstream_getc(ms)) == 'r' && + _bcs_tolower(_memstream_getc(ms)) == 'u' && + _bcs_tolower(_memstream_getc(ms)) == 'e') { + obj->u.bool = 1; + return 0; + } + break; + case 'f': + if (_bcs_tolower(_memstream_getc(ms)) == 'a' && + _bcs_tolower(_memstream_getc(ms)) == 'l' && + _bcs_tolower(_memstream_getc(ms)) == 's' && + _bcs_tolower(_memstream_getc(ms)) == 'e') { + obj->u.bool = 0; + return 0; + } + } + return EINVAL; +} + +static int +_citrus_prop_read_str(struct _memstream * __restrict ms, + _citrus_prop_object_t * __restrict obj) +{ + int errnum, quot, ch; + char *s, *t; +#define _CITRUS_PROP_STR_BUFSIZ 512 + size_t n, m; + + m = _CITRUS_PROP_STR_BUFSIZ; + s = malloc(m); + if (s == NULL) + return ENOMEM; + n = 0; + _memstream_skip_ws(ms); + quot = _memstream_getc(ms); + switch (quot) { + case EOF: + goto done; + case '\\': + _memstream_ungetc(ms, quot); + quot = EOF; + /*FALLTHROUGH*/ + case '\"': case '\'': + break; + default: + s[n] = quot; + ++n, --m; + quot = EOF; + } + for (;;) { + if (m < 1) { + m = _CITRUS_PROP_STR_BUFSIZ; + t = realloc(s, n + m); + if (t == NULL) { + free(s); + return ENOMEM; + } + s = t; + } + ch = _memstream_getc(ms); + if (quot == ch || (quot == EOF && + (ch == ';' || _bcs_isspace(ch)))) { +done: + s[n] = '\0'; + obj->u.str = (const char *)s; + return 0; + } + _memstream_ungetc(ms, ch); + errnum = _citrus_prop_read_character_common(ms, &ch); + if (errnum != 0) + return errnum; + s[n] = ch; + ++n, --m; + } + free(s); + return EINVAL; +#undef _CITRUS_PROP_STR_BUFSIZ +} + +typedef int (*_citrus_prop_read_type_t)(struct _memstream * __restrict, + _citrus_prop_object_t * __restrict); + +static const _citrus_prop_read_type_t readers[] = { + _citrus_prop_read_bool, + _citrus_prop_read_str, + _citrus_prop_read_character, + _citrus_prop_read_num, +}; + +static __inline int +_citrus_prop_read_symbol(struct _memstream * __restrict ms, + char * __restrict s, size_t n) +{ + int ch; + size_t m; + + for (m = 0; m < n; ++m) { + ch = _memstream_getc(ms); + if (ch != '_' && _bcs_isalnum(ch) == 0) + goto name_found; + s[m] = ch; + } + ch = _memstream_getc(ms); + if (ch == '_' || _bcs_isalnum(ch) != 0) + return EINVAL; + +name_found: + _memstream_ungetc(ms, ch); + s[m] = '\0'; + + return 0; +} + +static int +_citrus_prop_parse_element(struct _memstream * __restrict ms, + const _citrus_prop_hint_t * __restrict hints, + void ** __restrict context) +{ + int ch, errnum; +#define _CITRUS_PROP_HINT_NAME_LEN_MAX 255 + char name[_CITRUS_PROP_HINT_NAME_LEN_MAX + 1]; + const _citrus_prop_hint_t *hint; + _citrus_prop_object_t ostart, oend; + + errnum = _citrus_prop_read_symbol(ms, name, sizeof(name)); + if (errnum != 0) + return errnum; + for (hint = hints; hint->name != NULL; ++hint) { + if (_citrus_bcs_strcasecmp(name, hint->name) == 0) + goto hint_found; + } + return EINVAL; + +hint_found: + _memstream_skip_ws(ms); + ch = _memstream_getc(ms); + if (ch != '=' && ch != ':') + _memstream_ungetc(ms, ch); + do { + _citrus_prop_object_init(&ostart, hint->type); + _citrus_prop_object_init(&oend, hint->type); + errnum = (*readers[hint->type])(ms, &ostart); + if (errnum != 0) + return errnum; + _memstream_skip_ws(ms); + ch = _memstream_getc(ms); + switch (hint->type) { + case _CITRUS_PROP_BOOL: + case _CITRUS_PROP_STR: + break; + default: + if (ch != '-') + break; + errnum = (*readers[hint->type])(ms, &oend); + if (errnum != 0) + return errnum; + _memstream_skip_ws(ms); + ch = _memstream_getc(ms); + } +#define CALL0(_func_) \ +do { \ + errnum = (*hint->cb._func_.func)(context, \ + hint->name, ostart.u._func_); \ +} while (/*CONSTCOND*/0) +#define CALL1(_func_) \ +do { \ + errnum = (*hint->cb._func_.func)(context, \ + hint->name, ostart.u._func_, oend.u._func_);\ +} while (/*CONSTCOND*/0) + switch (hint->type) { + case _CITRUS_PROP_BOOL: CALL0(bool); break; + case _CITRUS_PROP_STR : CALL0( str); break; + case _CITRUS_PROP_CHR : CALL1( chr); break; + case _CITRUS_PROP_NUM : CALL1( num); break; + default: + abort(); + /*NOTREACHED*/ + } +#undef CALL0 +#undef CALL1 + _citrus_prop_object_uninit(&ostart); + _citrus_prop_object_uninit(&oend); + if (errnum != 0) + return errnum; + } while (ch == ','); + if (ch != ';') + _memstream_ungetc(ms, ch); + return 0; +} + +int +_citrus_prop_parse_variable(const _citrus_prop_hint_t * __restrict hints, + void * __restrict context, const void *var, size_t lenvar) +{ + void *p; + struct _memstream ms; + int errnum, ch; + + p = context; + _memstream_bind_ptr(&ms, /*LINTED*/(void *)var, lenvar); + for (;;) { + _memstream_skip_ws(&ms); + ch = _memstream_getc(&ms); + if (ch == EOF || ch == '\0') + break; + _memstream_ungetc(&ms, ch); + errnum = _citrus_prop_parse_element(&ms, hints, &p); + if (errnum != 0) + return errnum; + } + return 0; +} diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_prop.h src/lib/libc/citrus/citrus_prop.h --- src.orig/lib/libc/citrus/citrus_prop.h Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_prop.h Thu Jun 18 13:03:23 2009 @@ -0,0 +1,92 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_prop.h,v 1.3 2006/11/23 13:59:03 tnozaki Exp $ */ + +/*- + * Copyright (c)2006 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#ifndef _CITRUS_PROP_H_ +#define _CITRUS_PROP_H_ + +typedef enum { + _CITRUS_PROP_BOOL = 0, + _CITRUS_PROP_STR = 1, + _CITRUS_PROP_CHR = 2, + _CITRUS_PROP_NUM = 3, +} _citrus_prop_type_t; + +typedef struct _citrus_prop_hint_t _citrus_prop_hint_t; + +#define _CITRUS_PROP_CB0_T(_func_, _type_) \ +typedef int (*_citrus_prop_##_func_##_cb_func_t) \ + (void ** __restrict, const char *, _type_); \ +typedef struct { \ + _citrus_prop_##_func_##_cb_func_t func; \ +} _citrus_prop_##_func_##_cb_t; +_CITRUS_PROP_CB0_T(bool, int) +_CITRUS_PROP_CB0_T(str, const char *) +#undef _CITRUS_PROP_CB0_T + +#define _CITRUS_PROP_CB1_T(_func_, _type_) \ +typedef int (*_citrus_prop_##_func_##_cb_func_t) \ + (void ** __restrict, const char *, _type_, _type_); \ +typedef struct { \ + _citrus_prop_##_func_##_cb_func_t func; \ +} _citrus_prop_##_func_##_cb_t; +_CITRUS_PROP_CB1_T(chr, int) +_CITRUS_PROP_CB1_T(num, uint64_t) +#undef _CITRUS_PROP_CB1_T + +struct _citrus_prop_hint_t { + const char *name; + _citrus_prop_type_t type; +#define _CITRUS_PROP_CB_T_OPS(_name_) \ + _citrus_prop_##_name_##_cb_t _name_ + union { + _CITRUS_PROP_CB_T_OPS(bool); + _CITRUS_PROP_CB_T_OPS(str); + _CITRUS_PROP_CB_T_OPS(chr); + _CITRUS_PROP_CB_T_OPS(num); + } cb; +}; + +#define _CITRUS_PROP_HINT_BOOL(name, cb) \ + { name, _CITRUS_PROP_BOOL, { .bool = { cb } } } +#define _CITRUS_PROP_HINT_STR(name, cb) \ + { name, _CITRUS_PROP_STR, { .str = { cb } } } +#define _CITRUS_PROP_HINT_CHR(name, cb) \ + { name, _CITRUS_PROP_CHR, { .chr = { cb } } } +#define _CITRUS_PROP_HINT_NUM(name, cb) \ + { name, _CITRUS_PROP_NUM, { .num = { cb } } } +#define _CITRUS_PROP_HINT_END \ + { NULL } + +__BEGIN_DECLS +int _citrus_prop_parse_variable(const _citrus_prop_hint_t * __restrict, + void * __restrict, const void *, size_t); +__END_DECLS + +#endif /* !_CITRUS_PROP_H_ */ diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_region.h src/lib/libc/citrus/citrus_region.h --- src.orig/lib/libc/citrus/citrus_region.h Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_region.h Thu Jun 18 13:03:23 2009 @@ -0,0 +1,104 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_region.h,v 1.7 2008/02/09 14:56:20 junyoung Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#ifndef _CITRUS_REGION_H_ +#define _CITRUS_REGION_H_ + +struct _citrus_region { +/* private: */ + void *r_head; + size_t r_size; +}; + +static __inline void +_citrus_region_init(struct _citrus_region *r, void *h, size_t sz) +{ + r->r_head = h; + r->r_size = sz; +} + +static __inline void * +_citrus_region_head(const struct _citrus_region *r) +{ + return r->r_head; +} + +static __inline size_t +_citrus_region_size(const struct _citrus_region *r) +{ + return r->r_size; +} + +static __inline int +_citrus_region_check(const struct _citrus_region *r, size_t ofs, size_t sz) +{ + return r->r_size >= ofs + sz ? 0 : -1; +} + +static __inline void * +_citrus_region_offset(const struct _citrus_region *r, size_t pos) +{ + return (void *)((uint8_t *)r->r_head + pos); +} + +static __inline uint8_t +_citrus_region_peek8(const struct _citrus_region *r, size_t pos) +{ + return *(uint8_t *)_citrus_region_offset(r, pos); +} + +static __inline uint16_t +_citrus_region_peek16(const struct _citrus_region *r, size_t pos) +{ + uint16_t val; + memcpy(&val, _citrus_region_offset(r, pos), (size_t)2); + return val; +} + +static __inline uint32_t +_citrus_region_peek32(const struct _citrus_region *r, size_t pos) +{ + uint32_t val; + memcpy(&val, _citrus_region_offset(r, pos), (size_t)4); + return val; +} + +static __inline int +_citrus_region_get_subregion(struct _citrus_region *subr, + const struct _citrus_region *r, + size_t ofs, size_t sz) +{ + if (_citrus_region_check(r, ofs, sz)) + return -1; + _citrus_region_init(subr, _citrus_region_offset(r, ofs), sz); + return 0; +} + +#endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_stdenc.c src/lib/libc/citrus/citrus_stdenc.c --- src.orig/lib/libc/citrus/citrus_stdenc.c Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_stdenc.c Thu Jun 18 13:03:23 2009 @@ -0,0 +1,184 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_stdenc.c,v 1.3 2005/10/29 18:02:04 tshiozak Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include + +#include "citrus_namespace.h" +#include "citrus_types.h" +#include "citrus_module.h" +#include "citrus_stdenc.h" +#include "citrus_none.h" + +struct _citrus_stdenc _citrus_stdenc_default = { + &_citrus_NONE_stdenc_ops, /* ce_ops */ + NULL, /* ce_closure */ + NULL, /* ce_module */ + &_citrus_NONE_stdenc_traits, /* ce_traits */ +}; + +#ifdef _I18N_DYNAMIC + +static int +/*ARGSUSED*/ +get_state_desc_default(struct _citrus_stdenc * __restrict ce, + void * __restrict ps, + int id, + struct _citrus_stdenc_state_desc * __restrict d) +{ + return EOPNOTSUPP; +} + +int +_citrus_stdenc_open(struct _citrus_stdenc * __restrict * __restrict rce, + char const * __restrict encname, + const void * __restrict variable, size_t lenvar) +{ + int ret; + _citrus_module_t handle; + struct _citrus_stdenc *ce; + _citrus_stdenc_getops_t getops; + + if (!strcmp(encname, _CITRUS_DEFAULT_STDENC_NAME)) { + *rce = &_citrus_stdenc_default; + return (0); + } + ce = malloc(sizeof(*ce)); + if (ce==NULL) { + ret = errno; + goto bad; + } + ce->ce_ops = NULL; + ce->ce_closure = NULL; + ce->ce_module = NULL; + ce->ce_traits = NULL; + + ret = _citrus_load_module(&handle, encname); + if (ret) + goto bad; + + ce->ce_module = handle; + + getops = + (_citrus_stdenc_getops_t)_citrus_find_getops(ce->ce_module, + encname, "stdenc"); + if (getops == NULL) { + ret = EINVAL; + goto bad; + } + + ce->ce_ops = (struct _citrus_stdenc_ops *)malloc(sizeof(*ce->ce_ops)); + if (ce->ce_ops == NULL) { + ret = errno; + goto bad; + } + + ret = (*getops)(ce->ce_ops, sizeof(*ce->ce_ops), + _CITRUS_STDENC_ABI_VERSION); + if (ret) + goto bad; + + /* If return ABI version is not expected, should fixup it */ + if (ce->ce_ops->eo_abi_version < 0x00000002) { + ce->ce_ops->eo_get_state_desc = &get_state_desc_default; + } + + /* validation check */ + if (ce->ce_ops->eo_init == NULL || + ce->ce_ops->eo_uninit == NULL || + ce->ce_ops->eo_init_state == NULL || + ce->ce_ops->eo_mbtocs == NULL || + ce->ce_ops->eo_cstomb == NULL || + ce->ce_ops->eo_mbtowc == NULL || + ce->ce_ops->eo_wctomb == NULL || + ce->ce_ops->eo_get_state_desc == NULL) + goto bad; + + /* allocate traits */ + ce->ce_traits = malloc(sizeof(*ce->ce_traits)); + if (ce->ce_traits == NULL) { + ret = errno; + goto bad; + } + /* init and get closure */ + ret = (*ce->ce_ops->eo_init)(ce, variable, lenvar, ce->ce_traits); + if (ret) + goto bad; + + *rce = ce; + + return (0); + +bad: + _citrus_stdenc_close(ce); + return (ret); +} + +void +_citrus_stdenc_close(struct _citrus_stdenc *ce) +{ + if (ce == &_citrus_stdenc_default) + return; + + if (ce->ce_module) { + if (ce->ce_ops) { + if (ce->ce_closure && ce->ce_ops->eo_uninit) + (*ce->ce_ops->eo_uninit)(ce); + free(ce->ce_ops); + } + free(ce->ce_traits); + _citrus_unload_module(ce->ce_module); + } + free(ce); +} + +#else +/* !_I18N_DYNAMIC */ + +int +/*ARGSUSED*/ +_citrus_stdenc_open(struct _citrus_stdenc * __restrict * __restrict rce, + char const * __restrict encname, + const void * __restrict variable, size_t lenvar) +{ + if (!strcmp(encname, _CITRUS_DEFAULT_STDENC_NAME)) { + *rce = &_citrus_stdenc_default; + return (0); + } + return (EINVAL); +} + +void +/*ARGSUSED*/ +_citrus_stdenc_close(struct _citrus_stdenc *ce) +{ +} + +#endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_stdenc.h src/lib/libc/citrus/citrus_stdenc.h --- src.orig/lib/libc/citrus/citrus_stdenc.h Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_stdenc.h Thu Jun 18 13:03:23 2009 @@ -0,0 +1,135 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_stdenc.h,v 1.4 2005/10/29 18:02:04 tshiozak Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#ifndef _CITRUS_STDENC_H_ +#define _CITRUS_STDENC_H_ + +struct _citrus_stdenc; +struct _citrus_stdenc_ops; +struct _citrus_stdenc_traits; + +#define _CITRUS_STDENC_SDID_GENERIC 0 +struct _citrus_stdenc_state_desc +{ + union { + struct { + int state; +#define _CITRUS_STDENC_SDGEN_UNKNOWN 0 +#define _CITRUS_STDENC_SDGEN_INITIAL 1 +#define _CITRUS_STDENC_SDGEN_STABLE 2 +#define _CITRUS_STDENC_SDGEN_INCOMPLETE_CHAR 3 +#define _CITRUS_STDENC_SDGEN_INCOMPLETE_SHIFT 4 + } generic; + } u; +}; + +#include "citrus_stdenc_local.h" + +__BEGIN_DECLS +int _citrus_stdenc_open(struct _citrus_stdenc * __restrict * __restrict, + char const * __restrict, + const void * __restrict, size_t); +void _citrus_stdenc_close(struct _citrus_stdenc *); +__END_DECLS + +static __inline int +_citrus_stdenc_init_state(struct _citrus_stdenc * __restrict ce, + void * __restrict ps) +{ + return (*ce->ce_ops->eo_init_state)(ce, ps); +} + +static __inline int +_citrus_stdenc_mbtocs(struct _citrus_stdenc * __restrict ce, + _citrus_csid_t * __restrict csid, + _citrus_index_t * __restrict idx, + const char ** __restrict s, size_t n, + void * __restrict ps, size_t * __restrict nresult) +{ + return (*ce->ce_ops->eo_mbtocs)(ce, csid, idx, s, n, ps, nresult); +} + +static __inline int +_citrus_stdenc_cstomb(struct _citrus_stdenc * __restrict ce, + char * __restrict s, size_t n, + _citrus_csid_t csid, _citrus_index_t idx, + void * __restrict ps, size_t * __restrict nresult) +{ + return (*ce->ce_ops->eo_cstomb)(ce, s, n, csid, idx, ps, nresult); +} + +static __inline int +_citrus_stdenc_mbtowc(struct _citrus_stdenc * __restrict ce, + _citrus_wc_t * __restrict wc, + const char ** __restrict s, size_t n, + void * __restrict ps, size_t * __restrict nresult) +{ + return (*ce->ce_ops->eo_mbtowc)(ce, wc, s, n, ps, nresult); +} + +static __inline int +_citrus_stdenc_wctomb(struct _citrus_stdenc * __restrict ce, + char * __restrict s, size_t n, _citrus_wc_t wc, + void * __restrict ps, size_t * __restrict nresult) +{ + return (*ce->ce_ops->eo_wctomb)(ce, s, n, wc, ps, nresult); +} + +static __inline int +_citrus_stdenc_put_state_reset(struct _citrus_stdenc * __restrict ce, + char * __restrict s, size_t n, + void * __restrict ps, + size_t * __restrict nresult) +{ + return (*ce->ce_ops->eo_put_state_reset)(ce, s, n, ps, nresult); +} + +static __inline size_t +_citrus_stdenc_get_state_size(struct _citrus_stdenc *ce) +{ + return ce->ce_traits->et_state_size; +} + +static __inline size_t +_citrus_stdenc_get_mb_cur_max(struct _citrus_stdenc *ce) +{ + return ce->ce_traits->et_mb_cur_max; +} + +static __inline int +_citrus_stdenc_get_state_desc(struct _citrus_stdenc * __restrict ce, + void * __restrict ps, + int id, + struct _citrus_stdenc_state_desc * __restrict d) +{ + return (*ce->ce_ops->eo_get_state_desc)(ce, ps, id, d); +} + +#endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_stdenc_local.h src/lib/libc/citrus/citrus_stdenc_local.h --- src.orig/lib/libc/citrus/citrus_stdenc_local.h Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_stdenc_local.h Thu Jun 18 13:03:23 2009 @@ -0,0 +1,154 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_stdenc_local.h,v 1.4 2008/02/09 14:56:20 junyoung Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#ifndef _CITRUS_STDENC_LOCAL_H_ +#define _CITRUS_STDENC_LOCAL_H_ + +#define _CITRUS_STDENC_GETOPS_FUNC_BASE(n) \ +int n(struct _citrus_stdenc_ops *, size_t, uint32_t) +#define _CITRUS_STDENC_GETOPS_FUNC(_e_) \ +_CITRUS_STDENC_GETOPS_FUNC_BASE(_citrus_##_e_##_stdenc_getops) +typedef _CITRUS_STDENC_GETOPS_FUNC_BASE((*_citrus_stdenc_getops_t)); + + +#define _CITRUS_STDENC_DECLS(_e_) \ +static int _citrus_##_e_##_stdenc_init \ + (struct _citrus_stdenc * __restrict, const void * __restrict, \ + size_t, struct _citrus_stdenc_traits * __restrict); \ +static void _citrus_##_e_##_stdenc_uninit(struct _citrus_stdenc *); \ +static int _citrus_##_e_##_stdenc_init_state \ + (struct _citrus_stdenc * __restrict, void * __restrict); \ +static int _citrus_##_e_##_stdenc_mbtocs \ + (struct _citrus_stdenc * __restrict, \ + _citrus_csid_t * __restrict, _citrus_index_t * __restrict, \ + const char ** __restrict, size_t, \ + void * __restrict, size_t * __restrict); \ +static int _citrus_##_e_##_stdenc_cstomb \ + (struct _citrus_stdenc * __restrict, char * __restrict, \ + size_t, _citrus_csid_t, _citrus_index_t, \ + void * __restrict, size_t * __restrict); \ +static int _citrus_##_e_##_stdenc_mbtowc \ + (struct _citrus_stdenc * __restrict, \ + _citrus_wc_t * __restrict, \ + const char ** __restrict, size_t, \ + void * __restrict, size_t * __restrict); \ +static int _citrus_##_e_##_stdenc_wctomb \ + (struct _citrus_stdenc * __restrict, char * __restrict, size_t, \ + _citrus_wc_t, void * __restrict, size_t * __restrict); \ +static int _citrus_##_e_##_stdenc_put_state_reset \ + (struct _citrus_stdenc * __restrict, char * __restrict, size_t, \ + void * __restrict, size_t * __restrict); \ +static int _citrus_##_e_##_stdenc_get_state_desc \ + (struct _citrus_stdenc * __restrict, void * __restrict, int, \ + struct _citrus_stdenc_state_desc * __restrict) + +#define _CITRUS_STDENC_DEF_OPS(_e_) \ +struct _citrus_stdenc_ops _citrus_##_e_##_stdenc_ops = { \ + /* eo_abi_version */ _CITRUS_STDENC_ABI_VERSION, \ + /* eo_init */ &_citrus_##_e_##_stdenc_init, \ + /* eo_uninit */ &_citrus_##_e_##_stdenc_uninit, \ + /* eo_init_state */ &_citrus_##_e_##_stdenc_init_state, \ + /* eo_mbtocs */ &_citrus_##_e_##_stdenc_mbtocs, \ + /* eo_cstomb */ &_citrus_##_e_##_stdenc_cstomb, \ + /* eo_mbtowc */ &_citrus_##_e_##_stdenc_mbtowc, \ + /* eo_wctomb */ &_citrus_##_e_##_stdenc_wctomb, \ + /* eo_put_state_reset */&_citrus_##_e_##_stdenc_put_state_reset,\ + /* eo_get_state_desc */ &_citrus_##_e_##_stdenc_get_state_desc \ +} + +typedef int (*_citrus_stdenc_init_t) + (struct _citrus_stdenc * __reatrict, const void * __restrict , size_t, + struct _citrus_stdenc_traits * __restrict); +typedef void (*_citrus_stdenc_uninit_t)(struct _citrus_stdenc * __restrict); +typedef int (*_citrus_stdenc_init_state_t) + (struct _citrus_stdenc * __restrict, void * __restrict); +typedef int (*_citrus_stdenc_mbtocs_t) + (struct _citrus_stdenc * __restrict, + _citrus_csid_t * __restrict, _citrus_index_t * __restrict, + const char ** __restrict, size_t, + void * __restrict, size_t * __restrict); +typedef int (*_citrus_stdenc_cstomb_t) + (struct _citrus_stdenc *__restrict, char * __restrict, size_t, + _citrus_csid_t, _citrus_index_t, void * __restrict, + size_t * __restrict); +typedef int (*_citrus_stdenc_mbtowc_t) + (struct _citrus_stdenc * __restrict, + _citrus_wc_t * __restrict, + const char ** __restrict, size_t, + void * __restrict, size_t * __restrict); +typedef int (*_citrus_stdenc_wctomb_t) + (struct _citrus_stdenc *__restrict, char * __restrict, size_t, + _citrus_wc_t, void * __restrict, size_t * __restrict); +typedef int (*_citrus_stdenc_put_state_reset_t) + (struct _citrus_stdenc *__restrict, char * __restrict, size_t, + void * __restrict, size_t * __restrict); +typedef int (*_citrus_stdenc_get_state_desc_t) + (struct _citrus_stdenc * __restrict, void * __restrict, int, + struct _citrus_stdenc_state_desc * __restrict); +/* + * ABI version change log + * 0x00000001 + * initial version + */ +#define _CITRUS_STDENC_ABI_VERSION 0x00000002 +struct _citrus_stdenc_ops { + uint32_t eo_abi_version; + /* version 0x00000001 */ + _citrus_stdenc_init_t eo_init; + _citrus_stdenc_uninit_t eo_uninit; + _citrus_stdenc_init_state_t eo_init_state; + _citrus_stdenc_mbtocs_t eo_mbtocs; + _citrus_stdenc_cstomb_t eo_cstomb; + _citrus_stdenc_mbtowc_t eo_mbtowc; + _citrus_stdenc_wctomb_t eo_wctomb; + _citrus_stdenc_put_state_reset_t eo_put_state_reset; + /* version 0x00000002 */ + _citrus_stdenc_get_state_desc_t eo_get_state_desc; +}; + +struct _citrus_stdenc_traits { + /* version 0x00000001 */ + size_t et_state_size; + size_t et_mb_cur_max; +}; + +struct _citrus_stdenc { + /* public */ + /* version 0x00000001 */ + struct _citrus_stdenc_ops *ce_ops; + void *ce_closure; + /* private */ + _citrus_module_t ce_module; + struct _citrus_stdenc_traits *ce_traits; +}; + +#define _CITRUS_DEFAULT_STDENC_NAME "NONE" + +#endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_stdenc_template.h src/lib/libc/citrus/citrus_stdenc_template.h --- src.orig/lib/libc/citrus/citrus_stdenc_template.h Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_stdenc_template.h Thu Jun 18 13:03:24 2009 @@ -0,0 +1,203 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_stdenc_template.h,v 1.4 2008/02/09 14:56:20 junyoung Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * CAUTION: THIS IS NOT STANDALONE FILE + * + * function templates of iconv standard encoding handler for each encodings. + * + */ + +/* + * macros + */ + +#undef _TO_EI +#undef _CE_TO_EI +#undef _TO_STATE +#define _TO_EI(_cl_) ((_ENCODING_INFO*)(_cl_)) +#define _CE_TO_EI(_ce_) (_TO_EI((_ce_)->ce_closure)) +#define _TO_STATE(_ps_) ((_ENCODING_STATE*)(_ps_)) + +/* ---------------------------------------------------------------------- + * templates for public functions + */ + +int +_FUNCNAME(stdenc_getops)(struct _citrus_stdenc_ops *ops, size_t lenops, + uint32_t expected_version) +{ + if (expected_version<_CITRUS_STDENC_ABI_VERSION || lenops 0) { + ei = calloc(1, sizeof(_ENCODING_INFO)); + if (ei == NULL) { + return errno; + } + } + + ret = _FUNCNAME(encoding_module_init)(ei, var, lenvar); + if (ret) { + free((void *)ei); + return ret; + } + + ce->ce_closure = ei; + et->et_state_size = sizeof(_ENCODING_STATE); + et->et_mb_cur_max = _ENCODING_MB_CUR_MAX(_CE_TO_EI(ce)); + + return 0; +} + +static void +_FUNCNAME(stdenc_uninit)(struct _citrus_stdenc * __restrict ce) +{ + if (ce) { + _FUNCNAME(encoding_module_uninit)(_CE_TO_EI(ce)); + free(ce->ce_closure); + } +} + +static int +_FUNCNAME(stdenc_init_state)(struct _citrus_stdenc * __restrict ce, + void * __restrict ps) +{ + _FUNCNAME(init_state)(_CE_TO_EI(ce), _TO_STATE(ps)); + + return 0; +} + +static int +_FUNCNAME(stdenc_mbtocs)(struct _citrus_stdenc * __restrict ce, + _citrus_csid_t * __restrict csid, + _citrus_index_t * __restrict idx, + const char ** __restrict s, size_t n, + void * __restrict ps, size_t * __restrict nresult) +{ + int ret; + wchar_t wc; + + ret = _FUNCNAME(mbrtowc_priv)(_CE_TO_EI(ce), &wc, s, n, + _TO_STATE(ps), nresult); + + if (!ret && *nresult != (size_t)-2) + _FUNCNAME(stdenc_wctocs)(_CE_TO_EI(ce), csid, idx, wc); + + return ret; +} + +static int +_FUNCNAME(stdenc_cstomb)(struct _citrus_stdenc * __restrict ce, + char * __restrict s, size_t n, + _citrus_csid_t csid, _citrus_index_t idx, + void * __restrict ps, size_t * __restrict nresult) +{ + int ret; + wchar_t wc; + + wc = 0; + + if (csid != _CITRUS_CSID_INVALID) { + ret = _FUNCNAME(stdenc_cstowc)(_CE_TO_EI(ce), &wc, csid, idx); + if (ret) + return ret; + } + + return _FUNCNAME(wcrtomb_priv)(_CE_TO_EI(ce), s, n, wc, _TO_STATE(ps), + nresult); +} + +static int +_FUNCNAME(stdenc_mbtowc)(struct _citrus_stdenc * __restrict ce, + _citrus_wc_t * __restrict wc, + const char ** __restrict s, size_t n, + void * __restrict ps, size_t * __restrict nresult) +{ + return _FUNCNAME(mbrtowc_priv)(_CE_TO_EI(ce), wc, s, n, + _TO_STATE(ps), nresult); +} + +static int +_FUNCNAME(stdenc_wctomb)(struct _citrus_stdenc * __restrict ce, + char * __restrict s, size_t n, _citrus_wc_t wc, + void * __restrict ps, size_t * __restrict nresult) +{ + return _FUNCNAME(wcrtomb_priv)(_CE_TO_EI(ce), s, n, wc, _TO_STATE(ps), + nresult); +} + +static int +_FUNCNAME(stdenc_put_state_reset)(struct _citrus_stdenc * __restrict ce, + char * __restrict s, size_t n, + void * __restrict ps, + size_t * __restrict nresult) +{ +#if _ENCODING_IS_STATE_DEPENDENT + return _FUNCNAME(put_state_reset)(_CE_TO_EI(ce), s, n, _TO_STATE(ps), + nresult); +#else + *nresult = 0; + return 0; +#endif +} + +static int +_FUNCNAME(stdenc_get_state_desc)(struct _citrus_stdenc * __restrict ce, + void * __restrict ps, + int id, + struct _citrus_stdenc_state_desc * __restrict d) +{ + int ret; + + switch (id) { + case _STDENC_SDID_GENERIC: + ret = _FUNCNAME(stdenc_get_state_desc_generic)( + _CE_TO_EI(ce), _TO_STATE(ps), &d->u.generic.state); + break; + default: + ret = EOPNOTSUPP; + } + + return ret; +} diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/citrus_types.h src/lib/libc/citrus/citrus_types.h --- src.orig/lib/libc/citrus/citrus_types.h Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/citrus_types.h Thu Jun 18 13:03:24 2009 @@ -0,0 +1,38 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_types.h,v 1.3 2003/10/27 00:12:42 lukem Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _CITRUS_TYPES_H_ +#define _CITRUS_TYPES_H_ + +typedef uint32_t _citrus_wc_t; +typedef uint32_t _citrus_index_t; +typedef uint32_t _citrus_csid_t; +#define _CITRUS_CSID_INVALID ((_citrus_csid_t)-1) + +#endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/modules/citrus_big5.c src/lib/libc/citrus/modules/citrus_big5.c --- src.orig/lib/libc/citrus/modules/citrus_big5.c Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/modules/citrus_big5.c Thu Jun 18 13:03:24 2009 @@ -0,0 +1,476 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_big5.c,v 1.12 2008/06/14 16:01:07 tnozaki Exp $ */ + +/*- + * Copyright (c)2002, 2006 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/*- + * Copyright (c) 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Paul Borman at Krystal Technologies. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "citrus_namespace.h" +#include "citrus_types.h" +#include "citrus_module.h" +#include "citrus_ctype.h" +#include "citrus_stdenc.h" + +#include "citrus_bcs.h" +#include "citrus_prop.h" +#include "citrus_big5.h" + +/* ---------------------------------------------------------------------- + * private stuffs used by templates + */ + +typedef struct { + char ch[2]; + int chlen; +} _BIG5State; + +typedef struct _BIG5Exclude { + TAILQ_ENTRY(_BIG5Exclude) entry; + wint_t start, end; +} _BIG5Exclude; + +typedef TAILQ_HEAD(_BIG5ExcludeList, _BIG5Exclude) _BIG5ExcludeList; + +typedef struct { + int cell[0x100]; + _BIG5ExcludeList excludes; +} _BIG5EncodingInfo; + +typedef struct { + _BIG5EncodingInfo ei; + struct { + /* for future multi-locale facility */ + _BIG5State s_mblen; + _BIG5State s_mbrlen; + _BIG5State s_mbrtowc; + _BIG5State s_mbtowc; + _BIG5State s_mbsrtowcs; + _BIG5State s_wcrtomb; + _BIG5State s_wcsrtombs; + _BIG5State s_wctomb; + } states; +} _BIG5CTypeInfo; + +#define _CEI_TO_EI(_cei_) (&(_cei_)->ei) +#define _CEI_TO_STATE(_cei_, _func_) (_cei_)->states.s_##_func_ + +#define _FUNCNAME(m) _citrus_BIG5_##m +#define _ENCODING_INFO _BIG5EncodingInfo +#define _CTYPE_INFO _BIG5CTypeInfo +#define _ENCODING_STATE _BIG5State +#define _ENCODING_MB_CUR_MAX(_ei_) 2 +#define _ENCODING_IS_STATE_DEPENDENT 0 +#define _STATE_NEEDS_EXPLICIT_INIT(_ps_) 0 + + +static __inline void +/*ARGSUSED*/ +_citrus_BIG5_init_state(_BIG5EncodingInfo * __restrict ei, + _BIG5State * __restrict s) +{ + memset(s, 0, sizeof(*s)); +} + +static __inline void +/*ARGSUSED*/ +_citrus_BIG5_pack_state(_BIG5EncodingInfo * __restrict ei, + void * __restrict pspriv, + const _BIG5State * __restrict s) +{ + memcpy(pspriv, (const void *)s, sizeof(*s)); +} + +static __inline void +/*ARGSUSED*/ +_citrus_BIG5_unpack_state(_BIG5EncodingInfo * __restrict ei, + _BIG5State * __restrict s, + const void * __restrict pspriv) +{ + memcpy((void *)s, pspriv, sizeof(*s)); +} + +static __inline int +_citrus_BIG5_check(_BIG5EncodingInfo *ei, u_int c) +{ + return (ei->cell[c & 0xFF] & 0x1) ? 2 : 1; +} + +static __inline int +_citrus_BIG5_check2(_BIG5EncodingInfo *ei, u_int c) +{ + return (ei->cell[c & 0xFF] & 0x2) ? 1 : 0; +} + +static __inline int +_citrus_BIG5_check_excludes(_BIG5EncodingInfo *ei, wint_t c) +{ + _BIG5Exclude *exclude; + + TAILQ_FOREACH(exclude, &ei->excludes, entry) { + if (c >= exclude->start && c <= exclude->end) + return EILSEQ; + } + return 0; +} + +static int +_citrus_BIG5_fill_rowcol(void ** __restrict ctx, const char * __restrict s, + uint64_t start, uint64_t end) +{ + _BIG5EncodingInfo *ei; + int i; + uint64_t n; + + if (start > 0xFF || end > 0xFF) + return EINVAL; + ei = (_BIG5EncodingInfo *)*ctx; + i = strcmp("row", s) ? 1 : 0; + i = 1 << i; + for (n = start; n <= end; ++n) + ei->cell[n & 0xFF] |= i; + return 0; +} + +static int +/*ARGSUSED*/ +_citrus_BIG5_fill_excludes(void ** __restrict ctx, const char * __restrict s, + uint64_t start, uint64_t end) +{ + _BIG5EncodingInfo *ei; + _BIG5Exclude *exclude; + + if (start > 0xFFFF || end > 0xFFFF) + return EINVAL; + ei = (_BIG5EncodingInfo *)*ctx; + exclude = TAILQ_LAST(&ei->excludes, _BIG5ExcludeList); + if (exclude != NULL && (wint_t)start <= exclude->end) + return EINVAL; + exclude = (void *)malloc(sizeof(*exclude)); + if (exclude == NULL) + return ENOMEM; + exclude->start = (wint_t)start; + exclude->end = (wint_t)end; + TAILQ_INSERT_TAIL(&ei->excludes, exclude, entry); + + return 0; +} + +static const _citrus_prop_hint_t root_hints[] = { + _CITRUS_PROP_HINT_NUM("row", &_citrus_BIG5_fill_rowcol), + _CITRUS_PROP_HINT_NUM("col", &_citrus_BIG5_fill_rowcol), + _CITRUS_PROP_HINT_NUM("excludes", &_citrus_BIG5_fill_excludes), + _CITRUS_PROP_HINT_END +}; + +static void +/*ARGSUSED*/ +_citrus_BIG5_encoding_module_uninit(_BIG5EncodingInfo *ei) +{ + _BIG5Exclude *exclude; + + while ((exclude = TAILQ_FIRST(&ei->excludes)) != NULL) { + TAILQ_REMOVE(&ei->excludes, exclude, entry); + free(exclude); + } +} + +static int +/*ARGSUSED*/ +_citrus_BIG5_encoding_module_init(_BIG5EncodingInfo * __restrict ei, + const void * __restrict var, size_t lenvar) +{ + int err; + const char *s; + + memset((void *)ei, 0, sizeof(*ei)); + TAILQ_INIT(&ei->excludes); + + if (lenvar > 0 && var != NULL) { + s = _bcs_skip_ws_len((const char *)var, &lenvar); + if (lenvar > 0 && *s != '\0') { + err = _citrus_prop_parse_variable( + root_hints, (void *)ei, s, lenvar); + if (err == 0) + return 0; + + _citrus_BIG5_encoding_module_uninit(ei); + memset((void *)ei, 0, sizeof(*ei)); + TAILQ_INIT(&ei->excludes); + } + } + + /* fallback Big5-1984, for backward compatibility. */ + _citrus_BIG5_fill_rowcol((void **)&ei, "row", 0xA1, 0xFE); + _citrus_BIG5_fill_rowcol((void **)&ei, "col", 0x40, 0x7E); + _citrus_BIG5_fill_rowcol((void **)&ei, "col", 0xA1, 0xFE); + + return 0; +} + +static int +/*ARGSUSED*/ +_citrus_BIG5_mbrtowc_priv(_BIG5EncodingInfo * __restrict ei, + wchar_t * __restrict pwc, + const char ** __restrict s, size_t n, + _BIG5State * __restrict psenc, + size_t * __restrict nresult) +{ + wchar_t wchar; + int c; + int chlenbak; + const char *s0; + + s0 = *s; + + if (s0 == NULL) { + _citrus_BIG5_init_state(ei, psenc); + *nresult = 0; + return (0); + } + + chlenbak = psenc->chlen; + + /* make sure we have the first byte in the buffer */ + switch (psenc->chlen) { + case 0: + if (n < 1) + goto restart; + psenc->ch[0] = *s0++; + psenc->chlen = 1; + n--; + break; + case 1: + break; + default: + /* illegal state */ + goto ilseq; + } + + c = _citrus_BIG5_check(ei, psenc->ch[0] & 0xff); + if (c == 0) + goto ilseq; + while (psenc->chlen < c) { + if (n < 1) { + goto restart; + } + psenc->ch[psenc->chlen] = *s0++; + psenc->chlen++; + n--; + } + + switch (c) { + case 1: + wchar = psenc->ch[0] & 0xff; + break; + case 2: + if (!_citrus_BIG5_check2(ei, psenc->ch[1] & 0xff)) + goto ilseq; + wchar = ((psenc->ch[0] & 0xff) << 8) | (psenc->ch[1] & 0xff); + break; + default: + /* illegal state */ + goto ilseq; + } + + if (_citrus_BIG5_check_excludes(ei, (wint_t)wchar) != 0) + goto ilseq; + + *s = s0; + psenc->chlen = 0; + if (pwc) + *pwc = wchar; + if (!wchar) + *nresult = 0; + else + *nresult = c - chlenbak; + + return (0); + +ilseq: + psenc->chlen = 0; + *nresult = (size_t)-1; + return (EILSEQ); + +restart: + *s = s0; + *nresult = (size_t)-2; + return (0); +} + +static int +/*ARGSUSED*/ +_citrus_BIG5_wcrtomb_priv(_BIG5EncodingInfo * __restrict ei, + char * __restrict s, + size_t n, wchar_t wc, _BIG5State * __restrict psenc, + size_t * __restrict nresult) +{ + int l, ret; + + /* check invalid sequence */ + if (wc & ~0xffff || + _citrus_BIG5_check_excludes(ei, (wint_t)wc) != 0) { + ret = EILSEQ; + goto err; + } + + if (wc & 0x8000) { + if (_citrus_BIG5_check(ei, (wc >> 8) & 0xff) != 2 || + !_citrus_BIG5_check2(ei, wc & 0xff)) { + ret = EILSEQ; + goto err; + } + l = 2; + } else { + if (wc & ~0xff || !_citrus_BIG5_check(ei, wc & 0xff)) { + ret = EILSEQ; + goto err; + } + l = 1; + } + + if (n < l) { + /* bound check failure */ + ret = E2BIG; + goto err; + } + + if (l == 2) { + s[0] = (wc >> 8) & 0xff; + s[1] = wc & 0xff; + } else + s[0] = wc & 0xff; + + *nresult = l; + + return 0; + +err: + *nresult = (size_t)-1; + return ret; +} + +static __inline int +/*ARGSUSED*/ +_citrus_BIG5_stdenc_wctocs(_BIG5EncodingInfo * __restrict ei, + _csid_t * __restrict csid, + _index_t * __restrict idx, wchar_t wc) +{ + *csid = (wc < 0x100) ? 0 : 1; + *idx = (_index_t)wc; + + return 0; +} + +static __inline int +/*ARGSUSED*/ +_citrus_BIG5_stdenc_cstowc(_BIG5EncodingInfo * __restrict ei, + wchar_t * __restrict wc, + _csid_t csid, _index_t idx) +{ + switch (csid) { + case 0: + case 1: + *wc = (wchar_t)idx; + break; + default: + return EILSEQ; + } + + return 0; +} + +static __inline int +/*ARGSUSED*/ +_citrus_BIG5_stdenc_get_state_desc_generic(_BIG5EncodingInfo * __restrict ei, + _BIG5State * __restrict psenc, + int * __restrict rstate) +{ + + if (psenc->chlen == 0) + *rstate = _STDENC_SDGEN_INITIAL; + else + *rstate = _STDENC_SDGEN_INCOMPLETE_CHAR; + + return 0; +} + +/* ---------------------------------------------------------------------- + * public interface for ctype + */ + +_CITRUS_CTYPE_DECLS(BIG5); +_CITRUS_CTYPE_DEF_OPS(BIG5); + +#include "citrus_ctype_template.h" + + +/* ---------------------------------------------------------------------- + * public interface for stdenc + */ + +_CITRUS_STDENC_DECLS(BIG5); +_CITRUS_STDENC_DEF_OPS(BIG5); + +#include "citrus_stdenc_template.h" diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/modules/citrus_big5.h src/lib/libc/citrus/modules/citrus_big5.h --- src.orig/lib/libc/citrus/modules/citrus_big5.h Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/modules/citrus_big5.h Thu Jun 18 13:03:24 2009 @@ -0,0 +1,38 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_big5.h,v 1.2 2003/06/25 09:51:41 tshiozak Exp $ */ + +/*- + * Copyright (c)2002 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _CITRUS_BIG5_H_ +#define _CITRUS_BIG5_H_ + +__BEGIN_DECLS +_CITRUS_CTYPE_GETOPS_FUNC(BIG5); +_CITRUS_STDENC_GETOPS_FUNC(BIG5); +__END_DECLS + +#endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/modules/citrus_dechanyu.c src/lib/libc/citrus/modules/citrus_dechanyu.c --- src.orig/lib/libc/citrus/modules/citrus_dechanyu.c Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/modules/citrus_dechanyu.c Thu Jun 18 13:03:24 2009 @@ -0,0 +1,402 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_dechanyu.c,v 1.3 2008/06/14 16:01:07 tnozaki Exp $ */ + +/*- + * Copyright (c)2007 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include + +#include "citrus_namespace.h" +#include "citrus_types.h" +#include "citrus_module.h" +#include "citrus_ctype.h" +#include "citrus_stdenc.h" + +#include "citrus_dechanyu.h" + +/* ---------------------------------------------------------------------- + * private stuffs used by templates + */ + +typedef struct { + int chlen; + char ch[4]; +} _DECHanyuState; + +typedef struct { + int dummy; +} _DECHanyuEncodingInfo; + +typedef struct { + _DECHanyuEncodingInfo ei; + struct { + /* for future multi-locale facility */ + _DECHanyuState s_mblen; + _DECHanyuState s_mbrlen; + _DECHanyuState s_mbrtowc; + _DECHanyuState s_mbtowc; + _DECHanyuState s_mbsrtowcs; + _DECHanyuState s_wcrtomb; + _DECHanyuState s_wcsrtombs; + _DECHanyuState s_wctomb; + } states; +} _DECHanyuCTypeInfo; + +#define _CEI_TO_EI(_cei_) (&(_cei_)->ei) +#define _CEI_TO_STATE(_cei_, _func_) (_cei_)->states.__CONCAT(s_,_func_) + +#define _FUNCNAME(m) __CONCAT(_citrus_DECHanyu_,m) +#define _ENCODING_INFO _DECHanyuEncodingInfo +#define _CTYPE_INFO _DECHanyuCTypeInfo +#define _ENCODING_STATE _DECHanyuState +#define _ENCODING_MB_CUR_MAX(_ei_) 4 +#define _ENCODING_IS_STATE_DEPENDENT 0 +#define _STATE_NEEDS_EXPLICIT_INIT(_ps_) 0 + +static __inline void +/*ARGSUSED*/ +_citrus_DECHanyu_init_state(_DECHanyuEncodingInfo * __restrict ei, + _DECHanyuState * __restrict psenc) +{ + psenc->chlen = 0; +} + +static __inline void +/*ARGSUSED*/ +_citrus_DECHanyu_pack_state(_DECHanyuEncodingInfo * __restrict ei, + void * __restrict pspriv, + const _DECHanyuState * __restrict psenc) +{ + memcpy(pspriv, (const void *)psenc, sizeof(*psenc)); +} + +static __inline void +/*ARGSUSED*/ +_citrus_DECHanyu_unpack_state(_DECHanyuEncodingInfo * __restrict ei, + _DECHanyuState * __restrict psenc, + const void * __restrict pspriv) +{ + memcpy((void *)psenc, pspriv, sizeof(*psenc)); +} + +static void +/*ARGSUSED*/ +_citrus_DECHanyu_encoding_module_uninit(_DECHanyuEncodingInfo *ei) +{ + /* ei may be null */ +} + +static int +/*ARGSUSED*/ +_citrus_DECHanyu_encoding_module_init(_DECHanyuEncodingInfo * __restrict ei, + const void * __restrict var, size_t lenvar) +{ + /* ei may be null */ + return 0; +} + +static __inline int +is_singlebyte(int c) +{ + return c <= 0x7F; +} + +static __inline int +is_leadbyte(int c) +{ + return c >= 0xA1 && c <= 0xFE; +} + +static __inline int +is_trailbyte(int c) +{ + c &= ~0x80; + return c >= 0x21 && c <= 0x7E; +} + +static __inline int +is_hanyu1(int c) +{ + return c == 0xC2; +} + +static __inline int +is_hanyu2(int c) +{ + return c == 0xCB; +} + +#define HANYUBIT 0xC2CB0000 + +static __inline int +is_94charset(int c) +{ + return c >= 0x21 && c <= 0x7E; +} + +static int +/*ARGSUSED*/ +_citrus_DECHanyu_mbrtowc_priv(_DECHanyuEncodingInfo * __restrict ei, + wchar_t * __restrict pwc, const char ** __restrict s, size_t n, + _DECHanyuState * __restrict psenc, size_t * __restrict nresult) +{ + const char *s0; + int ch, i; + wchar_t wc; + + if (*s == NULL) { + _citrus_DECHanyu_init_state(ei, psenc); + *nresult = _ENCODING_IS_STATE_DEPENDENT; + return 0; + } + s0 = *s; + + wc = (wchar_t)0; + switch (psenc->chlen) { + case 0: + if (n-- < 1) + goto restart; + ch = *s0++ & 0xFF; + if (is_singlebyte(ch) != 0) { + if (pwc != NULL) + *pwc = (wchar_t)ch; + *nresult = (size_t)((ch == 0) ? 0 : 1); + *s = s0; + return 0; + } + if (is_leadbyte(ch) == 0) + goto ilseq; + psenc->ch[psenc->chlen++] = ch; + break; + case 1: + ch = psenc->ch[0] & 0xFF; + if (is_leadbyte(ch) == 0) + return EINVAL; + break; + case 2: case 3: + ch = psenc->ch[0] & 0xFF; + if (is_hanyu1(ch) != 0) { + ch = psenc->ch[1] & 0xFF; + if (is_hanyu2(ch) != 0) { + wc |= (wchar_t)HANYUBIT; + break; + } + } + /*FALLTHROUGH*/ + default: + return EINVAL; + } + + switch (psenc->chlen) { + case 1: + if (is_hanyu1(ch) != 0) { + if (n-- < 1) + goto restart; + ch = *s0++ & 0xFF; + if (is_hanyu2(ch) == 0) + goto ilseq; + psenc->ch[psenc->chlen++] = ch; + wc |= (wchar_t)HANYUBIT; + if (n-- < 1) + goto restart; + ch = *s0++ & 0xFF; + if (is_leadbyte(ch) == 0) + goto ilseq; + psenc->ch[psenc->chlen++] = ch; + } + break; + case 2: + if (n-- < 1) + goto restart; + ch = *s0++ & 0xFF; + if (is_leadbyte(ch) == 0) + goto ilseq; + psenc->ch[psenc->chlen++] = ch; + break; + case 3: + ch = psenc->ch[2] & 0xFF; + if (is_leadbyte(ch) == 0) + return EINVAL; + } + if (n-- < 1) + goto restart; + wc |= (wchar_t)(ch << 8); + ch = *s0++ & 0xFF; + if (is_trailbyte(ch) == 0) + goto ilseq; + wc |= (wchar_t)ch; + if (pwc != NULL) + *pwc = wc; + *nresult = (size_t)(s0 - *s); + *s = s0; + psenc->chlen = 0; + + return 0; + +restart: + *nresult = (size_t)-2; + *s = s0; + return 0; + +ilseq: + *nresult = (size_t)-1; + return EILSEQ; +} + +static int +/*ARGSUSED*/ +_citrus_DECHanyu_wcrtomb_priv(_DECHanyuEncodingInfo * __restrict ei, + char * __restrict s, size_t n, wchar_t wc, + _DECHanyuState * __restrict psenc, size_t * __restrict nresult) +{ + int ch; + + if (psenc->chlen != 0) + return EINVAL; + + /* XXX: assume wchar_t as int */ + if ((uint32_t)wc <= 0x7F) { + ch = wc & 0xFF; + } else { + if ((uint32_t)wc > 0xFFFF) { + if ((wc & ~0xFFFF) != HANYUBIT) + goto ilseq; + psenc->ch[psenc->chlen++] = (wc >> 24) & 0xFF; + psenc->ch[psenc->chlen++] = (wc >> 16) & 0xFF; + wc &= 0xFFFF; + } + ch = (wc >> 8) & 0xFF; + if (!is_leadbyte(ch)) + goto ilseq; + psenc->ch[psenc->chlen++] = ch; + ch = wc & 0xFF; + if (is_trailbyte(ch) == 0) + goto ilseq; + } + psenc->ch[psenc->chlen++] = ch; + if (n < psenc->chlen) { + *nresult = (size_t)-1; + return E2BIG; + } + memcpy(s, psenc->ch, psenc->chlen); + *nresult = psenc->chlen; + psenc->chlen = 0; + + return 0; + +ilseq: + *nresult = (size_t)-1; + return EILSEQ; +} + +static __inline int +/*ARGSUSED*/ +_citrus_DECHanyu_stdenc_wctocs(_DECHanyuEncodingInfo * __restrict ei, + _csid_t * __restrict csid, _index_t * __restrict idx, wchar_t wc) +{ + int plane; + wchar_t mask; + + plane = 0; + mask = 0x7F; + /* XXX: assume wchar_t as int */ + if ((uint32_t)wc > 0x7F) { + if ((uint32_t)wc > 0xFFFF) { + if ((wc & ~0xFFFF) != HANYUBIT) + return EILSEQ; + plane += 2; + } + if (is_leadbyte((wc >> 8) & 0xFF) == 0 || + is_trailbyte(wc & 0xFF) == 0) + return EILSEQ; + plane += (wc & 0x80) ? 1 : 2; + mask |= 0x7F00; + } + *csid = plane; + *idx = (_index_t)(wc & mask); + + return 0; +} + +static __inline int +/*ARGSUSED*/ +_citrus_DECHanyu_stdenc_cstowc(_DECHanyuEncodingInfo * __restrict ei, + wchar_t * __restrict wc, _csid_t csid, _index_t idx) +{ + if (csid == 0) { + if (idx > 0x7F) + return EILSEQ; + } else if (csid <= 4) { + if (is_94charset(idx >> 8) == 0) + return EILSEQ; + if (is_94charset(idx & 0xFF) == 0) + return EILSEQ; + if (csid % 2) + idx |= 0x80; + idx |= 0x8000; + if (csid > 2) + idx |= HANYUBIT; + } else + return EILSEQ; + *wc = (wchar_t)idx; + return 0; +} + +static __inline int +/*ARGSUSED*/ +_citrus_DECHanyu_stdenc_get_state_desc_generic( + _DECHanyuEncodingInfo * __restrict ei, + _DECHanyuState * __restrict psenc, int * __restrict rstate) +{ + *rstate = (psenc->chlen == 0) + ? _STDENC_SDGEN_INITIAL + : _STDENC_SDGEN_INCOMPLETE_CHAR; + return 0; +} + +/* ---------------------------------------------------------------------- + * public interface for ctype + */ + +_CITRUS_CTYPE_DECLS(DECHanyu); +_CITRUS_CTYPE_DEF_OPS(DECHanyu); + +#include "citrus_ctype_template.h" + + +/* ---------------------------------------------------------------------- + * public interface for stdenc + */ + +_CITRUS_STDENC_DECLS(DECHanyu); +_CITRUS_STDENC_DEF_OPS(DECHanyu); + +#include "citrus_stdenc_template.h" diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/modules/citrus_dechanyu.h src/lib/libc/citrus/modules/citrus_dechanyu.h --- src.orig/lib/libc/citrus/modules/citrus_dechanyu.h Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/modules/citrus_dechanyu.h Thu Jun 18 13:03:24 2009 @@ -0,0 +1,38 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_dechanyu.h,v 1.1 2007/04/01 18:52:32 tnozaki Exp $ */ + +/*- + * Copyright (c)2006 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _CITRUS_DECHANYU_H_ +#define _CITRUS_DECHANYU_H_ + +__BEGIN_DECLS +_CITRUS_CTYPE_GETOPS_FUNC(DECHanyu); +_CITRUS_STDENC_GETOPS_FUNC(DECHanyu); +__END_DECLS + +#endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/modules/citrus_euc.c src/lib/libc/citrus/modules/citrus_euc.c --- src.orig/lib/libc/citrus/modules/citrus_euc.c Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/modules/citrus_euc.c Thu Jun 18 13:03:24 2009 @@ -0,0 +1,410 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_euc.c,v 1.12 2008/06/14 16:01:07 tnozaki Exp $ */ + +/*- + * Copyright (c)2002 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/*- + * Copyright (c) 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Paul Borman at Krystal Technologies. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include + +#include "citrus_namespace.h" +#include "citrus_types.h" +#include "citrus_module.h" +#include "citrus_ctype.h" +#include "citrus_stdenc.h" + +#include "citrus_euc.h" + +/* ---------------------------------------------------------------------- + * private stuffs used by templates + */ + +typedef struct { + char ch[3]; + int chlen; +} _EUCState; + +typedef struct { + unsigned count[4]; + wchar_t bits[4]; + wchar_t mask; + unsigned mb_cur_max; +} _EUCEncodingInfo; + +typedef struct { + _EUCEncodingInfo ei; + struct { + /* for future multi-locale facility */ + _EUCState s_mblen; + _EUCState s_mbrlen; + _EUCState s_mbrtowc; + _EUCState s_mbtowc; + _EUCState s_mbsrtowcs; + _EUCState s_wcrtomb; + _EUCState s_wcsrtombs; + _EUCState s_wctomb; + } states; +} _EUCCTypeInfo; + +#define _SS2 0x008e +#define _SS3 0x008f + +#define _CEI_TO_EI(_cei_) (&(_cei_)->ei) +#define _CEI_TO_STATE(_cei_, _func_) (_cei_)->states.s_##_func_ + +#define _FUNCNAME(m) _citrus_EUC_##m +#define _ENCODING_INFO _EUCEncodingInfo +#define _CTYPE_INFO _EUCCTypeInfo +#define _ENCODING_STATE _EUCState +#define _ENCODING_MB_CUR_MAX(_ei_) (_ei_)->mb_cur_max +#define _ENCODING_IS_STATE_DEPENDENT 0 +#define _STATE_NEEDS_EXPLICIT_INIT(_ps_) 0 + + +static __inline int +_citrus_EUC_cs(unsigned int c) +{ + c &= 0xff; + + return ((c & 0x80) ? c == _SS3 ? 3 : c == _SS2 ? 2 : 1 : 0); +} + +static __inline int +_citrus_EUC_parse_variable(_EUCEncodingInfo *ei, + const void *var, size_t lenvar) +{ + const char *v, *e; + int x; + + /* parse variable string */ + if (!var) + return (EFTYPE); + + v = (const char *) var; + + while (*v == ' ' || *v == '\t') + ++v; + + ei->mb_cur_max = 1; + for (x = 0; x < 4; ++x) { + ei->count[x] = (int) strtol(v, (char **)&e, 0); + if (v == e || !(v = e) || ei->count[x]<1 || ei->count[x]>4) { + return (EFTYPE); + } + if (ei->mb_cur_max < ei->count[x]) + ei->mb_cur_max = ei->count[x]; + while (*v == ' ' || *v == '\t') + ++v; + ei->bits[x] = (int) strtol(v, (char **)&e, 0); + if (v == e || !(v = e)) { + return (EFTYPE); + } + while (*v == ' ' || *v == '\t') + ++v; + } + ei->mask = (int)strtol(v, (char **)&e, 0); + if (v == e || !(v = e)) { + return (EFTYPE); + } + + return 0; +} + + +static __inline void +/*ARGSUSED*/ +_citrus_EUC_init_state(_EUCEncodingInfo *ei, _EUCState *s) +{ + memset(s, 0, sizeof(*s)); +} + +static __inline void +/*ARGSUSED*/ +_citrus_EUC_pack_state(_EUCEncodingInfo *ei, void *pspriv, const _EUCState *s) +{ + memcpy(pspriv, (const void *)s, sizeof(*s)); +} + +static __inline void +/*ARGSUSED*/ +_citrus_EUC_unpack_state(_EUCEncodingInfo *ei, _EUCState *s, + const void *pspriv) +{ + memcpy((void *)s, pspriv, sizeof(*s)); +} + +static int +_citrus_EUC_mbrtowc_priv(_EUCEncodingInfo *ei, wchar_t *pwc, const char **s, + size_t n, _EUCState *psenc, size_t *nresult) +{ + wchar_t wchar; + int c, cs, len; + int chlenbak; + const char *s0, *s1 = NULL; + + s0 = *s; + + if (s0 == NULL) { + _citrus_EUC_init_state(ei, psenc); + *nresult = 0; /* state independent */ + return (0); + } + + chlenbak = psenc->chlen; + + /* make sure we have the first byte in the buffer */ + switch (psenc->chlen) { + case 0: + if (n < 1) + goto restart; + psenc->ch[0] = *s0++; + psenc->chlen = 1; + n--; + break; + case 1: + case 2: + break; + default: + /* illgeal state */ + goto encoding_error; + } + + c = ei->count[cs = _citrus_EUC_cs(psenc->ch[0] & 0xff)]; + if (c == 0) + goto encoding_error; + while (psenc->chlen < c) { + if (n < 1) + goto restart; + psenc->ch[psenc->chlen] = *s0++; + psenc->chlen++; + n--; + } + *s = s0; + + switch (cs) { + case 3: + case 2: + /* skip SS2/SS3 */ + len = c - 1; + s1 = &psenc->ch[1]; + break; + case 1: + case 0: + len = c; + s1 = &psenc->ch[0]; + break; + default: + goto encoding_error; + } + wchar = 0; + while (len-- > 0) + wchar = (wchar << 8) | (*s1++ & 0xff); + wchar = (wchar & ~ei->mask) | ei->bits[cs]; + + psenc->chlen = 0; + if (pwc) + *pwc = wchar; + + if (!wchar) { + *nresult = 0; + } else { + *nresult = (size_t)(c - chlenbak); + } + + return 0; + +encoding_error: + psenc->chlen = 0; + *nresult = (size_t)-1; + return (EILSEQ); + +restart: + *nresult = (size_t)-2; + *s = s0; + return (0); +} + +static int +_citrus_EUC_wcrtomb_priv(_EUCEncodingInfo *ei, char *s, size_t n, wchar_t wc, + _EUCState *psenc, size_t *nresult) +{ + wchar_t m, nm; + int cs, i, ret; + + m = wc & ei->mask; + nm = wc & ~m; + + for (cs = 0; + cs < sizeof(ei->count)/sizeof(ei->count[0]); + cs++) { + if (m == ei->bits[cs]) + break; + } + /* fallback case - not sure if it is necessary */ + if (cs == sizeof(ei->count)/sizeof(ei->count[0])) + cs = 1; + + i = ei->count[cs]; + if (n < i) { + ret = E2BIG; + goto err; + } + m = (cs) ? 0x80 : 0x00; + switch (cs) { + case 2: + *s++ = _SS2; + i--; + break; + case 3: + *s++ = _SS3; + i--; + break; + } + + while (i-- > 0) + *s++ = ((nm >> (i << 3)) & 0xff) | m; + + *nresult = (size_t)ei->count[cs]; + return 0; + +err: + *nresult = (size_t)-1; + return ret; +} + +static __inline int +/*ARGSUSED*/ +_citrus_EUC_stdenc_wctocs(_EUCEncodingInfo * __restrict ei, + _csid_t * __restrict csid, + _index_t * __restrict idx, wchar_t wc) +{ + wchar_t m, nm; + + m = wc & ei->mask; + nm = wc & ~m; + + *csid = (_citrus_csid_t)m; + *idx = (_citrus_index_t)nm; + + return (0); +} + +static __inline int +/*ARGSUSED*/ +_citrus_EUC_stdenc_cstowc(_EUCEncodingInfo * __restrict ei, + wchar_t * __restrict wc, + _csid_t csid, _index_t idx) +{ + if ((csid & ~ei->mask) != 0 || (idx & ei->mask) != 0) + return (EINVAL); + + *wc = (wchar_t)csid | (wchar_t)idx; + + return (0); +} + +static __inline int +/*ARGSUSED*/ +_citrus_EUC_stdenc_get_state_desc_generic(_EUCEncodingInfo * __restrict ei, + _EUCState * __restrict psenc, + int * __restrict rstate) +{ + + if (psenc->chlen == 0) + *rstate = _STDENC_SDGEN_INITIAL; + else + *rstate = _STDENC_SDGEN_INCOMPLETE_CHAR; + + return 0; +} + +static int +/*ARGSUSED*/ +_citrus_EUC_encoding_module_init(_EUCEncodingInfo * __restrict ei, + const void * __restrict var, size_t lenvar) +{ + return (_citrus_EUC_parse_variable(ei, var, lenvar)); +} + +static void +/*ARGSUSED*/ +_citrus_EUC_encoding_module_uninit(_EUCEncodingInfo * __restrict ei) +{ +} + +/* ---------------------------------------------------------------------- + * public interface for ctype + */ + +_CITRUS_CTYPE_DECLS(EUC); +_CITRUS_CTYPE_DEF_OPS(EUC); + +#include "citrus_ctype_template.h" + +/* ---------------------------------------------------------------------- + * public interface for stdenc + */ + +_CITRUS_STDENC_DECLS(EUC); +_CITRUS_STDENC_DEF_OPS(EUC); + +#include "citrus_stdenc_template.h" diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/modules/citrus_euc.h src/lib/libc/citrus/modules/citrus_euc.h --- src.orig/lib/libc/citrus/modules/citrus_euc.h Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/modules/citrus_euc.h Thu Jun 18 13:03:24 2009 @@ -0,0 +1,38 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_euc.h,v 1.2 2003/06/25 09:51:42 tshiozak Exp $ */ + +/*- + * Copyright (c)2002 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _CITRUS_EUC_H_ +#define _CITRUS_EUC_H_ + +__BEGIN_DECLS +_CITRUS_CTYPE_GETOPS_FUNC(EUC); +_CITRUS_STDENC_GETOPS_FUNC(EUC); +__END_DECLS + +#endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/modules/citrus_euctw.c src/lib/libc/citrus/modules/citrus_euctw.c --- src.orig/lib/libc/citrus/modules/citrus_euctw.c Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/modules/citrus_euctw.c Thu Jun 18 13:03:24 2009 @@ -0,0 +1,403 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_euctw.c,v 1.11 2008/06/14 16:01:07 tnozaki Exp $ */ + +/*- + * Copyright (c)2002 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/*- + * Copyright (c)1999 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Citrus: xpg4dl/FreeBSD/lib/libc/locale/euctw.c,v 1.13 2001/06/21 01:51:44 yamt Exp $ + */ + +#include +#include +#include +#include +#include +#include + +#include "citrus_namespace.h" +#include "citrus_types.h" +#include "citrus_module.h" +#include "citrus_ctype.h" +#include "citrus_stdenc.h" + +#include "citrus_euctw.h" + +/* ---------------------------------------------------------------------- + * private stuffs used by templates + */ + +typedef struct { + char ch[4]; + int chlen; +} _EUCTWState; + +typedef struct { + int dummy; +} _EUCTWEncodingInfo; +typedef struct { + _EUCTWEncodingInfo ei; + struct { + /* for future multi-locale facility */ + _EUCTWState s_mblen; + _EUCTWState s_mbrlen; + _EUCTWState s_mbrtowc; + _EUCTWState s_mbtowc; + _EUCTWState s_mbsrtowcs; + _EUCTWState s_wcrtomb; + _EUCTWState s_wcsrtombs; + _EUCTWState s_wctomb; + } states; +} _EUCTWCTypeInfo; + +#define _SS2 0x008e +#define _SS3 0x008f + +#define _CEI_TO_EI(_cei_) (&(_cei_)->ei) +#define _CEI_TO_STATE(_cei_, _func_) (_cei_)->states.s_##_func_ + +#define _FUNCNAME(m) _citrus_EUCTW_##m +#define _ENCODING_INFO _EUCTWEncodingInfo +#define _CTYPE_INFO _EUCTWCTypeInfo +#define _ENCODING_STATE _EUCTWState +#define _ENCODING_MB_CUR_MAX(_ei_) 4 +#define _ENCODING_IS_STATE_DEPENDENT 0 +#define _STATE_NEEDS_EXPLICIT_INIT(_ps_) 0 + +static __inline int +_citrus_EUCTW_cs(u_int c) +{ + c &= 0xff; + + return ((c & 0x80) ? (c == _SS2 ? 2 : 1) : 0); +} + +static __inline int +_citrus_EUCTW_count(int cs) +{ + switch (cs) { + case 0: + return 1; + case 1: + return 2; + case 2: + return 4; + case 3: + abort(); + /*NOTREACHED*/ + } + return 0; +} + +static __inline void +/*ARGSUSED*/ +_citrus_EUCTW_init_state(_EUCTWEncodingInfo * __restrict ei, + _EUCTWState * __restrict s) +{ + memset(s, 0, sizeof(*s)); +} + +static __inline void +/*ARGSUSED*/ +_citrus_EUCTW_pack_state(_EUCTWEncodingInfo * __restrict ei, + void * __restrict pspriv, + const _EUCTWState * __restrict s) +{ + memcpy(pspriv, (const void *)s, sizeof(*s)); +} + +static __inline void +/*ARGSUSED*/ +_citrus_EUCTW_unpack_state(_EUCTWEncodingInfo * __restrict ei, + _EUCTWState * __restrict s, + const void * __restrict pspriv) +{ + memcpy((void *)s, pspriv, sizeof(*s)); +} + +static int +/*ARGSUSED*/ +_citrus_EUCTW_encoding_module_init(_EUCTWEncodingInfo * __restrict ei, + const void * __restrict var, size_t lenvar) +{ + memset((void *)ei, 0, sizeof(*ei)); + + return 0; +} + +static void +/*ARGSUSED*/ +_citrus_EUCTW_encoding_module_uninit(_EUCTWEncodingInfo *ei) +{ +} + +static int +_citrus_EUCTW_mbrtowc_priv(_EUCTWEncodingInfo * __restrict ei, + wchar_t * __restrict pwc, + const char ** __restrict s, + size_t n, _EUCTWState * __restrict psenc, + size_t * __restrict nresult) +{ + wchar_t wchar; + int c, cs; + int chlenbak; + const char *s0; + + s0 = *s; + + if (s0 == NULL) { + _citrus_EUCTW_init_state(ei, psenc); + *nresult = 0; /* state independent */ + return (0); + } + + chlenbak = psenc->chlen; + + /* make sure we have the first byte in the buffer */ + switch (psenc->chlen) { + case 0: + if (n < 1) + goto restart; + psenc->ch[0] = *s0++; + psenc->chlen = 1; + n--; + break; + case 1: + case 2: + break; + default: + /* illgeal state */ + goto ilseq; + } + + c = _citrus_EUCTW_count(cs = _citrus_EUCTW_cs(psenc->ch[0] & 0xff)); + if (c == 0) + goto ilseq; + while (psenc->chlen < c) { + if (n < 1) + goto ilseq; + psenc->ch[psenc->chlen] = *s0++; + psenc->chlen++; + n--; + } + + wchar = 0; + switch (cs) { + case 0: + if (psenc->ch[0] & 0x80) + goto ilseq; + wchar = psenc->ch[0] & 0xff; + break; + case 1: + if (!(psenc->ch[0] & 0x80) || !(psenc->ch[1] & 0x80)) + goto ilseq; + wchar = ((psenc->ch[0] & 0xff) << 8) | (psenc->ch[1] & 0xff); + wchar |= 'G' << 24; + break; + case 2: + if ((u_char)psenc->ch[1] < 0xa1 || 0xa7 < (u_char)psenc->ch[1]) + goto ilseq; + if (!(psenc->ch[2] & 0x80) || !(psenc->ch[3] & 0x80)) + goto ilseq; + wchar = ((psenc->ch[2] & 0xff) << 8) | (psenc->ch[3] & 0xff); + wchar |= ('G' + psenc->ch[1] - 0xa1) << 24; + break; + default: + goto ilseq; + } + + *s = s0; + psenc->chlen = 0; + + if (pwc) + *pwc = wchar; + + if (!wchar) + *nresult = 0; + else + *nresult = c - chlenbak; + + return (0); + +ilseq: + psenc->chlen = 0; + *nresult = (size_t)-1; + return (EILSEQ); + +restart: + *s = s0; + *nresult = (size_t)-1; + return (0); +} + +static int +_citrus_EUCTW_wcrtomb_priv(_EUCTWEncodingInfo * __restrict ei, + char * __restrict s, size_t n, wchar_t wc, + _EUCTWState * __restrict psenc, + size_t * __restrict nresult) +{ + wchar_t cs = wc & 0x7f000080; + wchar_t v; + int i, len, clen, ret; + + clen = 1; + if (wc & 0x00007f00) + clen = 2; + if ((wc & 0x007f0000) && !(wc & 0x00800000)) + clen = 3; + + if (clen == 1 && cs == 0x00000000) { + /* ASCII */ + len = 1; + if (n < len) { + ret = E2BIG; + goto err; + } + v = wc & 0x0000007f; + } else if (clen == 2 && cs == ('G' << 24)) { + /* CNS-11643-1 */ + len = 2; + if (n < len) { + ret = E2BIG; + goto err; + } + v = wc & 0x00007f7f; + v |= 0x00008080; + } else if (clen == 2 && 'H' <= (cs >> 24) && (cs >> 24) <= 'M') { + /* CNS-11643-[2-7] */ + len = 4; + if (n < len) { + ret = E2BIG; + goto err; + } + *s++ = _SS2; + *s++ = (cs >> 24) - 'H' + 0xa2; + v = wc & 0x00007f7f; + v |= 0x00008080; + } else { + ret = EILSEQ; + goto err; + } + + i = clen; + while (i-- > 0) + *s++ = (v >> (i << 3)) & 0xff; + + *nresult = len; + return 0; + +err: + *nresult = (size_t)-1; + return ret; +} + +static __inline int +/*ARGSUSED*/ +_citrus_EUCTW_stdenc_wctocs(_EUCTWEncodingInfo * __restrict ei, + _csid_t * __restrict csid, + _index_t * __restrict idx, wchar_t wc) +{ + *csid = (_csid_t)(wc >> 24) & 0xFF; + *idx = (_index_t)(wc & 0x7F7F); + + return (0); +} + +static __inline int +/*ARGSUSED*/ +_citrus_EUCTW_stdenc_cstowc(_EUCTWEncodingInfo * __restrict ei, + wchar_t * __restrict wc, + _csid_t csid, _index_t idx) +{ + if (csid==0) { + if ((idx & ~0x7F) != 0) + return (EINVAL); + *wc = (wchar_t)idx; + } else { + if (csid < 'G' || csid > 'M' || (idx & ~0x7F7F) != 0) + return (EINVAL); + *wc = (wchar_t)idx | ((wchar_t)csid<<24); + } + + return (0); +} + +static __inline int +/*ARGSUSED*/ +_citrus_EUCTW_stdenc_get_state_desc_generic(_EUCTWEncodingInfo * __restrict ei, + _EUCTWState * __restrict psenc, + int * __restrict rstate) +{ + + if (psenc->chlen == 0) + *rstate = _STDENC_SDGEN_INITIAL; + else + *rstate = _STDENC_SDGEN_INCOMPLETE_CHAR; + + return 0; +} + +/* ---------------------------------------------------------------------- + * public interface for ctype + */ + +_CITRUS_CTYPE_DECLS(EUCTW); +_CITRUS_CTYPE_DEF_OPS(EUCTW); + +#include "citrus_ctype_template.h" + +/* ---------------------------------------------------------------------- + * public interface for stdenc + */ + +_CITRUS_STDENC_DECLS(EUCTW); +_CITRUS_STDENC_DEF_OPS(EUCTW); + +#include "citrus_stdenc_template.h" diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/modules/citrus_euctw.h src/lib/libc/citrus/modules/citrus_euctw.h --- src.orig/lib/libc/citrus/modules/citrus_euctw.h Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/modules/citrus_euctw.h Thu Jun 18 13:03:24 2009 @@ -0,0 +1,38 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_euctw.h,v 1.2 2003/06/25 09:51:42 tshiozak Exp $ */ + +/*- + * Copyright (c)2002 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _CITRUS_EUCTW_H_ +#define _CITRUS_EUCTW_H_ + +__BEGIN_DECLS +_CITRUS_CTYPE_GETOPS_FUNC(EUCTW); +_CITRUS_STDENC_GETOPS_FUNC(EUCTW); +__END_DECLS + +#endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/modules/citrus_gbk2k.c src/lib/libc/citrus/modules/citrus_gbk2k.c --- src.orig/lib/libc/citrus/modules/citrus_gbk2k.c Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/modules/citrus_gbk2k.c Thu Jun 18 13:03:24 2009 @@ -0,0 +1,449 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_gbk2k.c,v 1.7 2008/06/14 16:01:07 tnozaki Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include + +#include "citrus_namespace.h" +#include "citrus_types.h" +#include "citrus_module.h" +#include "citrus_ctype.h" +#include "citrus_stdenc.h" + +#include "citrus_bcs.h" +#include "citrus_gbk2k.h" + +/* ---------------------------------------------------------------------- + * private stuffs used by templates + */ + +typedef struct _GBK2KState { + char ch[4]; + int chlen; +} _GBK2KState; + +typedef struct { + int mb_cur_max; +} _GBK2KEncodingInfo; + +typedef struct { + _GBK2KEncodingInfo ei; + struct { + /* for future multi-locale facility */ + _GBK2KState s_mblen; + _GBK2KState s_mbrlen; + _GBK2KState s_mbrtowc; + _GBK2KState s_mbtowc; + _GBK2KState s_mbsrtowcs; + _GBK2KState s_wcrtomb; + _GBK2KState s_wcsrtombs; + _GBK2KState s_wctomb; + } states; +} _GBK2KCTypeInfo; + +#define _CEI_TO_EI(_cei_) (&(_cei_)->ei) +#define _CEI_TO_STATE(_cei_, _func_) (_cei_)->states.s_##_func_ + +#define _FUNCNAME(m) _citrus_GBK2K_##m +#define _ENCODING_INFO _GBK2KEncodingInfo +#define _CTYPE_INFO _GBK2KCTypeInfo +#define _ENCODING_STATE _GBK2KState +#define _ENCODING_MB_CUR_MAX(_ei_) (_ei_)->mb_cur_max +#define _ENCODING_IS_STATE_DEPENDENT 0 +#define _STATE_NEEDS_EXPLICIT_INIT(_ps_) 0 + +static __inline void +/*ARGSUSED*/ +_citrus_GBK2K_init_state(_GBK2KEncodingInfo * __restrict ei, + _GBK2KState * __restrict s) +{ + memset(s, 0, sizeof(*s)); +} + +static __inline void +/*ARGSUSED*/ +_citrus_GBK2K_pack_state(_GBK2KEncodingInfo * __restrict ei, + void * __restrict pspriv, + const _GBK2KState * __restrict s) +{ + memcpy(pspriv, (const void *)s, sizeof(*s)); +} + +static __inline void +/*ARGSUSED*/ +_citrus_GBK2K_unpack_state(_GBK2KEncodingInfo * __restrict ei, + _GBK2KState * __restrict s, + const void * __restrict pspriv) +{ + memcpy((void *)s, pspriv, sizeof(*s)); +} + +static __inline int +_mb_singlebyte(int c) +{ + c &= 0xff; + return (c <= 0x7f); +} + +static __inline int +_mb_leadbyte(int c) +{ + c &= 0xff; + return (0x81 <= c && c <= 0xfe); +} + +static __inline int +_mb_trailbyte(int c) +{ + c &= 0xff; + return ((0x40 <= c && c <= 0x7e) || (0x80 <= c && c <= 0xfe)); +} + +static __inline int +_mb_surrogate(int c) +{ + c &= 0xff; + return (0x30 <= c && c <= 0x39); +} + +static __inline int +_mb_count(wchar_t v) +{ + uint32_t c; + + c = (uint32_t)v; /* XXX */ + if (!(c & 0xffffff00)) + return (1); + if (!(c & 0xffff0000)) + return (2); + return (4); +} + +#define _PSENC (psenc->ch[psenc->chlen - 1]) +#define _PUSH_PSENC(c) (psenc->ch[psenc->chlen++] = (c)) + +static int +_citrus_GBK2K_mbrtowc_priv(_GBK2KEncodingInfo * __restrict ei, + wchar_t * __restrict pwc, + const char ** __restrict s, size_t n, + _GBK2KState * __restrict psenc, + size_t * __restrict nresult) +{ + int chlenbak, len; + const char *s0, *s1; + wchar_t wc; + + s0 = *s; + + if (s0 == NULL) { + /* _citrus_GBK2K_init_state(ei, psenc); */ + psenc->chlen = 0; + *nresult = 0; + return (0); + } + + chlenbak = psenc->chlen; + + switch (psenc->chlen) { + case 3: + if (!_mb_leadbyte (_PSENC)) + goto invalid; + /* FALLTHROUGH */ + case 2: + if (!_mb_surrogate(_PSENC) || _mb_trailbyte(_PSENC)) + goto invalid; + /* FALLTHROUGH */ + case 1: + if (!_mb_leadbyte (_PSENC)) + goto invalid; + /* FALLTHOROUGH */ + case 0: + break; + default: + goto invalid; + } + + for (;;) { + if (n-- < 1) + goto restart; + + _PUSH_PSENC(*s0++); + + switch (psenc->chlen) { + case 1: + if (_mb_singlebyte(_PSENC)) + goto convert; + if (_mb_leadbyte (_PSENC)) + continue; + goto ilseq; + case 2: + if (_mb_trailbyte (_PSENC)) + goto convert; + if (ei->mb_cur_max == 4 && + _mb_surrogate (_PSENC)) + continue; + goto ilseq; + case 3: + if (_mb_leadbyte (_PSENC)) + continue; + goto ilseq; + case 4: + if (_mb_surrogate (_PSENC)) + goto convert; + goto ilseq; + } + } + +convert: + len = psenc->chlen; + s1 = &psenc->ch[0]; + wc = 0; + while (len-- > 0) + wc = (wc << 8) | (*s1++ & 0xff); + + if (pwc != NULL) + *pwc = wc; + *s = s0; + *nresult = (wc == 0) ? 0 : psenc->chlen - chlenbak; + /* _citrus_GBK2K_init_state(ei, psenc); */ + psenc->chlen = 0; + + return (0); + +restart: + *s = s0; + *nresult = (size_t)-2; + + return (0); + +invalid: + return (EINVAL); + +ilseq: + *nresult = (size_t)-1; + return (EILSEQ); +} + +static int +_citrus_GBK2K_wcrtomb_priv(_GBK2KEncodingInfo * __restrict ei, + char * __restrict s, size_t n, wchar_t wc, + _GBK2KState * __restrict psenc, + size_t * __restrict nresult) +{ + int len, ret; + + if (psenc->chlen != 0) { + ret = EINVAL; + goto err; + } + + len = _mb_count(wc); + if (n < len) { + ret = E2BIG; + goto err; + } + + switch (len) { + case 1: + if (!_mb_singlebyte(_PUSH_PSENC(wc ))) { + ret = EILSEQ; + goto err; + } + break; + case 2: + if (!_mb_leadbyte (_PUSH_PSENC(wc >> 8)) || + !_mb_trailbyte (_PUSH_PSENC(wc ))) { + ret = EILSEQ; + goto err; + } + break; + case 4: + if (ei->mb_cur_max != 4 || + !_mb_leadbyte (_PUSH_PSENC(wc >> 24)) || + !_mb_surrogate (_PUSH_PSENC(wc >> 16)) || + !_mb_leadbyte (_PUSH_PSENC(wc >> 8)) || + !_mb_surrogate (_PUSH_PSENC(wc ))) { + ret = EILSEQ; + goto err; + } + break; + } + + memcpy(s, psenc->ch, psenc->chlen); + *nresult = psenc->chlen; + /* _citrus_GBK2K_init_state(ei, psenc); */ + psenc->chlen = 0; + + return (0); + +err: + *nresult = (size_t)-1; + return ret; +} + +static __inline int +/*ARGSUSED*/ +_citrus_GBK2K_stdenc_wctocs(_GBK2KEncodingInfo * __restrict ei, + _csid_t * __restrict csid, + _index_t * __restrict idx, wchar_t wc) +{ + uint8_t ch, cl; + + if ((uint32_t)wc<0x80) { + /* ISO646 */ + *csid = 0; + *idx = (_index_t)wc; + } else if ((uint32_t)wc>=0x10000) { + /* GBKUCS : XXX */ + *csid = 3; + *idx = (_index_t)wc; + } else { + ch = (uint8_t)(wc >> 8); + cl = (uint8_t)wc; + if (ch>=0xA1 && cl>=0xA1) { + /* EUC G1 */ + *csid = 1; + *idx = (_index_t)wc & 0x7F7FU; + } else { + /* extended area (0x8140-) */ + *csid = 2; + *idx = (_index_t)wc; + } + } + + return 0; +} + +static __inline int +/*ARGSUSED*/ +_citrus_GBK2K_stdenc_cstowc(_GBK2KEncodingInfo * __restrict ei, + wchar_t * __restrict wc, + _csid_t csid, _index_t idx) +{ + switch (csid) { + case 0: + /* ISO646 */ + *wc = (wchar_t)idx; + break; + case 1: + /* EUC G1 */ + *wc = (wchar_t)idx | 0x8080U; + break; + case 2: + /* extended area */ + *wc = (wchar_t)idx; + break; + case 3: + /* GBKUCS : XXX */ + if (ei->mb_cur_max != 4) + return EINVAL; + *wc = (wchar_t)idx; + break; + default: + return EILSEQ; + } + + return 0; +} + +static __inline int +/*ARGSUSED*/ +_citrus_GBK2K_stdenc_get_state_desc_generic(_GBK2KEncodingInfo * __restrict ei, + _GBK2KState * __restrict psenc, + int * __restrict rstate) +{ + + if (psenc->chlen == 0) + *rstate = _STDENC_SDGEN_INITIAL; + else + *rstate = _STDENC_SDGEN_INCOMPLETE_CHAR; + + return 0; +} + +static int +/*ARGSUSED*/ +_citrus_GBK2K_encoding_module_init(_GBK2KEncodingInfo * __restrict ei, + const void * __restrict var, size_t lenvar) +{ + const char *p; + + p = var; +#define MATCH(x, act) \ +do { \ + if (lenvar >= (sizeof(#x)-1) && \ + _bcs_strncasecmp(p, #x, sizeof(#x)-1) == 0) { \ + act; \ + lenvar -= sizeof(#x)-1; \ + p += sizeof(#x)-1; \ + } \ +} while (/*CONSTCOND*/0) + memset((void *)ei, 0, sizeof(*ei)); + ei->mb_cur_max = 4; + while (lenvar>0) { + switch (_bcs_tolower(*p)) { + case '2': + MATCH("2byte", ei->mb_cur_max = 2); + break; + } + p++; + lenvar--; + } + + return (0); +} + +static void +/*ARGSUSED*/ +_citrus_GBK2K_encoding_module_uninit(_GBK2KEncodingInfo *ei) +{ +} + + +/* ---------------------------------------------------------------------- + * public interface for ctype + */ + +_CITRUS_CTYPE_DECLS(GBK2K); +_CITRUS_CTYPE_DEF_OPS(GBK2K); + +#include "citrus_ctype_template.h" + +/* ---------------------------------------------------------------------- + * public interface for stdenc + */ + +_CITRUS_STDENC_DECLS(GBK2K); +_CITRUS_STDENC_DEF_OPS(GBK2K); + +#include "citrus_stdenc_template.h" diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/modules/citrus_gbk2k.h src/lib/libc/citrus/modules/citrus_gbk2k.h --- src.orig/lib/libc/citrus/modules/citrus_gbk2k.h Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/modules/citrus_gbk2k.h Thu Jun 18 13:03:24 2009 @@ -0,0 +1,38 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_gbk2k.h,v 1.2 2003/06/25 09:51:43 tshiozak Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _CITRUS_GBK2K_H_ +#define _CITRUS_GBK2K_H_ + +__BEGIN_DECLS +_CITRUS_CTYPE_GETOPS_FUNC(GBK2K); +_CITRUS_STDENC_GETOPS_FUNC(GBK2K); +__END_DECLS + +#endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/modules/citrus_hz.c src/lib/libc/citrus/modules/citrus_hz.c --- src.orig/lib/libc/citrus/modules/citrus_hz.c Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/modules/citrus_hz.c Thu Jun 18 13:03:24 2009 @@ -0,0 +1,663 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_hz.c,v 1.2 2008/06/14 16:01:07 tnozaki Exp $ */ + +/*- + * Copyright (c)2004, 2006 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "citrus_namespace.h" +#include "citrus_types.h" +#include "citrus_module.h" +#include "citrus_ctype.h" +#include "citrus_stdenc.h" + +#include "citrus_bcs.h" +#include "citrus_prop.h" +#include "citrus_hz.h" + +/* + * wchar_t mapping: + * + * CTRL/ASCII 00000000 00000000 00000000 gxxxxxxx + * GB2312 00000000 00000000 0xxxxxxx gxxxxxxx + * 94/96*n (~M) 0mmmmmmm 0xxxxxxx 0xxxxxxx gxxxxxxx + */ + +#define ESCAPE_CHAR '~' + +typedef enum { + CTRL = 0, ASCII = 1, GB2312 = 2, CS94 = 3, CS96 = 4 +} charset_t; + +typedef struct { + int start, end, width; +} range_t; + +static const range_t ranges[] = { +#define RANGE(start, end) { start, end, (end - start) + 1 } +/* CTRL */ RANGE(0x00, 0x1F), +/* ASCII */ RANGE(0x20, 0x7F), +/* GB2312 */ RANGE(0x21, 0x7E), +/* CS94 */ RANGE(0x21, 0x7E), +/* CS96 */ RANGE(0x20, 0x7F), +#undef RANGE +}; + +typedef struct escape_t escape_t; +typedef struct { + charset_t charset; + size_t length; +#define ROWCOL_MAX 3 + escape_t *escape; +} graphic_t; + +typedef TAILQ_HEAD(escape_list, escape_t) escape_list; +struct escape_t { + TAILQ_ENTRY(escape_t) entry; + int ch; + graphic_t *left, *right; + escape_list *set; +}; + +#define GL(escape) ((escape)->left) +#define GR(escape) ((escape)->right) +#define SET(escape) ((escape)->set) +#define ESC(escape) ((escape)->ch) +#define INIT(escape) (TAILQ_FIRST(SET(escape))) + +static __inline escape_t * +find_escape(escape_list *set, int ch) +{ + escape_t *escape; + + TAILQ_FOREACH(escape, set, entry) { + if (ESC(escape) == ch) + break; + } + + return escape; +} + +typedef struct { + escape_list e0, e1; + graphic_t *ascii, *gb2312; +} _HZEncodingInfo; + +#define E0SET(ei) (&(ei)->e0) +#define E1SET(ei) (&(ei)->e1) +#define INIT0(ei) (TAILQ_FIRST(E0SET(ei))) +#define INIT1(ei) (TAILQ_FIRST(E1SET(ei))) + +typedef struct { + int chlen; + char ch[ROWCOL_MAX]; + escape_t *inuse; +} _HZState; + +typedef struct { + _HZEncodingInfo ei; + struct { + /* for future multi-locale facility */ + _HZState s_mblen; + _HZState s_mbrlen; + _HZState s_mbrtowc; + _HZState s_mbtowc; + _HZState s_mbsrtowcs; + _HZState s_wcrtomb; + _HZState s_wcsrtombs; + _HZState s_wctomb; + } states; +} _HZCTypeInfo; + +#define _CEI_TO_EI(_cei_) (&(_cei_)->ei) +#define _CEI_TO_STATE(_cei_, _func_) (_cei_)->states.s_##_func_ + +#define _FUNCNAME(m) _citrus_HZ_##m +#define _ENCODING_INFO _HZEncodingInfo +#define _CTYPE_INFO _HZCTypeInfo +#define _ENCODING_STATE _HZState +#define _ENCODING_MB_CUR_MAX(_ei_) MB_LEN_MAX +#define _ENCODING_IS_STATE_DEPENDENT 1 +#define _STATE_NEEDS_EXPLICIT_INIT(_ps_) ((_ps_)->inuse == NULL) + +static __inline void +_citrus_HZ_init_state(_HZEncodingInfo * __restrict ei, + _HZState * __restrict psenc) +{ + psenc->chlen = 0; + psenc->inuse = INIT0(ei); +} + +static __inline void +/*ARGSUSED*/ +_citrus_HZ_pack_state(_HZEncodingInfo * __restrict ei, + void *__restrict pspriv, const _HZState * __restrict psenc) +{ + memcpy(pspriv, (const void *)psenc, sizeof(*psenc)); +} + +static __inline void +/*ARGSUSED*/ +_citrus_HZ_unpack_state(_HZEncodingInfo * __restrict ei, + _HZState * __restrict psenc, const void * __restrict pspriv) +{ + memcpy((void *)psenc, pspriv, sizeof(*psenc)); +} + +static int +_citrus_HZ_mbrtowc_priv(_HZEncodingInfo * __restrict ei, + wchar_t * __restrict pwc, const char ** __restrict s, size_t n, + _HZState * __restrict psenc, size_t * __restrict nresult) +{ + const char *s0; + wchar_t wc; + int bit, head, tail, len, ch; + graphic_t *graphic; + escape_t *candidate, *init; + const range_t *range; + + if (*s == NULL) { + _citrus_HZ_init_state(ei, psenc); + *nresult = 1; + return 0; + } + s0 = *s; + if (psenc->chlen < 0 || psenc->inuse == NULL) + return EINVAL; + + wc = (wchar_t)0; + bit = head = tail = 0; + graphic = NULL; + for (len = 0; len <= MB_LEN_MAX; /**/) { + if (psenc->chlen == tail) { + if (n-- < 1) { + *s = s0; + *nresult = (size_t)-2; + return 0; + } + psenc->ch[psenc->chlen++] = *s0++; + ++len; + } + ch = (unsigned char)psenc->ch[tail++]; + if (tail == 1) { + if ((ch & ~0x80) <= 0x1F) { + if (psenc->inuse != INIT0(ei)) + break; + wc = (wchar_t)ch; + goto done; + } + if (ch & 0x80) { + graphic = GR(psenc->inuse); + bit = 0x80; + ch &= ~0x80; + } else { + graphic = GL(psenc->inuse); + if (ch == ESCAPE_CHAR) + continue; + bit = 0x0; + } + if (graphic == NULL) + break; + } else if (tail == 2 && psenc->ch[0] == ESCAPE_CHAR) { + if (tail < psenc->chlen) + return EINVAL; + if (ch == ESCAPE_CHAR) { + ++head; + } else if (ch == '\n') { + if (psenc->inuse != INIT0(ei)) + break; + tail = psenc->chlen = 0; + continue; + } else { + candidate = NULL; + init = INIT0(ei); + if (psenc->inuse == init) { + init = INIT1(ei); + } else if (INIT(psenc->inuse) == init) { + if (ESC(init) != ch) + break; + candidate = init; + } + if (candidate == NULL) { + candidate = find_escape( + SET(psenc->inuse), ch); + if (candidate == NULL) { + if (init == NULL || + ESC(init) != ch) + break; + candidate = init; + } + } + psenc->inuse = candidate; + tail = psenc->chlen = 0; + continue; + } + } else if (ch & 0x80) { + if (graphic != GR(psenc->inuse)) + break; + ch &= ~0x80; + } else { + if (graphic != GL(psenc->inuse)) + break; + } + range = &ranges[(size_t)graphic->charset]; + if (range->start > ch || range->end < ch) + break; + wc <<= 8; + wc |= ch; + if (graphic->length == (tail - head)) { + if (graphic->charset > GB2312) + bit |= ESC(psenc->inuse) << 24; + wc |= bit; + goto done; + } + } + *nresult = (size_t)-1; + return EILSEQ; +done: + if (tail < psenc->chlen) + return EINVAL; + *s = s0; + if (pwc != NULL) + *pwc = wc; + psenc->chlen = 0; + *nresult = (wc == 0) ? 0 : len; + + return 0; +} + +static int +_citrus_HZ_wcrtomb_priv(_HZEncodingInfo * __restrict ei, + char * __restrict s, size_t n, wchar_t wc, + _HZState * __restrict psenc, size_t * __restrict nresult) +{ + int bit, ch; + escape_t *candidate, *init; + graphic_t *graphic; + size_t len; + const range_t *range; + + if (psenc->chlen != 0 || psenc->inuse == NULL) + return EINVAL; + if (wc & 0x80) { + bit = 0x80; + wc &= ~0x80; + } else { + bit = 0x0; + } + if ((uint32_t)wc <= 0x1F) { + candidate = INIT0(ei); + graphic = (bit == 0) + ? candidate->left : candidate->right; + if (graphic == NULL) + goto ilseq; + range = &ranges[(size_t)CTRL]; + len = 1; + } else if ((uint32_t)wc <= 0x7F) { + graphic = ei->ascii; + if (graphic == NULL) + goto ilseq; + candidate = graphic->escape; + range = &ranges[(size_t)graphic->charset]; + len = graphic->length; + } else if ((uint32_t)wc <= 0x7F7F) { + graphic = ei->gb2312; + if (graphic == NULL) + goto ilseq; + candidate = graphic->escape; + range = &ranges[(size_t)graphic->charset]; + len = graphic->length; + } else { + ch = (wc >> 24) & 0xFF; + candidate = find_escape(E0SET(ei), ch); + if (candidate == NULL) { + candidate = find_escape(E1SET(ei), ch); + if (candidate == NULL) + goto ilseq; + } + wc &= ~0xFF000000; + graphic = (bit == 0) + ? candidate->left : candidate->right; + if (graphic == NULL) + goto ilseq; + range = &ranges[(size_t)graphic->charset]; + len = graphic->length; + } + if (psenc->inuse != candidate) { + init = INIT0(ei); + if (SET(psenc->inuse) == SET(candidate)) { + if (INIT(psenc->inuse) != init || + psenc->inuse == init || candidate == init) + init = NULL; + } else if (candidate == (init = INIT(candidate))) { + init = NULL; + } + if (init != NULL) { + if (n < 2) + return E2BIG; + n -= 2; + psenc->ch[psenc->chlen++] = ESCAPE_CHAR; + psenc->ch[psenc->chlen++] = ESC(init); + } + if (n < 2) + return E2BIG; + n -= 2; + psenc->ch[psenc->chlen++] = ESCAPE_CHAR; + psenc->ch[psenc->chlen++] = ESC(candidate); + psenc->inuse = candidate; + } + if (n < len) + return E2BIG; + while (len-- > 0) { + ch = (wc >> (len * 8)) & 0xFF; + if (range->start > ch || range->end < ch) + goto ilseq; + psenc->ch[psenc->chlen++] = ch | bit; + } + memcpy(s, psenc->ch, psenc->chlen); + *nresult = psenc->chlen; + psenc->chlen = 0; + + return 0; + +ilseq: + *nresult = (size_t)-1; + return EILSEQ; +} + +static __inline int +_citrus_HZ_put_state_reset(_HZEncodingInfo * __restrict ei, + char * __restrict s, size_t n, _HZState * __restrict psenc, + size_t * __restrict nresult) +{ + escape_t *candidate; + + if (psenc->chlen != 0 || psenc->inuse == NULL) + return EINVAL; + candidate = INIT0(ei); + if (psenc->inuse != candidate) { + if (n < 2) + return E2BIG; + n -= 2; + psenc->ch[psenc->chlen++] = ESCAPE_CHAR; + psenc->ch[psenc->chlen++] = ESC(candidate); + } + if (n < 1) + return E2BIG; + if (psenc->chlen > 0) + memcpy(s, psenc->ch, psenc->chlen); + *nresult = psenc->chlen; + _citrus_HZ_init_state(ei, psenc); + + return 0; +} + +static __inline int +_citrus_HZ_stdenc_get_state_desc_generic(_HZEncodingInfo * __restrict ei, + _HZState * __restrict psenc, int * __restrict rstate) +{ + if (psenc->chlen < 0 || psenc->inuse == NULL) + return EINVAL; + *rstate = (psenc->chlen == 0) + ? ((psenc->inuse == INIT0(ei)) + ? _STDENC_SDGEN_INITIAL + : _STDENC_SDGEN_STABLE) + : ((psenc->ch[0] == ESCAPE_CHAR) + ? _STDENC_SDGEN_INCOMPLETE_SHIFT + : _STDENC_SDGEN_INCOMPLETE_CHAR); + + return 0; +} + +static __inline int +/*ARGSUSED*/ +_citrus_HZ_stdenc_wctocs(_HZEncodingInfo * __restrict ei, + _csid_t * __restrict csid, _index_t * __restrict idx, wchar_t wc) +{ + int bit; + + if (wc & 0x80) { + bit = 0x80; + wc &= ~0x80; + } else { + bit = 0x0; + } + if ((uint32_t)wc <= 0x7F) { + *csid = (_csid_t)bit; + *idx = (_index_t)wc; + } else if ((uint32_t)wc <= 0x7F7F) { + *csid = (_csid_t)(bit | 0x8000); + *idx = (_index_t)wc; + } else { + *csid = (_index_t)(wc & ~0x00FFFF7F); + *idx = (_csid_t)(wc & 0x00FFFF7F); + } + + return 0; +} + +static __inline int +/*ARGSUSED*/ +_citrus_HZ_stdenc_cstowc(_HZEncodingInfo * __restrict ei, + wchar_t * __restrict wc, _csid_t csid, _index_t idx) +{ + *wc = (wchar_t)idx; + switch (csid) { + case 0x80: + case 0x8080: + *wc |= (wchar_t)0x80; + /*FALLTHROUGH*/ + case 0x0: + case 0x8000: + break; + default: + *wc |= (wchar_t)csid; + } + + return 0; +} + +static void +_citrus_HZ_encoding_module_uninit(_HZEncodingInfo *ei) +{ + escape_t *escape; + + while ((escape = TAILQ_FIRST(E0SET(ei))) != NULL) { + TAILQ_REMOVE(E0SET(ei), escape, entry); + free(GL(escape)); + free(GR(escape)); + free(escape); + } + while ((escape = TAILQ_FIRST(E1SET(ei))) != NULL) { + TAILQ_REMOVE(E1SET(ei), escape, entry); + free(GL(escape)); + free(GR(escape)); + free(escape); + } +} + +static int +_citrus_HZ_parse_char(void **context, const char *name, const char *s) +{ + void **p; + escape_t *escape; + + p = (void **)*context; + escape = (escape_t *)p[0]; + if (escape->ch != '\0') + return EINVAL; + escape->ch = *s++; + if (escape->ch == ESCAPE_CHAR || *s != '\0') + return EINVAL; + + return 0; +} + +static int +_citrus_HZ_parse_graphic(void **context, const char *name, const char *s) +{ + void **p; + _HZEncodingInfo *ei; + escape_t *escape; + graphic_t *graphic; + + p = (void **)*context; + escape = (escape_t *)p[0]; + ei = (_HZEncodingInfo *)p[1]; + graphic = malloc(sizeof(*graphic)); + if (graphic == NULL) + return ENOMEM; + memset(graphic, 0, sizeof(*graphic)); + if (strcmp("GL", name) == 0) { + if (GL(escape) != NULL) + goto release; + GL(escape) = graphic; + } else if (strcmp("GR", name) == 0) { + if (GR(escape) != NULL) + goto release; + GR(escape) = graphic; + } else { +release: + free(graphic); + return EINVAL; + } + graphic->escape = escape; + if (_bcs_strncasecmp("ASCII", s, 5) == 0) { + if (s[5] != '\0') + return EINVAL; + graphic->charset = ASCII; + graphic->length = 1; + ei->ascii = graphic; + return 0; + } else if (_bcs_strncasecmp("GB2312", s, 6) == 0) { + if (s[6] != '\0') + return EINVAL; + graphic->charset = GB2312; + graphic->length = 2; + ei->gb2312 = graphic; + return 0; + } else if (strncmp("94*", s, 3) == 0) { + graphic->charset = CS94; + } else if (strncmp("96*", s, 3) == 0) { + graphic->charset = CS96; + } else { + return EINVAL; + } + s += 3; + switch(*s) { + case '1': case '2': case '3': + graphic->length = (size_t)(*s - '0'); + if (*++s == '\0') + break; + /*FALLTHROUGH*/ + default: + return EINVAL; + } + return 0; +} + +static const _citrus_prop_hint_t escape_hints[] = { +_CITRUS_PROP_HINT_STR("CH", &_citrus_HZ_parse_char), +_CITRUS_PROP_HINT_STR("GL", &_citrus_HZ_parse_graphic), +_CITRUS_PROP_HINT_STR("GR", &_citrus_HZ_parse_graphic), +_CITRUS_PROP_HINT_END +}; + +static int +_citrus_HZ_parse_escape(void **context, const char *name, const char *s) +{ + _HZEncodingInfo *ei; + escape_t *escape; + void *p[2]; + + ei = (_HZEncodingInfo *)*context; + escape = malloc(sizeof(*escape)); + if (escape == NULL) + return EINVAL; + memset(escape, 0, sizeof(*escape)); + if (strcmp("0", name) == 0) { + escape->set = E0SET(ei); + TAILQ_INSERT_TAIL(E0SET(ei), escape, entry); + } else if (strcmp("1", name) == 0) { + escape->set = E1SET(ei); + TAILQ_INSERT_TAIL(E1SET(ei), escape, entry); + } else { + free(escape); + return EINVAL; + } + p[0] = (void *)escape; + p[1] = (void *)ei; + return _citrus_prop_parse_variable( + escape_hints, (void *)&p[0], s, strlen(s)); +} + +static const _citrus_prop_hint_t root_hints[] = { +_CITRUS_PROP_HINT_STR("0", &_citrus_HZ_parse_escape), +_CITRUS_PROP_HINT_STR("1", &_citrus_HZ_parse_escape), +_CITRUS_PROP_HINT_END +}; + +static int +_citrus_HZ_encoding_module_init(_HZEncodingInfo * __restrict ei, + const void * __restrict var, size_t lenvar) +{ + int errnum; + + memset(ei, 0, sizeof(*ei)); + TAILQ_INIT(E0SET(ei)); + TAILQ_INIT(E1SET(ei)); + errnum = _citrus_prop_parse_variable( + root_hints, (void *)ei, var, lenvar); + if (errnum != 0) + _citrus_HZ_encoding_module_uninit(ei); + return errnum; +} + +/* ---------------------------------------------------------------------- + * public interface for ctype + */ + +_CITRUS_CTYPE_DECLS(HZ); +_CITRUS_CTYPE_DEF_OPS(HZ); + +#include "citrus_ctype_template.h" + +/* ---------------------------------------------------------------------- + * public interface for stdenc + */ + +_CITRUS_STDENC_DECLS(HZ); +_CITRUS_STDENC_DEF_OPS(HZ); + +#include "citrus_stdenc_template.h" diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/modules/citrus_hz.h src/lib/libc/citrus/modules/citrus_hz.h --- src.orig/lib/libc/citrus/modules/citrus_hz.h Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/modules/citrus_hz.h Thu Jun 18 13:03:24 2009 @@ -0,0 +1,38 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_hz.h,v 1.1 2006/11/22 23:38:27 tnozaki Exp $ */ + +/*- + * Copyright (c)2004, 2006 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _CITRUS_HZ_H_ +#define _CITRUS_HZ_H_ + +__BEGIN_DECLS +_CITRUS_CTYPE_GETOPS_FUNC(HZ); +_CITRUS_STDENC_GETOPS_FUNC(HZ); +__END_DECLS + +#endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/modules/citrus_iconv_none.c src/lib/libc/citrus/modules/citrus_iconv_none.c --- src.orig/lib/libc/citrus/modules/citrus_iconv_none.c Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/modules/citrus_iconv_none.c Thu Jun 18 13:03:24 2009 @@ -0,0 +1,123 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_iconv_none.c,v 1.2 2003/07/01 09:42:16 tshiozak Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include + +#include "citrus_types.h" +#include "citrus_module.h" +#include "citrus_hash.h" +#include "citrus_iconv.h" +#include "citrus_iconv_none.h" + +/* ---------------------------------------------------------------------- */ + +_CITRUS_ICONV_DECLS(iconv_none); +_CITRUS_ICONV_DEF_OPS(iconv_none); + + +/* ---------------------------------------------------------------------- */ + +int +_citrus_iconv_none_iconv_getops(struct _citrus_iconv_ops *ops, size_t lenops, + uint32_t expected_version) +{ + if (expected_version<_CITRUS_ICONV_ABI_VERSION || lenopsci_closure = NULL; + return 0; +} + +static void +/*ARGSUSED*/ +_citrus_iconv_none_iconv_uninit_shared(struct _citrus_iconv_shared *ci) +{ +} + +static int +/*ARGSUSED*/ +_citrus_iconv_none_iconv_init_context(struct _citrus_iconv *cv) +{ + cv->cv_closure = NULL; +} + +static void +/*ARGSUSED*/ +_citrus_iconv_none_iconv_uninit_context(struct _citrus_iconv *cv) +{ +} + +static int +/*ARGSUSED*/ +_citrus_iconv_none_iconv_convert(struct _citrus_iconv * __restrict ci, + const char * __restrict * __restrict in, + size_t * __restrict inbytes, + char * __restrict * __restrict out, + size_t * __restrict outbytes, + uint32_t flags, size_t * __restrict invalids) +{ + int e2big; + size_t len; + + len = *inbytes; + e2big = 0; + if (*outbytes +#include +#include +#include +#include +#include +#include +#include + +#include "citrus_namespace.h" +#include "citrus_types.h" +#include "citrus_module.h" +#include "citrus_region.h" +#include "citrus_mmap.h" +#include "citrus_hash.h" +#include "citrus_iconv.h" +#include "citrus_stdenc.h" +#include "citrus_mapper.h" +#include "citrus_csmapper.h" +#include "citrus_memstream.h" +#include "citrus_iconv_std.h" +#include "citrus_esdb.h" + +/* ---------------------------------------------------------------------- */ + +_CITRUS_ICONV_DECLS(iconv_std); +_CITRUS_ICONV_DEF_OPS(iconv_std); + + +/* ---------------------------------------------------------------------- */ + +int +_citrus_iconv_std_iconv_getops(struct _citrus_iconv_ops *ops, size_t lenops, + uint32_t expected_version) +{ + if (expected_version<_CITRUS_ICONV_ABI_VERSION || lenopsse_ps) + memcpy(se->se_pssaved, se->se_ps, + _stdenc_get_state_size(se->se_handle)); +} + +static __inline void +restore_encoding_state(struct _citrus_iconv_std_encoding *se) +{ + if (se->se_ps) + memcpy(se->se_ps, se->se_pssaved, + _stdenc_get_state_size(se->se_handle)); +} + +static __inline void +init_encoding_state(struct _citrus_iconv_std_encoding *se) +{ + if (se->se_ps) + _stdenc_init_state(se->se_handle, se->se_ps); +} + +static __inline int +mbtocsx(struct _citrus_iconv_std_encoding *se, + _csid_t *csid, _index_t *idx, const char **s, size_t n, + size_t *nresult) +{ + return _stdenc_mbtocs(se->se_handle, csid, idx, s, n, se->se_ps, + nresult); +} + +static __inline int +cstombx(struct _citrus_iconv_std_encoding *se, + char *s, size_t n, _csid_t csid, _index_t idx, size_t *nresult) +{ + return _stdenc_cstomb(se->se_handle, s, n, csid, idx, se->se_ps, + nresult); +} + +static __inline int +wctombx(struct _citrus_iconv_std_encoding *se, + char *s, size_t n, _wc_t wc, size_t *nresult) +{ + return _stdenc_wctomb(se->se_handle, s, n, wc, se->se_ps, nresult); +} + +static __inline int +put_state_resetx(struct _citrus_iconv_std_encoding *se, + char *s, size_t n, size_t *nresult) +{ + return _stdenc_put_state_reset(se->se_handle, s, n, se->se_ps, nresult); +} + +static __inline int +get_state_desc_gen(struct _citrus_iconv_std_encoding *se, int *rstate) +{ + int ret; + struct _stdenc_state_desc ssd; + + ret = _stdenc_get_state_desc(se->se_handle, se->se_ps, + _STDENC_SDID_GENERIC, &ssd); + if (!ret) + *rstate = ssd.u.generic.state; + + return ret; +} + +/* + * init encoding context + */ +static int +init_encoding(struct _citrus_iconv_std_encoding *se, struct _stdenc *cs, + void *ps1, void *ps2) +{ + int ret = -1; + + se->se_handle = cs; + se->se_ps = ps1; + se->se_pssaved = ps2; + + if (se->se_ps) + ret = _stdenc_init_state(cs, se->se_ps); + if (!ret && se->se_pssaved) + ret = _stdenc_init_state(cs, se->se_pssaved); + + return ret; +} + +static int +open_csmapper(struct _csmapper **rcm, const char *src, const char *dst, + unsigned long *rnorm) +{ + int ret; + struct _csmapper *cm; + + ret = _csmapper_open(&cm, src, dst, 0, rnorm); + if (ret) + return ret; + if (_csmapper_get_src_max(cm) != 1 || _csmapper_get_dst_max(cm) != 1 || + _csmapper_get_state_size(cm) != 0) { + _csmapper_close(cm); + return EINVAL; + } + + *rcm = cm; + + return 0; +} + +static void +close_dsts(struct _citrus_iconv_std_dst_list *dl) +{ + struct _citrus_iconv_std_dst *sd; + + while ((sd=TAILQ_FIRST(dl)) != NULL) { + TAILQ_REMOVE(dl, sd, sd_entry); + _csmapper_close(sd->sd_mapper); + free(sd); + } +} + +static int +open_dsts(struct _citrus_iconv_std_dst_list *dl, + const struct _esdb_charset *ec, const struct _esdb *dbdst) +{ + int i, ret; + struct _citrus_iconv_std_dst *sd, *sdtmp; + unsigned long norm; + + sd = malloc(sizeof(*sd)); + if (sd == NULL) + return errno; + + for (i=0; idb_num_charsets; i++) { + ret = open_csmapper(&sd->sd_mapper, ec->ec_csname, + dbdst->db_charsets[i].ec_csname, &norm); + if (ret == 0) { + sd->sd_csid = dbdst->db_charsets[i].ec_csid; + sd->sd_norm = norm; + /* insert this mapper by sorted order. */ + TAILQ_FOREACH(sdtmp, dl, sd_entry) { + if (sdtmp->sd_norm > norm) { + TAILQ_INSERT_BEFORE(sdtmp, sd, + sd_entry); + sd = NULL; + break; + } + } + if (sd) + TAILQ_INSERT_TAIL(dl, sd, sd_entry); + sd = malloc(sizeof(*sd)); + if (sd == NULL) { + ret = errno; + close_dsts(dl); + return ret; + } + } else if (ret != ENOENT) { + close_dsts(dl); + free(sd); + return ret; + } + } + free(sd); + return 0; +} + +static void +close_srcs(struct _citrus_iconv_std_src_list *sl) +{ + struct _citrus_iconv_std_src *ss; + + while ((ss=TAILQ_FIRST(sl)) != NULL) { + TAILQ_REMOVE(sl, ss, ss_entry); + close_dsts(&ss->ss_dsts); + free(ss); + } +} + +static int +open_srcs(struct _citrus_iconv_std_src_list *sl, + const struct _esdb *dbsrc, const struct _esdb *dbdst) +{ + int i, ret, count = 0; + struct _citrus_iconv_std_src *ss; + + ss = malloc(sizeof(*ss)); + if (ss == NULL) + return errno; + + TAILQ_INIT(&ss->ss_dsts); + + for (i=0; idb_num_charsets; i++) { + ret = open_dsts(&ss->ss_dsts, &dbsrc->db_charsets[i], dbdst); + if (ret) + goto err; + if (!TAILQ_EMPTY(&ss->ss_dsts)) { + ss->ss_csid = dbsrc->db_charsets[i].ec_csid; + TAILQ_INSERT_TAIL(sl, ss, ss_entry); + ss = malloc(sizeof(*ss)); + if (ss == NULL) { + ret = errno; + goto err; + } + count++; + TAILQ_INIT(&ss->ss_dsts); + } + } + free(ss); + + return count ? 0 : ENOENT; + +err: + free(ss); + close_srcs(sl); + return ret; +} + +/* do convert a character */ +#define E_NO_CORRESPONDING_CHAR ENOENT /* XXX */ +static int +/*ARGSUSED*/ +do_conv(const struct _citrus_iconv_std_shared *is, + struct _citrus_iconv_std_context *sc, _csid_t *csid, _index_t *idx) +{ + _index_t tmpidx; + int ret; + struct _citrus_iconv_std_src *ss; + struct _citrus_iconv_std_dst *sd; + + TAILQ_FOREACH(ss, &is->is_srcs, ss_entry) { + if (ss->ss_csid == *csid) { + TAILQ_FOREACH(sd, &ss->ss_dsts, sd_entry) { + ret = _csmapper_convert(sd->sd_mapper, + &tmpidx, *idx, NULL); + switch (ret) { + case _MAPPER_CONVERT_SUCCESS: + *csid = sd->sd_csid; + *idx = tmpidx; + return 0; + case _MAPPER_CONVERT_NONIDENTICAL: + break; + case _MAPPER_CONVERT_SRC_MORE: + /*FALLTHROUGH*/ + case _MAPPER_CONVERT_DST_MORE: + /*FALLTHROUGH*/ + case _MAPPER_CONVERT_FATAL: + return EINVAL; + case _MAPPER_CONVERT_ILSEQ: + return EILSEQ; + } + } + break; + } + } + + return E_NO_CORRESPONDING_CHAR; +} +/* ---------------------------------------------------------------------- */ + +static int +/*ARGSUSED*/ +_citrus_iconv_std_iconv_init_shared(struct _citrus_iconv_shared *ci, + const char * __restrict curdir, + const char * __restrict src, + const char * __restrict dst, + const void * __restrict var, size_t lenvar) +{ + int ret; + struct _citrus_iconv_std_shared *is; + struct _citrus_esdb esdbsrc, esdbdst; + + is = malloc(sizeof(*is)); + if (is==NULL) { + ret = errno; + goto err0; + } + ret = _citrus_esdb_open(&esdbsrc, src); + if (ret) + goto err1; + ret = _citrus_esdb_open(&esdbdst, dst); + if (ret) + goto err2; + ret = _stdenc_open(&is->is_src_encoding, esdbsrc.db_encname, + esdbsrc.db_variable, esdbsrc.db_len_variable); + if (ret) + goto err3; + ret = _stdenc_open(&is->is_dst_encoding, esdbdst.db_encname, + esdbdst.db_variable, esdbdst.db_len_variable); + if (ret) + goto err4; + is->is_use_invalid = esdbdst.db_use_invalid; + is->is_invalid = esdbdst.db_invalid; + + TAILQ_INIT(&is->is_srcs); + ret = open_srcs(&is->is_srcs, &esdbsrc, &esdbdst); + if (ret) + goto err5; + + _esdb_close(&esdbsrc); + _esdb_close(&esdbdst); + ci->ci_closure = is; + + return 0; + +err5: + _stdenc_close(is->is_dst_encoding); +err4: + _stdenc_close(is->is_src_encoding); +err3: + _esdb_close(&esdbdst); +err2: + _esdb_close(&esdbsrc); +err1: + free(is); +err0: + return ret; +} + +static void +_citrus_iconv_std_iconv_uninit_shared(struct _citrus_iconv_shared *ci) +{ + struct _citrus_iconv_std_shared *is = ci->ci_closure; + + if (is == NULL) + return; + + _stdenc_close(is->is_src_encoding); + _stdenc_close(is->is_dst_encoding); + close_srcs(&is->is_srcs); + free(is); +} + +static int +_citrus_iconv_std_iconv_init_context(struct _citrus_iconv *cv) +{ + const struct _citrus_iconv_std_shared *is = cv->cv_shared->ci_closure; + struct _citrus_iconv_std_context *sc; + int ret; + size_t szpssrc, szpsdst, sz; + char *ptr; + + szpssrc = _stdenc_get_state_size(is->is_src_encoding); + szpsdst = _stdenc_get_state_size(is->is_dst_encoding); + + sz = (szpssrc + szpsdst)*2 + sizeof(struct _citrus_iconv_std_context); + sc = malloc(sz); + if (sc == NULL) + return errno; + + ptr = (char *)&sc[1]; + if (szpssrc) + init_encoding(&sc->sc_src_encoding, is->is_src_encoding, + ptr, ptr+szpssrc); + else + init_encoding(&sc->sc_src_encoding, is->is_src_encoding, + NULL, NULL); + ptr += szpssrc*2; + if (szpsdst) + init_encoding(&sc->sc_dst_encoding, is->is_dst_encoding, + ptr, ptr+szpsdst); + else + init_encoding(&sc->sc_dst_encoding, is->is_dst_encoding, + NULL, NULL); + + cv->cv_closure = (void *)sc; + + return 0; +} + +static void +_citrus_iconv_std_iconv_uninit_context(struct _citrus_iconv *cv) +{ + free(cv->cv_closure); +} + +static int +_citrus_iconv_std_iconv_convert(struct _citrus_iconv * __restrict cv, + const char * __restrict * __restrict in, + size_t * __restrict inbytes, + char * __restrict * __restrict out, + size_t * __restrict outbytes, uint32_t flags, + size_t * __restrict invalids) +{ + const struct _citrus_iconv_std_shared *is = cv->cv_shared->ci_closure; + struct _citrus_iconv_std_context *sc = cv->cv_closure; + _index_t idx; + _csid_t csid; + int ret, state; + size_t szrin, szrout; + size_t inval; + const char *tmpin; + + inval = 0; + if (in==NULL || *in==NULL) { + /* special cases */ + if (out!=NULL && *out!=NULL) { + /* init output state and store the shift sequence */ + save_encoding_state(&sc->sc_src_encoding); + save_encoding_state(&sc->sc_dst_encoding); + szrout = 0; + + ret = put_state_resetx(&sc->sc_dst_encoding, + *out, *outbytes, + &szrout); + if (ret) + goto err; + + if (szrout == (size_t)-2) { + /* too small to store the character */ + ret = EINVAL; + goto err; + } + *out += szrout; + *outbytes -= szrout; + } else + /* otherwise, discard the shift sequence */ + init_encoding_state(&sc->sc_dst_encoding); + init_encoding_state(&sc->sc_src_encoding); + *invalids = 0; + return 0; + } + + /* normal case */ + for (;;) { + if (*inbytes==0) { + ret = get_state_desc_gen(&sc->sc_src_encoding, &state); + if (state == _STDENC_SDGEN_INITIAL || + state == _STDENC_SDGEN_STABLE) + break; + } + + /* save the encoding states for the error recovery */ + save_encoding_state(&sc->sc_src_encoding); + save_encoding_state(&sc->sc_dst_encoding); + + /* mb -> csid/index */ + tmpin = *in; + szrin = szrout = 0; + ret = mbtocsx(&sc->sc_src_encoding, &csid, &idx, + &tmpin, *inbytes, &szrin); + if (ret) + goto err; + + if (szrin == (size_t)-2) { + /* incompleted character */ + ret = get_state_desc_gen(&sc->sc_src_encoding, &state); + if (ret) { + ret = EINVAL; + goto err; + } + switch (state) { + case _STDENC_SDGEN_INITIAL: + case _STDENC_SDGEN_STABLE: + /* fetch shift sequences only. */ + goto next; + } + ret = EINVAL; + goto err; + } + /* convert the character */ + ret = do_conv(is, sc, &csid, &idx); + if (ret) { + if (ret == E_NO_CORRESPONDING_CHAR) { + inval++; + szrout = 0; + if ((flags&_CITRUS_ICONV_F_HIDE_INVALID)==0 && + is->is_use_invalid) { + ret = wctombx(&sc->sc_dst_encoding, + *out, *outbytes, + is->is_invalid, + &szrout); + if (ret) + goto err; + } + goto next; + } else { + goto err; + } + } + /* csid/index -> mb */ + ret = cstombx(&sc->sc_dst_encoding, + *out, *outbytes, csid, idx, &szrout); + if (ret) + goto err; +next: + *inbytes -= tmpin-*in; /* szrin is insufficient on \0. */ + *in = tmpin; + *outbytes -= szrout; + *out += szrout; + } + *invalids = inval; + + return 0; + +err: + restore_encoding_state(&sc->sc_src_encoding); + restore_encoding_state(&sc->sc_dst_encoding); +err_norestore: + *invalids = inval; + + return ret; +} diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/modules/citrus_iconv_std.h src/lib/libc/citrus/modules/citrus_iconv_std.h --- src.orig/lib/libc/citrus/modules/citrus_iconv_std.h Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/modules/citrus_iconv_std.h Thu Jun 18 13:03:24 2009 @@ -0,0 +1,37 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_iconv_std.h,v 1.1 2003/06/25 09:51:44 tshiozak Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _CITRUS_ICONV_STD_H_ +#define _CITRUS_ICONV_STD_H_ + +#include "citrus_iconv_std_local.h" + +_CITRUS_ICONV_GETOPS_FUNC(iconv_std); + +#endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/modules/citrus_iconv_std_local.h src/lib/libc/citrus/modules/citrus_iconv_std_local.h --- src.orig/lib/libc/citrus/modules/citrus_iconv_std_local.h Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/modules/citrus_iconv_std_local.h Thu Jun 18 13:03:24 2009 @@ -0,0 +1,82 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_iconv_std_local.h,v 1.2 2003/07/01 09:42:16 tshiozak Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _CITRUS_ICONV_STD_LOCAL_H_ +#define _CITRUS_ICONV_STD_LOCAL_H_ + +/* + * encoding + */ +struct _citrus_iconv_std_encoding { + struct _citrus_stdenc *se_handle; + void *se_ps; + void *se_pssaved; +}; + +/* + * dst + */ +struct _citrus_iconv_std_dst { + TAILQ_ENTRY(_citrus_iconv_std_dst) sd_entry; + _citrus_csid_t sd_csid; + unsigned long sd_norm; + struct _citrus_csmapper *sd_mapper; +}; +TAILQ_HEAD(_citrus_iconv_std_dst_list, _citrus_iconv_std_dst); + +/* + * src + */ +struct _citrus_iconv_std_src { + TAILQ_ENTRY(_citrus_iconv_std_src) ss_entry; + _citrus_csid_t ss_csid; + struct _citrus_iconv_std_dst_list ss_dsts; +}; +TAILQ_HEAD(_citrus_iconv_std_src_list, _citrus_iconv_std_src); + +/* + * iconv_std handle + */ +struct _citrus_iconv_std_shared { + struct _citrus_stdenc *is_src_encoding; + struct _citrus_stdenc *is_dst_encoding; + struct _citrus_iconv_std_src_list is_srcs; + int is_use_invalid; + _citrus_wc_t is_invalid; +}; + +/* + * iconv_std context + */ +struct _citrus_iconv_std_context { + struct _citrus_iconv_std_encoding sc_src_encoding; + struct _citrus_iconv_std_encoding sc_dst_encoding; +}; + +#endif diff -uNr --exclude=CVS --exclude=obj src.orig/lib/libc/citrus/modules/citrus_iso2022.c src/lib/libc/citrus/modules/citrus_iso2022.c --- src.orig/lib/libc/citrus/modules/citrus_iso2022.c Thu Jan 1 09:00:00 1970 +++ src/lib/libc/citrus/modules/citrus_iso2022.c Thu Jun 18 13:03:24 2009 @@ -0,0 +1,1294 @@ +/* $OpenBSD$ */ +/* $NetBSD: citrus_iso2022.c,v 1.19 2008/06/14 16:01:07 tnozaki Exp $ */ + +/*- + * Copyright (c)1999, 2002 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Citrus: xpg4dl/FreeBSD/lib/libc/locale/iso2022.c,v 1.23 2001/06/21 01:51:44 yamt Exp $ + */ + +#include +#include +#include +#include +#include +#include + +#include "citrus_namespace.h" +#include "citrus_types.h" +#include "citrus_module.h" +#include "citrus_ctype.h" +#include "citrus_stdenc.h" + +#include "citrus_iso2022.h" + +/* ---------------------------------------------------------------------- + * private stuffs used by templates + */ + + +/* + * wchar_t mappings: + * ASCII (ESC ( B) 00000000 00000000 00000000 0xxxxxxx + * iso-8859-1 (ESC , A) 00000000 00000000 00000000 1xxxxxxx + * 94 charset (ESC ( F) 0fffffff 00000000 00000000 0xxxxxxx + * 94 charset (ESC ( M F) 0fffffff 1mmmmmmm 00000000 0xxxxxxx + * 96 charset (ESC , F) 0fffffff 00000000 00000000 1xxxxxxx + * 96 charset (ESC , M F) 0fffffff 1mmmmmmm 00000000 1xxxxxxx + * 94x94 charset (ESC $ ( F) 0fffffff 00000000 0xxxxxxx 0xxxxxxx + * 96x96 charset (ESC $ , F) 0fffffff 00000000 0xxxxxxx 1xxxxxxx + * 94x94 charset (ESC & V ESC $ ( F) + * 0fffffff 1vvvvvvv 0xxxxxxx 0xxxxxxx + * 94x94x94 charset (ESC $ ( F) 0fffffff 0xxxxxxx 0xxxxxxx 0xxxxxxx + * 96x96x96 charset (ESC $ , F) 0fffffff 0xxxxxxx 0xxxxxxx 1xxxxxxx + * reserved for UCS4 co-existence (UCS4 is 31bit encoding thanks to mohta bit) + * 1xxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx + */ + +typedef struct { + u_char type; +#define CS94 (0U) +#define CS96 (1U) +#define CS94MULTI (2U) +#define CS96MULTI (3U) + + u_char final; + u_char interm; + u_char vers; +} _ISO2022Charset; + +static const _ISO2022Charset ascii = { CS94, 'B', '\0', '\0' }; +static const _ISO2022Charset iso88591 = { CS96, 'A', '\0', '\0' }; + +typedef struct { + _ISO2022Charset g[4]; + /* need 3 bits to hold -1, 0, ..., 3 */ + int gl:3, + gr:3, + singlegl:3, + singlegr:3; + char ch[7]; /* longest escape sequence (ESC & V ESC $ ( F) */ + int chlen; + int flags; +#define _ISO2022STATE_FLAG_INITIALIZED 1 +} _ISO2022State; + +typedef struct { + _ISO2022Charset *recommend[4]; + size_t recommendsize[4]; + _ISO2022Charset initg[4]; + int maxcharset; + int flags; +#define F_8BIT 0x0001 +#define F_NOOLD 0x0002 +#define F_SI 0x0010 /*0F*/ +#define F_SO 0x0020 /*0E*/ +#define F_LS0 0x0010 /*0F*/ +#define F_LS1 0x0020 /*0E*/ +#define F_LS2 0x0040 /*ESC n*/ +#define F_LS3 0x0080 /*ESC o*/ +#define F_LS1R 0x0100 /*ESC ~*/ +#define F_LS2R 0x0200 /*ESC }*/ +#define F_LS3R 0x0400 /*ESC |*/ +#define F_SS2 0x0800 /*ESC N*/ +#define F_SS3 0x1000 /*ESC O*/ +#define F_SS2R 0x2000 /*8E*/ +#define F_SS3R 0x4000 /*8F*/ +} _ISO2022EncodingInfo; +typedef struct { + _ISO2022EncodingInfo ei; + struct { + /* for future multi-locale facility */ + _ISO2022State s_mblen; + _ISO2022State s_mbrlen; + _ISO2022State s_mbrtowc; + _ISO2022State s_mbtowc; + _ISO2022State s_mbsrtowcs; + _ISO2022State s_wcrtomb; + _ISO2022State s_wcsrtombs; + _ISO2022State s_wctomb; + } states; +} _ISO2022CTypeInfo; + +#define _CEI_TO_EI(_cei_) (&(_cei_)->ei) +#define _CEI_TO_STATE(_cei_, _func_) (_cei_)->states.s_##_func_ + +#define _FUNCNAME(m) _citrus_ISO2022_##m +#define _ENCODING_INFO _ISO2022EncodingInfo +#define _CTYPE_INFO _ISO2022CTypeInfo +#define _ENCODING_STATE _ISO2022State +#define _ENCODING_MB_CUR_MAX(_ei_) MB_LEN_MAX +#define _ENCODING_IS_STATE_DEPENDENT 1 +#define _STATE_NEEDS_EXPLICIT_INIT(_ps_) \ + (!((_ps_)->flags & _ISO2022STATE_FLAG_INITIALIZED)) + + +#define _ISO2022INVALID (wchar_t)-1 + +static __inline int isc0(uint8_t x) { return ((x & 0x1f) == x); } +static __inline int isc1(uint8_t x) { return (0x80 <= x && x <= 0x9f); } +static __inline int iscntl(uint8_t x) { return (isc0(x) || isc1(x) || x == 0x7f); } +static __inline int is94(uint8_t x) { return (0x21 <= x && x <= 0x7e); } +static __inline int is96(uint8_t x) { return (0x20 <= x && x <= 0x7f); } +static __inline int isecma(uint8_t x) { return (0x30 <= x && x <= 0x7f); } +static __inline int isinterm(uint8_t x) { return (0x20 <= x && x <= 0x2f); } +static __inline int isthree(uint8_t x) { return (0x60 <= x && x <= 0x6f); } + +static __inline int +getcs(const char * __restrict p, _ISO2022Cha