setlocale.c (53050) | setlocale.c (61218) |
---|---|
1/* 2 * Copyright (c) 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Paul Borman at Krystal Technologies. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 19 unchanged lines hidden (view full) --- 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * | 1/* 2 * Copyright (c) 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Paul Borman at Krystal Technologies. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 19 unchanged lines hidden (view full) --- 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * |
36 * $FreeBSD: head/lib/libc/locale/setlocale.c 53050 1999-11-09 11:09:16Z ache $ | 36 * $FreeBSD: head/lib/libc/locale/setlocale.c 61218 2000-06-03 12:24:08Z ache $ |
37 */ 38 39#ifdef LIBC_RCS 40static const char rcsid[] = | 37 */ 38 39#ifdef LIBC_RCS 40static const char rcsid[] = |
41 "$FreeBSD: head/lib/libc/locale/setlocale.c 53050 1999-11-09 11:09:16Z ache $"; | 41 "$FreeBSD: head/lib/libc/locale/setlocale.c 61218 2000-06-03 12:24:08Z ache $"; |
42#endif 43 44#if defined(LIBC_SCCS) && !defined(lint) 45static char sccsid[] = "@(#)setlocale.c 8.1 (Berkeley) 7/4/93"; 46#endif /* LIBC_SCCS and not lint */ 47 48#include <sys/types.h> 49#include <sys/stat.h> --- 41 unchanged lines hidden (view full) --- 91static char current_locale_string[_LC_LAST * (ENCODING_LEN + 1/*"/"*/ + 1)]; 92 93static char *currentlocale __P((void)); 94static char *loadlocale __P((int)); 95static int stub_load_locale __P((const char *)); 96 97extern int __time_load_locale __P((const char *)); /* strftime.c */ 98 | 42#endif 43 44#if defined(LIBC_SCCS) && !defined(lint) 45static char sccsid[] = "@(#)setlocale.c 8.1 (Berkeley) 7/4/93"; 46#endif /* LIBC_SCCS and not lint */ 47 48#include <sys/types.h> 49#include <sys/stat.h> --- 41 unchanged lines hidden (view full) --- 91static char current_locale_string[_LC_LAST * (ENCODING_LEN + 1/*"/"*/ + 1)]; 92 93static char *currentlocale __P((void)); 94static char *loadlocale __P((int)); 95static int stub_load_locale __P((const char *)); 96 97extern int __time_load_locale __P((const char *)); /* strftime.c */ 98 |
99#ifdef XPG4 100extern int _xpg4_setrunelocale __P((char *)); 101#endif 102 | |
103char * 104setlocale(category, locale) 105 int category; 106 const char *locale; 107{ 108 int i, j, len; 109 char *env, *r; 110 --- 127 unchanged lines hidden (view full) --- 238 } else 239 _PathLocale = _PATH_LOCALE; 240 } 241 242 if (strcmp(new, old) == 0) 243 return (old); 244 245 if (category == LC_CTYPE) { | 99char * 100setlocale(category, locale) 101 int category; 102 const char *locale; 103{ 104 int i, j, len; 105 char *env, *r; 106 --- 127 unchanged lines hidden (view full) --- 234 } else 235 _PathLocale = _PATH_LOCALE; 236 } 237 238 if (strcmp(new, old) == 0) 239 return (old); 240 241 if (category == LC_CTYPE) { |
246#ifdef XPG4 247 ret = _xpg4_setrunelocale(new) ? NULL : new; 248#else | |
249 ret = setrunelocale(new) ? NULL : new; | 242 ret = setrunelocale(new) ? NULL : new; |
250#endif 251 if (!ret) { 252#ifdef XPG4 253 (void)_xpg4_setrunelocale(old); 254#else | 243 if (!ret) |
255 (void)setrunelocale(old); | 244 (void)setrunelocale(old); |
256#endif 257 } else | 245 else |
258 (void)strcpy(old, new); 259 return (ret); 260 } 261 262 if (category == LC_COLLATE) { 263 ret = (__collate_load_tables(new) < 0) ? NULL : new; 264 if (!ret) 265 (void)__collate_load_tables(old); --- 56 unchanged lines hidden --- | 246 (void)strcpy(old, new); 247 return (ret); 248 } 249 250 if (category == LC_COLLATE) { 251 ret = (__collate_load_tables(new) < 0) ? NULL : new; 252 if (!ret) 253 (void)__collate_load_tables(old); --- 56 unchanged lines hidden --- |