Print this page
2964 need POSIX 2008 locale object support

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libc/port/locale/nl_langinfo.c
          +++ new/usr/src/lib/libc/port/locale/nl_langinfo.c
   1    1  /*
   2    2   * Copyright 2010 Nexenta Systems, Inc.  All rights reserved.
   3    3   * Copyright (c) 2001, 2003 Alexey Zelkin <phantom@FreeBSD.org>
   4    4   * All rights reserved.
   5    5   *
        6 + * Copyright (c) 2011 The FreeBSD Foundation
        7 + * All rights reserved.
        8 + * Portions of this software were developed by David Chisnall
        9 + * under sponsorship from the FreeBSD Foundation.
       10 + *
   6   11   * Redistribution and use in source and binary forms, with or without
   7   12   * modification, are permitted provided that the following conditions
   8   13   * are met:
   9   14   * 1. Redistributions of source code must retain the above copyright
  10   15   *    notice, this list of conditions and the following disclaimer.
  11   16   * 2. Redistributions in binary form must reproduce the above copyright
  12   17   *    notice, this list of conditions and the following disclaimer in the
  13   18   *    documentation and/or other materials provided with the distribution.
  14   19   *
  15   20   * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
↓ open down ↓ 16 lines elided ↑ open up ↑
  32   37  #include <stdlib.h>
  33   38  #include <string.h>
  34   39  
  35   40  #include "lnumeric.h"
  36   41  #include "lmessages.h"
  37   42  #include "lmonetary.h"
  38   43  #include "timelocal.h"
  39   44  
  40   45  #define _REL(BASE) ((int)item-BASE)
  41   46  
  42      -#define MONETARY        (__get_current_monetary_locale())
       47 +#define MONETARY        (__get_current_monetary_locale(loc))
  43   48  #define TIME            (__get_current_time_locale())
  44      -#define MESSAGES        (__get_current_messages_locale())
       49 +#define MESSAGES        (__get_current_messages_locale(loc))    /* XXX */
  45   50  #define NUMERIC         (__get_current_numeric_locale())
  46   51  
  47   52  #pragma weak _nl_langinfo = nl_langinfo
  48   53  
  49   54  char *
  50      -nl_langinfo(nl_item item)
       55 +nl_langinfo_l(nl_item item, locale_t loc)
  51   56  {
  52   57          char *ret, *s, *cs;
  53   58          static char *csym = NULL;
  54   59  
  55   60          switch (item) {
  56   61          case CODESET:
  57   62                  ret = "";
  58   63                  /*
  59   64                   * The codeset is the suffix of a locale, for most it will
  60   65                   * will be UTF-8, as in "en.UTF-8".  Short form locales are
↓ open down ↓ 126 lines elided ↑ open up ↑
 187  192                  break;
 188  193          /*
 189  194           * Note that FreeBSD also had a private D_MD_ORDER, but that appears
 190  195           * to have been specific to FreeBSD, so we have not included it here.
 191  196           */
 192  197          default:
 193  198                  ret = "";
 194  199          }
 195  200          return (ret);
 196  201  }
      202 +
      203 +char *
      204 +nl_langinfo(nl_item item)
      205 +{
      206 +        return (nl_langinfo_l(item, __get_locale()));
      207 +}
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX