- Add support for BSD iconv when it is build into libc
PR: bin/162670 Submitted by: Jan Beich <jbeich@tormail.net> MFC after: 2 weeks
This commit is contained in:
parent
4412ad4887
commit
af483ad6ef
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=236028
@ -17,4 +17,8 @@ CFLAGS+= -I${.CURDIR}/../../sys
|
|||||||
|
|
||||||
WARNS?= 1
|
WARNS?= 1
|
||||||
|
|
||||||
|
.if !defined(MK_ICONV)
|
||||||
|
CFLAGS+= -DICONV_DLOPEN
|
||||||
|
.endif
|
||||||
|
|
||||||
.include <bsd.lib.mk>
|
.include <bsd.lib.mk>
|
||||||
|
@ -60,10 +60,18 @@ struct xlat16_table {
|
|||||||
static struct xlat16_table kiconv_xlat16_open(const char *, const char *, int);
|
static struct xlat16_table kiconv_xlat16_open(const char *, const char *, int);
|
||||||
static int chklocale(int, const char *);
|
static int chklocale(int, const char *);
|
||||||
|
|
||||||
|
#ifdef ICONV_DLOPEN
|
||||||
static int my_iconv_init(void);
|
static int my_iconv_init(void);
|
||||||
static iconv_t (*my_iconv_open)(const char *, const char *);
|
static iconv_t (*my_iconv_open)(const char *, const char *);
|
||||||
static size_t (*my_iconv)(iconv_t, const char **, size_t *, char **, size_t *);
|
static size_t (*my_iconv)(iconv_t, const char **, size_t *, char **, size_t *);
|
||||||
static int (*my_iconv_close)(iconv_t);
|
static int (*my_iconv_close)(iconv_t);
|
||||||
|
#else
|
||||||
|
#include <iconv.h>
|
||||||
|
#define my_iconv_init() 0
|
||||||
|
#define my_iconv_open iconv_open
|
||||||
|
#define my_iconv iconv
|
||||||
|
#define my_iconv_close iconv_close
|
||||||
|
#endif
|
||||||
static size_t my_iconv_char(iconv_t, const u_char **, size_t *, u_char **, size_t *);
|
static size_t my_iconv_char(iconv_t, const u_char **, size_t *, u_char **, size_t *);
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -310,6 +318,7 @@ chklocale(int category, const char *code)
|
|||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ICONV_DLOPEN
|
||||||
static int
|
static int
|
||||||
my_iconv_init(void)
|
my_iconv_init(void)
|
||||||
{
|
{
|
||||||
@ -327,6 +336,7 @@ my_iconv_init(void)
|
|||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static size_t
|
static size_t
|
||||||
my_iconv_char(iconv_t cd, const u_char **ibuf, size_t * ilen, u_char **obuf,
|
my_iconv_char(iconv_t cd, const u_char **ibuf, size_t * ilen, u_char **obuf,
|
||||||
|
Loading…
Reference in New Issue
Block a user