Skip to Content.
Sympa Menu

freetds - [freetds] Apply or not apply?

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: [freetds] Apply or not apply?
  • Date: Tue, 13 Dec 2005 16:40:08 +0100

Well, this is the patch but is it useful and correct or not? See comment
in code for aim.

diff -u -1 -0 -r1.23 locale.c
--- src/tds/locale.c 23 Aug 2005 17:25:52 -0000 1.23
+++ src/tds/locale.c 13 Dec 2005 15:28:07 -0000
@@ -61,22 +62,48 @@
return NULL;

tdsdump_log(TDS_DBG_INFO1, "Attempting to read locales.conf
file\n");

in = fopen(FREETDS_LOCALECONFFILE, "r");
if (in) {
tds_read_conf_section(in, "default", tds_parse_locale,
locale);

s = getenv("LANG");
if (s && s[0]) {
+ int found;
+ char buf[128];
+ const char *strip = "@._";
+
+ /* do not change environment !!! */
+ tds_strlcpy(buf, s, sizeof(buf));
+
+ /* search full name */
rewind(in);
- tds_read_conf_section(in, s, tds_parse_locale,
locale);
+ found = tds_read_conf_section(in, buf,
tds_parse_locale, locale);
+
+ /*
+ * Here we try to strip some part of language in
order to
+ * catch similar language
+ * LANG is composed by
+ * language[_sublanguage][.charset][@modified]
+ * ie it_IT@euro or it_IT.UTF-8 so we strip in
order
+ * modifier, charset and sublanguage
+ * ie it_IT@euro -> it_IT -> it
+ */
+ for (;!found && *strip; ++strip) {
+ s = strrchr(buf, *strip);
+ if (!s)
+ continue;
+ *s = 0;
+ rewind(in);
+ found = tds_read_conf_section(in, buf,
tds_parse_locale, locale);
+ }
}

fclose(in);
}
return locale;
}

static void
tds_parse_locale(const char *option, const char *value, void *param)
{

freddy77



  • [freetds] Apply or not apply?, ZIGLIO, Frediano, VF-IT, 12/13/2005

Archive powered by MHonArc 2.6.24.

Top of Page