Date: Tue, 1 Dec 2009 13:52:39 +0100 From: Matthias Drochner <m.drochner@googlemail.com> To: Maksim Yevmenkin <maksim.yevmenkin@gmail.com> Cc: freebsd-bluetooth@freebsd.org, plunky@netbsd.org Subject: Re: patch to make obexapp work with BSD iconv(3) Message-ID: <20091201135239.322f50f1@zelz27> In-Reply-To: <20091201125054.44a00147@zelz27> References: <20091201125054.44a00147@zelz27>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --]
On Tue, 1 Dec 2009 12:50:54 +0100
Matthias Drochner <m.drochner@gmail.com> wrote:
> Here is a patch
Oops, this time for real.
best regards
Matthias
[-- Attachment #2 --]
$NetBSD: patch-ac,v 1.4 2009/12/01 11:18:48 drochner Exp $
--- util.c.orig 2009-08-20 23:57:18.000000000 +0200
+++ util.c
@@ -30,9 +30,9 @@
*/
#include <bluetooth.h>
-#include <bsdxml.h>
#include <ctype.h>
#include <errno.h>
+#include <expat.h>
#include <iconv.h>
#include <libgen.h>
#include <limits.h>
@@ -43,6 +43,7 @@
#include <string.h>
#include <time.h>
#include <unistd.h>
+#include <langinfo.h>
#include <readline/readline.h>
#include <readline/history.h>
@@ -66,26 +67,12 @@ static iconv_t locale2utf16be = (iconv
int
obexapp_util_locale_init(void)
{
- int one = 1;
- locale = setlocale(LC_CTYPE, "");
+ setlocale(LC_CTYPE, "");
+ locale = nl_langinfo(CODESET);
if (locale == NULL)
return (-1);
- if (strcmp(locale, "ASCII") == 0 ||
- strcmp(locale, "C") == 0 ||
- strcmp(locale, "POSIX") == 0 ||
- strcmp(locale, "US-ASCII") == 0)
- locale = "en_US.US-ASCII";
-
- locale = strchr(locale, '.');
- if (locale == NULL)
- return (-1);
-
- locale ++;
- if (locale[0] == '\0')
- return (-1);
-
utf16 = (strstr(locale, "UTF-16") != NULL)? 1 : 0;
/* UTF-8 -> current locale */
@@ -94,7 +81,6 @@ obexapp_util_locale_init(void)
return (-1);
iconv(utf82locale, NULL, NULL, NULL, NULL);
- iconvctl(utf82locale, ICONV_SET_DISCARD_ILSEQ, &one);
/* current locale -> UTF-8 */
locale2utf8 = iconv_open("UTF-8", locale);
@@ -104,7 +90,6 @@ obexapp_util_locale_init(void)
}
iconv(locale2utf8, NULL, NULL, NULL, NULL);
- iconvctl(locale2utf8, ICONV_SET_DISCARD_ILSEQ, &one);
/* UTF-16BE -> current locale */
utf16be2locale = iconv_open(locale, "UTF-16BE");
@@ -114,7 +99,6 @@ obexapp_util_locale_init(void)
}
iconv(utf16be2locale, NULL, NULL, NULL, NULL);
- iconvctl(utf16be2locale, ICONV_SET_DISCARD_ILSEQ, &one);
/* current locale -> UTF-16BE */
locale2utf16be = iconv_open("UTF-16BE", locale);
@@ -124,7 +108,6 @@ obexapp_util_locale_init(void)
}
iconv(locale2utf16be, NULL, NULL, NULL, NULL);
- iconvctl(locale2utf16be, ICONV_SET_DISCARD_ILSEQ, &one);
return (0);
}
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20091201135239.322f50f1>
