Print this page
2964 need POSIX 2008 locale object support

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libc/port/locale/setlocale.c
          +++ new/usr/src/lib/libc/port/locale/setlocale.c
↓ open down ↓ 86 lines elided ↑ open up ↑
  87   87  
  88   88  /*
  89   89   * The locales we are going to try and load
  90   90   */
  91   91  static char new_categories[NUM_CATS][ENCODING_LEN + 1];
  92   92  static char saved_categories[NUM_CATS][ENCODING_LEN + 1];
  93   93  static char current_locale_string[NUM_CATS * (ENCODING_LEN + 1 + 1)];
  94   94  
  95   95  static char     *currentlocale(void);
  96   96  static char     *loadlocale(int);
  97      -static const char *__get_locale_env(int);
  98   97  
  99   98  char *
 100   99  setlocale(int category, const char *locale)
 101  100  {
 102  101          int i, j, saverr;
 103  102          const char *env, *r;
 104  103  
 105  104          if (category < 0 || category >= NUM_CATS) {
 106  105                  errno = EINVAL;
 107  106                  return (NULL);
↓ open down ↓ 190 lines elided ↑ open up ↑
 298  297                  return (old);
 299  298  
 300  299          if (func(new) != _LDP_ERROR) {
 301  300                  (void) strcpy(old, new);
 302  301                  return (old);
 303  302          }
 304  303  
 305  304          return (NULL);
 306  305  }
 307  306  
 308      -static const char *
      307 +const char *
 309  308  __get_locale_env(int category)
 310  309  {
 311  310          const char *env;
 312  311  
 313  312          /* 1. check LC_ALL. */
 314  313          env = getenv(categories[LC_ALL]);
 315  314  
 316  315          /* 2. check LC_* */
 317  316          if (env == NULL || !*env)
 318  317                  env = getenv(categories[category]);
↓ open down ↓ 1 lines elided ↑ open up ↑
 320  319          /* 3. check LANG */
 321  320          if (env == NULL || !*env)
 322  321                  env = getenv("LANG");
 323  322  
 324  323          /* 4. if none is set, fall to "C" */
 325  324          if (env == NULL || !*env)
 326  325                  env = "C";
 327  326  
 328  327          return (env);
 329  328  }
      329 +
      330 +/*
      331 + * Detect locale storage location and store its value to _PathLocale variable
      332 + */
      333 +int
      334 +__detect_path_locale(void)
      335 +{
      336 +        /* XXX */
      337 +
      338 +        return (0);
      339 +}
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX