diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libkiconv/Makefile | 1 | ||||
-rw-r--r-- | lib/libkiconv/kiconv.3 | 17 | ||||
-rw-r--r-- | lib/libkiconv/xlat16_iconv.c | 24 |
3 files changed, 42 insertions, 0 deletions
diff --git a/lib/libkiconv/Makefile b/lib/libkiconv/Makefile index a68f246..763c5fd 100644 --- a/lib/libkiconv/Makefile +++ b/lib/libkiconv/Makefile @@ -10,6 +10,7 @@ SHLIB_MAJOR= 1 MAN= kiconv.3 MLINKS+= kiconv.3 kiconv_add_xlat16_cspair.3 \ + kiconv.3 kiconv_add_xlat16_cspairs.3 \ kiconv.3 kiconv_add_xlat16_table.3 CFLAGS+= -I${.CURDIR}/../../sys diff --git a/lib/libkiconv/kiconv.3 b/lib/libkiconv/kiconv.3 index c742c7f..632252e 100644 --- a/lib/libkiconv/kiconv.3 +++ b/lib/libkiconv/kiconv.3 @@ -30,6 +30,7 @@ .Os .Sh NAME .Nm kiconv_add_xlat16_cspair , +.Nm kiconv_add_xlat16_cspairs , .Nm kiconv_add_xlat16_table .Nd Kernel side iconv library .Sh LIBRARY @@ -43,6 +44,11 @@ .Fa "int flag" .Fc .Ft int +.Fo kiconv_add_xlat16_cspairs +.Fa "const char *foreigncode" +.Fa "const char *localcode" +.Fc +.Ft int .Fo kiconv_add_xlat16_table .Fa "const char *tocode" .Fa "const char *fromcode" @@ -92,6 +98,17 @@ or toupper .Pp A tolower/toupper conversion is limited to single-byte characters. .Pp +.Fn kiconv_add_xlat16_cspairs +defines two conversion tables which are from +.Ar localcode +to +.Ar foreigncode +and from +.Ar foreigncode +to +.Ar localcode . +This conversion tables also contain both of tolower and toupper tables. +.Pp .Fn kiconv_add_xlat16_table defines a conversion table directly pointed by .Ar data diff --git a/lib/libkiconv/xlat16_iconv.c b/lib/libkiconv/xlat16_iconv.c index 2490107..c714961 100644 --- a/lib/libkiconv/xlat16_iconv.c +++ b/lib/libkiconv/xlat16_iconv.c @@ -113,6 +113,23 @@ kiconv_add_xlat16_cspair(const char *tocode, const char *fromcode, int flag) return (-1); } +int +kiconv_add_xlat16_cspairs(const char *foreigncode, const char *localcode) +{ + int error; + + error = kiconv_add_xlat16_cspair(foreigncode, localcode, + KICONV_FROM_LOWER | KICONV_FROM_UPPER); + if (error) + return (error); + error = kiconv_add_xlat16_cspair(localcode, foreigncode, + KICONV_LOWER | KICONV_UPPER); + if (error) + return (error); + + return (0); +} + static struct xlat16_table kiconv_xlat16_open(const char *tocode, const char *fromcode, int lcase) { @@ -371,4 +388,11 @@ kiconv_add_xlat16_cspair(const char *tocode, const char *fromcode, int flag) return (-1); } +int +kiconv_add_xlat16_cspairs(const char *tocode, const char *fromcode) +{ + errno = EINVAL; + return (-1); +} + #endif /* PIC */ |