Logo Search packages:      
Sourcecode: freetds version File versions

TDSLOCALE* tds_get_locale ( void   ) 

Get locale information.

allocated structure with all information or NULL if error

Definition at line 52 of file locale.c.

References tds_get_locale(), and tds_read_conf_section().

Referenced by tds_get_locale().

      TDSLOCALE *locale;
      char *s;
      int i;
      FILE *in;

      /* allocate a new structure with hard coded and build-time defaults */
      locale = tds_alloc_locale();
      if (!locale)
            return NULL;

      tdsdump_log(TDS_DBG_INFO1, "%L 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 && strlen(s)) {
                  for (i = 0; i < strlen(s); i++)
                        s[i] = tolower(s[i]);
                  tds_read_conf_section(in, s, tds_parse_locale, locale);

      return locale;

Generated by  Doxygen 1.6.0   Back to index