setlocale.c (2d08521b) setlocale.c (b599bd93)
1/*
2 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
3 * Copyright 2010 Nexenta Systems, Inc. All rights reserved.
4 * Copyright (c) 1996 - 2002 FreeBSD Project
5 * Copyright (c) 1991, 1993
6 * The Regents of the University of California. All rights reserved.
7 *
8 * This code is derived from software contributed to Berkeley by

--- 37 unchanged lines hidden (view full) ---

46#include "mtlib.h"
47#include "collate.h"
48#include "lnumeric.h" /* for struct lc_numeric */
49#include "lctype.h" /* for struct lc_ctype */
50#include "setlocale.h"
51#include "../i18n/_loc_path.h"
52#include "localeimpl.h"
53#include "../i18n/_locale.h"
1/*
2 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
3 * Copyright 2010 Nexenta Systems, Inc. All rights reserved.
4 * Copyright (c) 1996 - 2002 FreeBSD Project
5 * Copyright (c) 1991, 1993
6 * The Regents of the University of California. All rights reserved.
7 *
8 * This code is derived from software contributed to Berkeley by

--- 37 unchanged lines hidden (view full) ---

46#include "mtlib.h"
47#include "collate.h"
48#include "lnumeric.h" /* for struct lc_numeric */
49#include "lctype.h" /* for struct lc_ctype */
50#include "setlocale.h"
51#include "../i18n/_loc_path.h"
52#include "localeimpl.h"
53#include "../i18n/_locale.h"
54#include "libc.h"
54
55/*
56 * Path to locale storage directory. See ../i18n/_loc_path.h
57 */
58char *_PathLocale = _DFLT_LOC_PATH;
59
55
56/*
57 * Path to locale storage directory. See ../i18n/_loc_path.h
58 */
59char *_PathLocale = _DFLT_LOC_PATH;
60
60static char *current_locale(locale_t, int);
61static void install_legacy(locale_t, int);
62
63static mutex_t setlocale_lock = DEFAULTMUTEX;
64static locale_t setlocale_list = NULL;
65
66char *
67setlocale(int category, const char *locname)
68{

--- 45 unchanged lines hidden (view full) ---

114 ___global_locale = loc;
115
116 install_legacy(loc, mask);
117 lmutex_unlock(&setlocale_lock);
118
119 return (current_locale(loc, category));
120}
121
61static void install_legacy(locale_t, int);
62
63static mutex_t setlocale_lock = DEFAULTMUTEX;
64static locale_t setlocale_list = NULL;
65
66char *
67setlocale(int category, const char *locname)
68{

--- 45 unchanged lines hidden (view full) ---

114 ___global_locale = loc;
115
116 install_legacy(loc, mask);
117 lmutex_unlock(&setlocale_lock);
118
119 return (current_locale(loc, category));
120}
121
122static char *
122char *
123current_locale(locale_t loc, int cat)
124{
125 switch (cat) {
126 case LC_CTYPE:
127 case LC_COLLATE:
128 case LC_MESSAGES:
129 case LC_MONETARY:
130 case LC_NUMERIC:

--- 55 unchanged lines hidden ---
123current_locale(locale_t loc, int cat)
124{
125 switch (cat) {
126 case LC_CTYPE:
127 case LC_COLLATE:
128 case LC_MESSAGES:
129 case LC_MONETARY:
130 case LC_NUMERIC:

--- 55 unchanged lines hidden ---