Don't use nl_langinfo() - this interface doesn't exist in 4-stable.

Reported by:	Jose M. Alcaide <jose@we.lc.ehu.es>
This commit is contained in:
Maxim Sobolev 2001-08-22 18:41:46 +00:00
parent 88e7d201df
commit 20740446aa
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=46655
4 changed files with 134 additions and 0 deletions

View File

@ -0,0 +1,31 @@
$FreeBSD$
--- gmime/gmime-utils.c 2001/08/22 18:22:18 1.1
+++ gmime/gmime-utils.c 2001/08/22 18:35:26
@@ -32,7 +32,7 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
-#include <langinfo.h>
+#include <locale.h>
#define d(x)
@@ -128,11 +128,12 @@
get_codeset (void)
{
const gchar * codeset;
+ gchar *s;
- codeset = nl_langinfo (CODESET);
- if (!codeset || !*codeset)
- codeset = DEFAULT_CODESET;
-
+ codeset = DEFAULT_CODESET;
+ if ((s = setlocale(LC_CTYPE, NULL)) != NULL)
+ if ((s = strchr(s, '.')) != NULL)
+ codeset = s + 1;
return codeset;
}

View File

@ -0,0 +1,36 @@
$FreeBSD$
--- pan/message-send.c 2001/08/22 18:36:41 1.1
+++ pan/message-send.c 2001/08/22 18:36:50
@@ -25,7 +25,7 @@
#include <string.h>
#include <sys/types.h>
-#include <langinfo.h>
+#include <locale.h>
#include <glib.h>
@@ -75,6 +75,7 @@
gboolean force_new_message_id)
{
gchar * tmp;
+ gchar * s;
const gchar * pch;
debug_enter ("build_nntp_header");
@@ -153,9 +154,10 @@
/* Add mime header, charset type, encoding type */
g_string_append (postme, "Mime-Version: 1.0\r\n");
- pch = nl_langinfo (CODESET);
- if (!is_nonempty_string (pch))
- pch = "ISO-8859-1";
+ pch = "ISO-8859-1";
+ if ((s = setlocale(LC_CTYPE, NULL)) != NULL)
+ if ((s = strchr(s, '.')) != NULL)
+ pch = s + 1;
g_string_sprintfa (postme, "Content-Type: text/plain; charset=%s\r\n", pch);
g_string_append (postme, "Content-Transfer-Encoding: 8bit\r\n");

View File

@ -0,0 +1,31 @@
$FreeBSD$
--- gmime/gmime-utils.c 2001/08/22 18:22:18 1.1
+++ gmime/gmime-utils.c 2001/08/22 18:35:26
@@ -32,7 +32,7 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
-#include <langinfo.h>
+#include <locale.h>
#define d(x)
@@ -128,11 +128,12 @@
get_codeset (void)
{
const gchar * codeset;
+ gchar *s;
- codeset = nl_langinfo (CODESET);
- if (!codeset || !*codeset)
- codeset = DEFAULT_CODESET;
-
+ codeset = DEFAULT_CODESET;
+ if ((s = setlocale(LC_CTYPE, NULL)) != NULL)
+ if ((s = strchr(s, '.')) != NULL)
+ codeset = s + 1;
return codeset;
}

View File

@ -0,0 +1,36 @@
$FreeBSD$
--- pan/message-send.c 2001/08/22 18:36:41 1.1
+++ pan/message-send.c 2001/08/22 18:36:50
@@ -25,7 +25,7 @@
#include <string.h>
#include <sys/types.h>
-#include <langinfo.h>
+#include <locale.h>
#include <glib.h>
@@ -75,6 +75,7 @@
gboolean force_new_message_id)
{
gchar * tmp;
+ gchar * s;
const gchar * pch;
debug_enter ("build_nntp_header");
@@ -153,9 +154,10 @@
/* Add mime header, charset type, encoding type */
g_string_append (postme, "Mime-Version: 1.0\r\n");
- pch = nl_langinfo (CODESET);
- if (!is_nonempty_string (pch))
- pch = "ISO-8859-1";
+ pch = "ISO-8859-1";
+ if ((s = setlocale(LC_CTYPE, NULL)) != NULL)
+ if ((s = strchr(s, '.')) != NULL)
+ pch = s + 1;
g_string_sprintfa (postme, "Content-Type: text/plain; charset=%s\r\n", pch);
g_string_append (postme, "Content-Transfer-Encoding: 8bit\r\n");