Print this page
4964 nl_langinfo(CRNCYSTR) returns wrong alignment character
4999 libc test suite enhancements
Reviewed by: Jason King <jason.brian.king@gmail.com>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
Approved by: TBD

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libc/port/locale/lmonetary.c
          +++ new/usr/src/lib/libc/port/locale/lmonetary.c
↓ open down ↓ 148 lines elided ↑ open up ↑
 149  149  
 150  150          /*
 151  151           * Now calculate the currency string (CRNCYSTR) for nl_langinfo.
 152  152           * This is a legacy SUSv2 interface.
 153  153           */
 154  154          if ((lmon->p_cs_precedes[0] == lmon->n_cs_precedes[0]) &&
 155  155              (lmon->currency_symbol[0] != '\0')) {
 156  156                  char sign = '\0';
 157  157                  switch (lmon->p_cs_precedes[0]) {
 158  158                  case 0:
 159      -                        sign = '-';
      159 +                        sign = '+';
 160  160                          break;
 161  161                  case 1:
 162      -                        sign = '+';
      162 +                        sign = '-';
 163  163                          break;
 164  164                  case CHAR_MAX:
 165  165                          /*
 166  166                           * Substitute currency string for radix character.
 167  167                           * To the best of my knowledge, no locale uses this.
 168  168                           */
 169  169                          if (strcmp(lmon->mon_decimal_point,
 170  170                              lmon->currency_symbol) == 0)
 171  171                                  sign = '.';
 172  172                          break;
 173  173                  }
 174  174                  (void) snprintf(lmon->crncystr, clen, "%c%s", sign,
 175  175                      lmon->currency_symbol);
 176  176          }
 177  177  
 178  178          return (ldata);
 179  179  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX