Deleted Added
full compact
setlocale.c (116847) setlocale.c (117270)
1/*
2 * Copyright (c) 1996 - 2002 FreeBSD Project
3 * Copyright (c) 1991, 1993
4 * The Regents of the University of California. All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * Paul Borman at Krystal Technologies.
8 *

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

34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
36 */
37
38#if defined(LIBC_SCCS) && !defined(lint)
39static char sccsid[] = "@(#)setlocale.c 8.1 (Berkeley) 7/4/93";
40#endif /* LIBC_SCCS and not lint */
41#include <sys/cdefs.h>
1/*
2 * Copyright (c) 1996 - 2002 FreeBSD Project
3 * Copyright (c) 1991, 1993
4 * The Regents of the University of California. All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * Paul Borman at Krystal Technologies.
8 *

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

34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
36 */
37
38#if defined(LIBC_SCCS) && !defined(lint)
39static char sccsid[] = "@(#)setlocale.c 8.1 (Berkeley) 7/4/93";
40#endif /* LIBC_SCCS and not lint */
41#include <sys/cdefs.h>
42__FBSDID("$FreeBSD: head/lib/libc/locale/setlocale.c 116847 2003-06-25 22:42:33Z phantom $");
42__FBSDID("$FreeBSD: head/lib/libc/locale/setlocale.c 117270 2003-07-06 02:03:37Z ache $");
43
44#include <sys/types.h>
45#include <sys/stat.h>
46#include <errno.h>
47#include <limits.h>
48#include <locale.h>
49#include <paths.h> /* for _PATH_LOCALE */
50#include <stdlib.h>

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

93 * The locales we are going to try and load
94 */
95static char new_categories[_LC_LAST][ENCODING_LEN + 1];
96static char saved_categories[_LC_LAST][ENCODING_LEN + 1];
97
98static char current_locale_string[_LC_LAST * (ENCODING_LEN + 1/*"/"*/ + 1)];
99
100static char *currentlocale(void);
43
44#include <sys/types.h>
45#include <sys/stat.h>
46#include <errno.h>
47#include <limits.h>
48#include <locale.h>
49#include <paths.h> /* for _PATH_LOCALE */
50#include <stdlib.h>

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

93 * The locales we are going to try and load
94 */
95static char new_categories[_LC_LAST][ENCODING_LEN + 1];
96static char saved_categories[_LC_LAST][ENCODING_LEN + 1];
97
98static char current_locale_string[_LC_LAST * (ENCODING_LEN + 1/*"/"*/ + 1)];
99
100static char *currentlocale(void);
101static int wrap_setrunelocale(const char *);
102static char *loadlocale(int);
103
104char *
105setlocale(category, locale)
106 int category;
107 const char *locale;
108{
109 int i, j, len, saverr;

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

238 (void)strcat(current_locale_string,
239 current_categories[i]);
240 }
241 break;
242 }
243 return (current_locale_string);
244}
245
101static char *loadlocale(int);
102
103char *
104setlocale(category, locale)
105 int category;
106 const char *locale;
107{
108 int i, j, len, saverr;

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

237 (void)strcat(current_locale_string,
238 current_categories[i]);
239 }
240 break;
241 }
242 return (current_locale_string);
243}
244
246static int
247wrap_setrunelocale(const char *locale)
248{
249 int ret = setrunelocale((char *)locale);
250
251 if (ret != 0) {
252 errno = ret;
253 return (_LDP_ERROR);
254 }
255 return (_LDP_LOADED);
256}
257
258static char *
259loadlocale(category)
260 int category;
261{
262 char *new = new_categories[category];
263 char *old = current_categories[category];
264 int (*func)(const char *);
265 int saved_errno;

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

274 saved_errno = errno;
275 errno = __detect_path_locale();
276 if (errno != 0)
277 return (NULL);
278 errno = saved_errno;
279
280 switch (category) {
281 case LC_CTYPE:
245static char *
246loadlocale(category)
247 int category;
248{
249 char *new = new_categories[category];
250 char *old = current_categories[category];
251 int (*func)(const char *);
252 int saved_errno;

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

261 saved_errno = errno;
262 errno = __detect_path_locale();
263 if (errno != 0)
264 return (NULL);
265 errno = saved_errno;
266
267 switch (category) {
268 case LC_CTYPE:
282 func = wrap_setrunelocale;
269 func = __wrap_setrunelocale;
283 break;
284 case LC_COLLATE:
285 func = __collate_load_tables;
286 break;
287 case LC_TIME:
288 func = __time_load_locale;
289 break;
290 case LC_NUMERIC:

--- 50 unchanged lines hidden ---
270 break;
271 case LC_COLLATE:
272 func = __collate_load_tables;
273 break;
274 case LC_TIME:
275 func = __time_load_locale;
276 break;
277 case LC_NUMERIC:

--- 50 unchanged lines hidden ---