summaryrefslogtreecommitdiffstats
path: root/lib/libc/locale (follow)
Commit message (Collapse)AuthorAgeFilesLines
* snprintf/vsnprintf return < 0 on error, rather than -1.deraadt2019-07-031-2/+2
|
* When system calls indicate an error they return -1, not some arbitraryderaadt2019-06-281-2/+2
| | | | | | value < 0. errno is only updated in this case. Change all (most?) callers of syscalls to follow this better, and let's see if this strictness helps us in the future.
* POSIX.1-2008 TC3 is going to clarify how newlocale(3) uses oldloc.schwarze2019-06-251-3/+4
| | | | | | | | | Explicitly state that our implementation now complies with the stricter requirements of TC3 because the newlocale(3) in old OpenBSD releases only complied with the weaker requirements of the old text of the standard. The complaints from our users resulted in both our implementation and the standard being improved. For details, see: http://austingroupbugs.net/view.php?id=1243#c4347
* Copy categories outside "mask" from "oldloc" to the new locale object.schwarze2019-03-292-19/+31
| | | | | | | | | | | | | | | | While POSIX appears to allow the old behaviour of ignoring "oldloc", Ted and Karl convinced me that is a bug in the spec and the Austin group almost certainly intended to require the new behaviour. Anyway, compatibility strongly suggests the new behaviour because most (or maybe even all?) other systems do not ignore "oldloc", and some software appears to depend on the copying from "oldloc" to the new locale. Issue analyzed and reported by Karl Williamson <public at khwilliamson dot com> with support from the Perl 5 community. This final diff is similar to two earlier diffs from Ted, but handles invalid input in a mode robust way. OK tedu@.
* Improve the description of locale dependency:schwarze2019-01-182-14/+20
| | | | | | | | * mention LC_COLLATE; * clarify that all these functions are infested, including the *_l() versions; * avoid ENVIRONMENT, these functions don't inspect it; * and point to the C library functions that change the locale. OK millert@
* For all functions known to be infected by LC_NUMERIC, add shortschwarze2019-01-161-2/+11
| | | | | | | | CAVEATS pointing to the new CAVEATS section in setlocale(3). Make those in wprintf(3) and wscanf(3) more concise since duplicate information is a bad idea. Incompleteness of information originally pointed out by millert@. OK millert@
* Warn against using any categories but LC_CTYPE in setlocale(3) andschwarze2019-01-131-3/+122
| | | | | | | list many (hopefully the most important) functions affected by the locale, such that the CAVEATS sections in individual manual pages can be kept shorter in the future; basic idea from millert@; feedback and OK jmc@; OK deraadt@.
* mention which locale categories this is related to, and add SEE ALSOschwarze2018-04-041-1/+11
|
* add SEE ALSOschwarze2018-04-041-1/+6
|
* Split the useless localeconv(3) function out of the importantschwarze2018-04-043-145/+195
| | | | | setlocale(3) manual page, such that the latter becomes easier to read. No text change.
* Resolve some code duplication.schwarze2018-03-291-11/+3
| | | | | Minus eight lines of code, no functional change. OK martijn@.
* Fix three bugs in setlocale(3):schwarze2018-03-291-5/+7
| | | | | | | | | | | 1. setlocale(LC_ALL, "A"); setlocale(LC_CTYPE, "T"); setlocale(LC_ALL, NULL); must return "A/T/A/A/A/A", not "A". Fix this by always initializing the LC_ALL entry of newgl to "" in dupgl(). Reported by Karl Williamson <public at khwilliamson dot com> on bugs@, thanks! 2. Do not leak newgl when strdup(3) fails in setlocale(3). 3. For setlocale(LC_ALL, "C/C/fr_FR.UTF-8/C/C/C"); correctly set _GlobalRuneLocale; i found 2. and 3. while looking at the code. Feedback on a buggy earlier version and OK martijn@.
* Rewrite, since Karl Williamson <public at khwilliamson dot com>schwarze2018-03-221-153/+142
| | | | | | | | | | | | | noticed that this was no good. * More relevant one line description. * Generally more precision, less handwaving. * Delete details regarding features we deliberate do not support. * Write a real RETURN VALUES section. * Delete pointless SEE ALSO section. * Add two useful EXAMPLES. * Do not talk about BUGS we don't have because we avoid the facilities. Using several suggestions from martijn@ and one from stsp@, OK jmc@ stsp@ martijn@ on earlier versions.
* pasto in function name in the SYNOPSIS; from semarie@schwarze2017-10-041-3/+3
|
* New POSIX xlocale implementation written from scratch.schwarze2017-09-0534-693/+1739
| | | | | | | | | | | | Complete in the sense that all POSIX *locale(3) and *_l(3) functions are included, but in OpenBSD, we of course only really care about LC_CTYPE and we only support ASCII and UTF-8. With important help from kettenis@, guenther@, and jca@. Repeated testing in ports bulk builds by naddy@. Additional testing by jca@, sebastia@, dcoppa@, and others. OK kettenis@ dcoppa@, and guenther@ on an earlier version. Riding guenther@'s libc/librthread major bump.
* We only support ASCII and UTF-8, so we never need toschwarze2017-08-053-20/+3
| | | | | | change _ctype_, _tolower_tab_, and _toupper_tab_. No functional change. Suggested by and OK kettenis@
* Delete some abstraction that we don't and won't need.schwarze2016-09-057-116/+26
| | | | | | | | | | | | | | | | Declare functions rather than generating declarations with macros. Just call functions rather than mainting function pointer tables. Purge unused arguments. Simplify mbstate_t casting. Garbage collect one empty and one unused function. As a bonus, make mbsinit(3) work at all, it returned garbage in the past due to a missing cast when passing mbstate_t. Apart from that, no functional change. No libc bump needed; only private functions are removed and change prototype and only private structs change size. OK stsp@ mpi@; deraadt@ likes the general direction.
* Make it clear that printable characters of width 0 exist.schwarze2016-09-021-7/+5
| | | | | While here, polish some wording. OK stsp@
* Since we support only one non-ASCII LC_CTYPE locale, we don't needschwarze2016-09-021-55/+15
| | | | | | a linked list to store it. No functional change. OK mpi@ guenther@, and stsp@ agrees too that the time is ripe to start such cleanup
* fix a couple of errors in the page;jmc2016-06-281-4/+4
| | | | | | from henning petersen, netbsd pr lib/51284 ok semarie
* Stop exposing <sys/localedef.h> and various symbols internal to the libcguenther2016-05-239-24/+21
| | | | | | | locale implementation: _{Current,Default}*Locale, __[mn]locale_changed, __mb_len_max_runtime ok millert@ schwarze@ deraadt@
* for some time now mandoc has not required MLINKS to functionjmc2016-03-301-23/+1
| | | | | | | | | | | | correctly - logically complete that now by removing MLINKS from base; authors need only to ensure there is an entry in NAME for any function/ util being added. MLINKS will still work, and remain for perl to ease upgrades; ok nicm (curses) bcook (ssl) ok schwarze, who provided a lot of feedback and assistance ok tb natano jung
* LOCALE_CHARSETS has been unused for some time nowjca2016-03-201-5/+1
| | | | | | so no need to include share/locale/ctype/Makefile.inc to get it. ok guenther@ stsp@ (who had the same diff)
* Fix STANDARDS: use the appropriate .St argument and add the informationschwarze2016-02-271-5/+8
| | | | that setting errno is required by POSIX, but not by ISO C.
* If an incomplete character is passed to mbtowc(3), set errno to EILSEQ.schwarze2016-02-271-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is unambiguously required both by POSIX and by our own manual page. It also makes a lot of sense because having a function that can fail and that sets errno in some failure modes but does not set errno in other failure modes would be a terrible idea. Such a function would be ridiculously complicated to use. To detect the reason for failure, you would have to: - save errno - reset errno to zero - call the function - inspect the return value to detect failure - inspect errno to decide about the reason for failure - if errno is zero, restore the saved errno That is completely unreasonable, in particular for a seemingly innocous function like mbtowc(3). Next to no programmer would get that right in any real-world program. Note that this bug is very widespread, it also affects NetBSD, FreeBSD, Solaris 11, and glibc. I will also send a note around to the other systems. There may be fallout from programs using the interface incorrectly. If you run into any, please report that to me. OK millert@
* Dv fix;jmc2016-02-131-2/+3
|
* Fix an obvious cut-and-paste error:schwarze2016-02-131-4/+3
| | | | | This function doesn't even have an "n" argument, so that non-existent argument clearly cannot restrict the return value.
* Align with reality, and with POSIX: For this particular function,schwarze2016-02-081-7/+3
| | | | | | incomplete characters are not an error, do not throw EILSEQ, and are not supposed to. OK millert@
* avoid an uninitialised value in a return path added in rev 1.5jsg2016-02-051-2/+4
| | | | ok tobias@
* Validate input files to prevent out of boundary accesses.tobias2015-12-061-63/+80
| | | | with input by and ok schwarze@
* Rewrite the mbtowc(3) page for clarity. Explain what needs to be done on error.stsp2015-10-281-42/+54
| | | | | With input from jmc, zhuk, schwarze, and bentley. ok jmc zhuk bentley
* typommcc2015-10-241-3/+3
|
* nl_langinfo(3) conforms to POSIX.bentley2015-10-241-2/+7
| | | | ok jmc@
* Eliminate the last of the LINTEDn and PRINTFLIKEn comments. In oneguenther2015-10-014-18/+7
| | | | | | | case, by deleting some useless '& of an array' we also eliminate the need for the casts which prompted the original lint warnings ok deraadt@
* Prefer Xr over Fn for interpage references and delete reference toguenther2015-09-211-10/+11
| | | | | | setrunelocale() which is not exported from libc ok jmc@ stsp@
* Don't wrap initialized variables: binutils appears to be mishandling themguenther2015-09-191-1/+3
| | | | | | on arm and m88k problems with optind observed by jsg@
* Wrap <langinfo.h> and <regexp.h> so internal calls go direct andguenther2015-09-141-1/+2
| | | | the symbols are weak
* Wrap <locale.h> so internal calls go directguenther2015-09-142-2/+4
|
* Wrap <ctype.h> and <wctype.h> so that calls go direct and the symbols notguenther2015-09-134-17/+26
| | | | | in standard C are all weak. Hide several symbols internal to the implementation
* Wrap <stdlib.h> so that calls go direct and the symbols not in theguenther2015-09-131-3/+3
| | | | | | C standard are all weak. Apply __{BEGIN,END}_HIDDEN_DECLS to gdtoa{,imp}.h, hiding the arch-specific __strtorx, __ULtox_D2A, __strtorQ, __ULtoQ_D2A symbols.
* Wrap <inttypes.h> and finish wrapping of <wchar.h> so that calls go directguenther2015-09-128-8/+22
| | | | and the symbols not in the C standard are weak
* reduce more .Nd to one line and kill more .Tnschwarze2015-09-101-4/+4
|
* restore codeset checking: we shouldn't silency fallback to ASCII codeset.semarie2015-08-231-2/+2
| | | | | | | | | there is a test for "only UTF-8" after, that will return ENOTSUP. So the caller will known the wanted codeset isn't supported. problem spotted by guenther@ OK stsp@ guenther@
* Load LC_MESSAGES locale only if the character encoding is UTF-8.stsp2015-08-141-17/+2
| | | | ok mpi tedu phessler zhuk, and discussed with many at c2k15
* Disable support for loading LC_CTYPE locales other than UTF-8.stsp2015-08-141-2/+5
| | | | ok mpi tedu phessler zhuk, and discussed with many at c2k15
* Mention LC_MESSAGES.zhuk2015-08-121-2/+7
| | | | Input & okay (pre-lock) from jmc@, sobrado@ and stsp@.
* the C locale should contain only ASCIIsemarie2015-07-071-128/+0
| | | | | suggestion for removing (instead of commenting) the lines from stsp@ OK millert@
* There are no ${LIBCSRCDIR}/arch/${MACHINE_CPU}/locale directories insemarie2015-07-031-2/+2
| | | | | | cvs. Remove the unused search path from Makefile.inc "fine with me" stsp@
* remove new_categories variable from global.semarie2015-07-021-16/+10
| | | | | | | | | This variable is used as temporary buffer in order to do checking before copying the content to current_categories variable. Switch it as local variable in setlocale function. Adapts some functions. the commit collapse 3 proposed diffs on tech@, and all OK stsp@
* Remove unused parameter of load_locale_sub(). No assembly change on i386.stsp2015-06-091-4/+4
| | | | Diff from Sebastien Marie. objdump foo help from uwe