summaryrefslogtreecommitdiffstats
path: root/lib/libc/locale/setrunelocale.c
Commit message (Collapse)AuthorAgeFilesLines
* Introduce new encoding: "ASCII"ache2008-01-211-0/+2
| | | | | It differs from default C/POSIX "NONE" mainly by stricter 8bit check for mb*towc*/wc*tomb* family, returning EILSEQ
* The problem is: currently our single byte ctype(3) functions are brokenache2007-10-131-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | for wide characters locales in the argument range >= 0x80 - they may return false positives. Example 1: for UTF-8 locale we currently have: iswspace(0xA0)==1 and isspace(0xA0)==1 (because iswspace() and isspace() are the same code) but must have iswspace(0xA0)==1 and isspace(0xA0)==0 (because there is no such character and all others in the range 0x80..0xff for the UTF-8 locale, it keeps ASCII only in the single byte range because our internal wchar_t representation for UTF-8 is UCS-4). Example 2: for all wide character locales isalpha(arg) when arg > 0xFF may return false positives (must be 0). (because iswalpha() and isalpha() are the same code) This change address this issue separating single byte and wide ctype and also fix iswascii() (currently iswascii() is broken for arguments > 0xFF). This change is 100% binary compatible with old binaries. Reviewied by: i18n@
* Per Regents of the University of Calfornia letter, remove advertisingimp2007-01-091-4/+0
| | | | | | clause. # If I've done so improperly on a file, please let me know.
* . Static'ize functions exported via function reference variables only.phantom2005-02-271-15/+1
| | | | | | | | | | | | . Replace inclusion of sys/param.h to sys/cdefs.h and sys/types.h where appropriate. . move _*_init() prototypes to mblocal.h, and remove these prototypes from .c files . use _none_init() in __setrunelocale() instead of duplicating code . move __mb* variables from table.c to none.c allowing us to not to export _none_*() externs, and appropriately remove them from mblocal.h Ok'ed by: tjr
* Remove setrunelocale()ache2004-10-181-23/+0
|
* Remove the obsolete <rune.h> interface.tjr2004-10-171-3/+3
|
* Remove support for the obsolete UTF2 encoding.tjr2004-10-171-3/+0
|
* Change "deprecated" in link-time warnings about various rune functionstjr2004-08-211-1/+1
| | | | to "obsolete".
* Implement the GNU extensions of mbsnrtowcs() and wcsnrtombs(). These aretjr2004-07-211-12/+13
| | | | | | | convenient when the source string isn't null-terminated. Implement the other conversion functions (mbstowcs(), mbsrtowcs(), wcstombs(), wcsrtombs()) in terms of these new functions.
* Prefix the names of members of _RuneLocale and its sub-structurestjr2004-06-231-13/+13
| | | | | | with ``__'' to avoid polluting the namespace. This doesn't change the documented rune interface at all, but breaks applications that accessed _RuneLocale directly.
* Allow encoding modules to override the default implementations oftjr2004-05-131-3/+15
| | | | | mbsrtowcs() and wcsrtombs(). Provide a fast implementation for the trivial "NONE" encoding.
* Move prototypes of various encoding-related functions into a new headertjr2004-05-121-12/+1
| | | | file to avoid extern'ing them all over the place.
* Allow partial multibyte characters to accumulate in conversion statetjr2004-04-071-0/+7
| | | | | objects passed to mbrtowc(), mbsrtowcs(), and mbrlen(), as required by C99.
* Remove support for emulating mbrtowc() and wcrtomb() in terms of thetjr2004-04-041-6/+2
| | | | old rune interface now that it is no longer needed.
* Set __mbrtowc and __wcrtomb correctly when changing to the C/POSIX locale.tjr2003-12-081-0/+14
| | | | | | | Save __mbrtowc and __wcrtomb and restore them when changing back to the cached locale. Reported by: perky
* Add gb2312 encoding.davidxu2003-11-051-0/+3
|
* Allow mbrtowc() and wcrtomb() to be implemented directly, instead oftjr2003-11-011-0/+15
| | | | | | | | | | | | | | | | | as wrappers around the deprecated 4.4BSD rune functions. This paves the way for state-dependent encodings, which the rune API does not support. - Add __emulated_sgetrune() and __emulated_sputrune(), which are implementations of sgetrune() and sputrune() in terms of mbrtowc() and wcrtomb(). - Rename the old rune-wrapper mbrtowc() and wcrtomb() functions to __emulated_mbrtowc() and __emulated_wcrtomb(). - Add __mbrtowc and __wcrtomb function pointers, which point to the current locale's conversion functions, or the __emulated versions. - Implement mbrtowc() and wcrtomb() as calls to these function pointers. - Make the "NONE" encoding implement mbrtowc() and wcrtomb() directly. All of this emulation mess will be removed, together with rune support, in FreeBSD 6.
* Add support for gb18030 encodingache2003-07-291-0/+3
| | | | | PR: 51729 Submitted by: Kang Liu <liukang@bjpu.edu.cn>
* Add const to __setrunelocale prototypeache2003-07-061-4/+4
|
* Reorganize wrapper around setrunelocale() to mark it as deprecatedache2003-07-061-11/+39
| | | | in FreeBSD 6
* Reduce code duplication by separating _PathLocle detection code intophantom2003-06-251-16/+3
| | | | internal helper function.
* Add GBK encodingache2003-06-011-1/+4
| | | | | PR: 51504 Submitted by: Statue <statue@freebsd.sinica.edu.tw>
* Add a UTF-8 encoding method, which will eventually replace the antiquetjr2002-10-101-0/+3
| | | | | | | "UTF2" method. Although UTF-8 and the old UTF2 encoding are compatible for 16-bit characters, the new UTF-8 implementation is much more strict about rejecting malformed input and also handles the full 31 bit range of characters.
* Add safeguards to never use errno == 0 as setrunelocale() error return codeache2002-08-091-3/+3
|
* Rewrite locale loading procedures, so any load failure will not affectache2002-08-081-21/+50
| | | | | | | | 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).
* Reset __mb_cur_max to 1 when "C" or "POSIX" locales loaded after multibyte oneache2002-08-071-0/+1
|
* Catch empty encoding name tooache2002-08-031-1/+1
|
* Return errno provided by fopen, not always ENOENT.ache2002-08-031-10/+10
| | | | | Return EFTYPE instead of EINVAL for wrong locale file format. Whitespaces.
* Check encoding for ".", ".." and / insideache2002-08-031-1/+5
|
* Return EINVAL for NULL or too long encoding, not EFAULTache2002-08-031-1/+1
|
* Return ENAMETOOLONG for long PATH_LOCALE, not EFAULTache2002-08-031-1/+1
|
* Fix the style of the SCM ID's.obrien2002-03-221-2/+3
| | | | I believe have made all of libc .c's as consistent as possible.
* Remove __P() usage.obrien2002-03-211-6/+6
|
* Megre XPG4 code into libcache2000-06-031-23/+4
|
* I have added the support for BIG5 encoding into libc/libxpg4/mklocale.phk1998-08-151-0/+3
| | | | | | | | | | | the diff is attached below. This is done on the 3.0 source-tree. I have test this on 2.2-stable before, but I don't have a 3.0 machine right now. This patch is mainly to make libc support BIG5 encoding, thus add zh_TW.BIG5 locale to 3.0. Submitted by: Chen Hsiung Chan <frankch@waru.life.nthu.edu.tw>
* Add #ifndef __NETBSD_SYSCALLS around calls to issetugid() whichjb1998-01-151-1/+5
| | | | do not exist in NetBSD 1.3.
* Move MSKanji under XPG4 defineache1997-09-251-8/+8
|
* Submitted by: Sin'ichiro MIYATANI / Phase One, Inc <siu@phaseone.co.jp>julian1997-09-241-0/+3
| | | | | Basic support for the Shift JIS encoding of japanese. (and one tiny typo fixed in a comment)
* Restore PATH_LOCALE functionality using issetugid() call nowache1997-04-071-2/+14
|
* Use symbolic constants instead of hardcoded digitsache1997-02-061-4/+3
| | | | | | | | Add range check for setrunelocale since it can be called directly. Remove _startup_setlocale compatibility function Should go into 2.2
* Update the comment why range checking not neededache1997-02-051-2/+2
| | | | | | | Fix setrunelocale fail if called directly without prior setlocale call Should go in 2.2
* Add comment that range checking is already done at upper levelache1996-12-281-0/+1
| | | | | | Kill snprintf left in collate.c from previous backout Should go in 2.2
* Back out rev 1.5: the overflow condition is already handled elsewhere.joerg1996-12-221-2/+4
|
* Fix yet another buffer overflow. :-(joerg1996-12-161-4/+2
| | | | | | | | Vulnerable: all programs that use setlocale(LC_COLLATE), setlocale(LC_CTYPE), or setlocale(LC_ALL). The only setuid/setgid binary i've found for this is w(1). Should go into 2.2.
* PATH_LOCALE: use this non-standard env variable first time only, i.e.ache1996-11-261-4/+3
| | | | | | | | | | | | | | | | 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()
* Move more stuff out to XPG4ache1995-11-031-0/+1
| | | | Handle negative chars inside runetype/tolower/toupper
* Treat empty encoding as "C" encodingache1995-10-231-1/+1
|
* Migrate from XPG4 to XPG3 (libxpg4 will be added soon)ache1995-10-231-0/+118
Remove big part of my startup_setlocale hack. Add missing manpage links.
OpenPOWER on IntegriCloud