summaryrefslogtreecommitdiffstats
path: root/lib/libc/locale/setlocale.c
Commit message (Collapse)AuthorAgeFilesLines
* LC_ALL not always take priority over other LC_*ache2004-01-311-22/+35
| | | | | Obtained from: NetBSD PR: 62047
* Properly advance "x/y/z" form slash-pointers in some rare casesache2003-12-241-4/+4
| | | | PR: 60539
* Remove incomplete support for running FreeBSD userland on old NetBSD kernelstjr2003-10-291-5/+1
| | | | lacking the issetugid() and utrace() syscalls.
* Reorganize wrapper around setrunelocale() to mark it as deprecatedache2003-07-061-14/+1
| | | | in FreeBSD 6
* Reduce code duplication by separating _PathLocle detection code intophantom2003-06-251-21/+32
| | | | internal helper function.
* Move _PathLocale declaration to more logical place (setlocale.c)phantom2003-06-251-0/+5
|
* Catch up with _PATH_LOCALE move from rune.h to paths.hphantom2003-06-251-1/+1
|
* Back out the `hiding' of strlcpy and strlcat. Several peoplenectar2003-05-011-3/+1
| | | | vocally objected to this safety belt.
* `Hide' strlcpy and strlcat (using the namespace.h / __weak_referencenectar2003-04-291-1/+3
| | | | | | | technique) so that we don't wind up calling into an application's version if the application defines them. Inspired by: qpopper's interfering and buggy version of strlcpy
* Rewrite locale loading procedures, so any load failure will not affectache2002-08-081-19/+18
| | | | | | | | currently cached data. It allows a number of nice things, like: removing fallback code from single locale loading, remove memory leak when LC_CTYPE data loaded again and again, efficient cache use, not only for setlocale(locale1); setlocale(locale1), but for setlocale(locale1); setlocale("C"); setlocale(locale1) too (i.e. data file loaded only once).
* Reject encoding > ENCODING_LEN at early stage instead of truncating it.ache2002-08-051-19/+35
| | | | | Use ptr == NULL instead of !ptr in few places. Move saverr declaration to global section.
* Rewrite loadlocale() to eliminate LOAD_CATEGORY macro to save space.ache2002-08-041-28/+27
|
* Preserve errno in fallback codeache2002-08-031-0/+3
|
* 1) Use errno to indicate faulure reason.ache2002-08-031-44/+89
| | | | | | | | | | 2) Move incomplete check for / in locale name from env section to loadlocale(), add check for "." and ".." too. It allows to check any argument, not env only. 3) Redesing LOAD_CATEGORY macro to eliminate code duplication. 4) Try harder in fallback code: if old locale can't be restored, load "C" locale 5) White space formatting, long lines, etc.
* Sligtly modify previous out-of-bounds fix: just break instead ofache2002-08-021-1/+1
| | | | | return(NULL) for upward compatibility with more LC_* categories may be implemented in future.
* Prevent out of bounds writting for too many slashes case.ache2002-08-021-14/+10
| | | | | | Replace strnpy + ='\0' with strlcpy MFC after: 1 day
* Fix the style of the SCM ID's.obrien2002-03-221-5/+2
| | | | I believe have made all of libc .c's as consistent as possible.
* Remove __P() usage.obrien2002-03-211-2/+2
|
* get __time_load_locale() prototype from include file, rather than declarephantom2002-01-241-3/+2
| | | | own
* Removed duplicate $FreeBSD$.ru2001-03-021-2/+0
|
* Fix setlocale() to conform to the ISO C and POSIX standards.ru2001-03-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The below text is quoted from the latest POSIX draft: : The values of locale categories shall be determined by a precedence : order; the first condition met below determines the value: : : 1. If the LC_ALL environment variable is defined and is not null, : the value of LC_ALL shall be used. : 2. If the LC_* environment variable (LC_COLLATE, LC_CTYPE, LC_MESSAGES, : LC_MONETARY, LC_NUMERIC, LC_TIME) is defined and is not null, the : value of the environment variable shall be used to initialize the : category that corresponds to the environment variable. : 3. If the LANG environment variable is defined and is not null, the : value of the LANG environment variable shall be used. : 4. If the LANG environment variable is not set or is set to the empty : string, the implementation-defined default locale shall be used. The conditions 1 and 2 were interchanged, i.e., LC_* were looked first, then LC_ALL, then LANG (note that LC_ALL and LANG were essentially the same, providing the default, with LC_ALL taking precedence over LANG). Now, LC_ALL and LANG serve the different purposes. LC_ALL overrides any LC_*, and LANG provides the default fallback. Testcase: /usr/bin/env LC_ALL=C LC_TIME=de_DE.ISO_8859-1 /bin/date Should return date in the "C" locale format. Inspired by: date(1) reference page in the Draft
* Make FreeBSD locale support complete: add support for rest locale categoriesphantom2001-02-081-54/+17
| | | | | | | LC_MONETARY, LC_NUMERIC and LC_MESSAGES. Remove stub functions since they don't need anymore. Reviewed by: silence on -i18n
* Disallow '/' characters in LC_* environment variables which mightkris2000-09-081-1/+1
| | | | | | | | | | | | be used to point to a bad locale file. This is only believed to be a minor security risk - the only risk is if some program uses the result of a localized string as a format specifier in a vulnerable function like sprintf(). No such code is believed to exist in the FreeBSD base system, although it is possible that badly written third party code would do that. Submitted by: imp Approved by: ache
* The comparison against 0 should be against LC_ALL. category isn't aimp2000-09-041-1/+1
| | | | | | | boolean and it is LC_ALL that's special. Someone submitted this to me a long time ago, but I can't find the mail now.
* Megre XPG4 code into libcache2000-06-031-14/+2
|
* Fix dead loop if locale contains / and not all categories specifiedache1999-11-091-1/+3
| | | | | PR: 14742 Submitted by: peter@wahoo.com.tw
* $Id$ -> $FreeBSD$peter1999-08-281-2/+2
|
* Basic support for LC_MESSAGESache1998-04-291-12/+11
|
* Add #ifndef __NETBSD_SYSCALLS around calls to issetugid() whichjb1998-01-151-3/+7
| | | | do not exist in NetBSD 1.3.
* Restore PATH_LOCALE functionality using issetugid() call nowache1997-04-071-4/+15
|
* Revert $FreeBSD$ to $Id$peter1997-02-221-2/+2
|
* Move _PathLocale to data-only file, so setrunelocale() not pick upache1997-02-091-2/+0
| | | | | | whole setlocale.c module now. Should go into 2.2
* Do Andrey's homework :) before merging this into 2.2:joerg1997-02-081-0/+2
| | | | | . add idempotency #ifdef . avoid sloppy common-style external declaration.
* Use symbolic constants instead of hardcoded digitsache1997-02-061-27/+17
| | | | | | | | Add range check for setrunelocale since it can be called directly. Remove _startup_setlocale compatibility function Should go into 2.2
* Fix yet another setlocale() bug.pst1997-02-061-1/+1
| | | | Submitted by: Wojtek Pilorz <wpilorz@celebris.bdk.lublin.pl>
* Update the comment why range checking not neededache1997-02-051-1/+1
| | | | | | | Fix setrunelocale fail if called directly without prior setlocale call Should go in 2.2
* Killed getenv of PATH_LOCALE per Andrey's suggestion. It was intendeddg1997-02-051-11/+2
| | | | | for debugging locale stuff, but was rarely if ever used...and of course just bit a big chunk out of our collective hind-ends.
* Add yet one comment saying that range checking already doneache1997-02-031-0/+1
| | | | to stop people "fixing" it by snprintf
* Make the long-awaited change from $Id$ to $FreeBSD$jkh1997-01-141-2/+2
| | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise.
* Add rcsid[]ache1996-11-271-13/+19
| | | | | | Since locale reading code not resistent against stack overflowing or similar intruder attacks, don't allow PATH_LOCALE env variable action for s-bit programs (non-standard locale path setting)
* Add Idache1996-11-261-35/+43
| | | | Optimize/improve recently added locale restoration on failure
* PATH_LOCALE: use this non-standard env variable first time only, i.e.ache1996-11-261-64/+89
| | | | | | | | | | | | | | | | strdup() it to prevent unsetenv() or setenv() effects. Check its length to not allow user to overflow internal locale buffer. Move PATH_LOCALE handling code into one place. POSIX: make better stub for LC_MONETARY & LC_NUMERIC, now it check locale directory existance instead of refusing all non-C non-POSIX locales. POSIX treats empty locale env variable as unset variable while our old code treats it as "C" locale, fix it. Implement previous locale restoring, if locale setting fails. Old code assumes success if some of LC_ALL subset is successed even other fails, POSIX treats it as failure with previous locale restoring, fix it. Remove unneccessary length checking in currentlocale()
* Use fake (empty) startup_setlocale for XPG4ache1995-10-231-3/+3
|
* Migrate from XPG4 to XPG3 (libxpg4 will be added soon)ache1995-10-231-5/+86
| | | | | Remove big part of my startup_setlocale hack. Add missing manpage links.
* As above.phk1995-10-221-0/+2
| | | | Oh I also put in a couple of compile-time warnings for the crypt stuff.
* Fix cut&paste error: LC_COLLATE should be LC_TIMEache1995-08-051-3/+3
|
* Implement locale-sensitive strftime () from ADO (heavily modifiedwollman1995-08-041-1/+8
| | | | | | | | | | by me). This probably loses for multibyte characters, but I have no way of telling. I'll let ache decide whether to add this support to startup_setlocale. Note that for this to make any sense at all, the symlinks in /usr/share/locale must go. (For the moment, this doesn't make any difference since there are no locales supplied.) Obtained from: Arthur David Olson <ado@elsie.nci.nih.gov>
* Add 8-bit collate stuffache1995-02-161-1/+8
| | | | Submitted by: alex@elvisti.kiev.ua
* Make not-so-space-eaten locale version:ache1994-09-241-54/+7
| | | | | split modules to bring only neccessary functions, eliminate sprintf, make reduced startup_locale version.
* BSD 4.4 Lite Lib Sourcesrgrimes1994-05-271-0/+234
OpenPOWER on IntegriCloud