Tim J. Robbins
f6b767e33f
Add two additional references to the See Also section, which contain much
...
better descriptions of UTF-8 and related issues.
2002-10-30 11:49:05 +00:00
Tim J. Robbins
a019c0e525
Remove unnecessary inclusion of <rune.h> to make it obvious that this file
...
does not use the deprecated rune system.
2002-10-29 09:03:57 +00:00
Tim J. Robbins
c5929b304e
Handle boundary cases more correctly; mblen(s, 0) and mbtowc(NULL, s, 0)
...
return -1 regardless of what s points to, mbtowc(&w, s, 1) sets w to a
null wide character when s points to a null byte. This seems to be closer
to what most other implementations do, but the C99 standard contradicts
itself for these cases.
2002-10-28 08:24:46 +00:00
Garrett Wollman
688dfe4533
Do not include <sys/syslimits.h> directly; it is not intended for general
...
consumption.
2002-10-27 17:44:33 +00:00
Tim J. Robbins
b6f33850e0
Style sweep.
2002-10-27 10:41:21 +00:00
Tim J. Robbins
583efa1268
Use an internal buffer for the result when the first argument is NULL.
2002-10-25 13:24:45 +00:00
Tim J. Robbins
9acd2d9b3c
Avoid truncating invalid wide characters that are outside the range of
...
'unsigned char'; signal an error instead.
2002-10-16 11:37:38 +00:00
Tim J. Robbins
0b78986fe2
FA, FB and FC are lead bytes according to recent Microsoft documentation.
2002-10-14 01:50:45 +00:00
Tim J. Robbins
d891f26821
Style changes. Mainly removing excessive whitespace and parens.
2002-10-14 01:46:18 +00:00
Andrey A. Chernov
8a093dade3
Cosmetic: use LCMONETARY_SIZE_{FULL,MIN} defines like in other places
2002-10-12 11:31:07 +00:00
Tim J. Robbins
972baa3747
Add a UTF-8 encoding method, which will eventually replace the antique
...
"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.
2002-10-10 22:56:18 +00:00
Tim J. Robbins
f4da1a754d
Add support for the 6 new C99 struct lconv members dealing with formatting
...
international monetary values: int_p_cs_precedes, int_n_cs_precedes,
int_p_sep_by_space, int_n_sep_by_space, int_p_sign_posn, int_n_sign_posn.
This should not break existing binaries or LC_MONETARY data files.
Reviewed by: ache
MFC after: 1 month
2002-10-09 09:19:28 +00:00
Tim J. Robbins
d9e5246b17
Add a note to the Compatiblity section suggesting that these functions
...
only be used for byte values. Add cross-references to the wide-char
counterparts.
2002-10-06 10:15:38 +00:00
Tim J. Robbins
82f520853b
Remove rants/whines about the rune interface being superior to the
...
ISO C interface.
2002-10-06 06:03:23 +00:00
Tim J. Robbins
bc98899df0
Remove a completely incorrect statement from the Return Values section.
...
Add cross-references to the restartable mulitybte functions (mbrlen(3) etc.)
2002-10-06 05:58:24 +00:00
Tim J. Robbins
17f6e5b0e7
Improve three instances of questionable or confusing grammar.
2002-10-03 14:09:06 +00:00
Tim J. Robbins
28ddc4138c
Add an example.
2002-10-03 14:07:26 +00:00
Tim J. Robbins
b06b097805
Document towlower() and towupper() in separate manual pages instead of
...
trying to confusingly document both on the same page. The new manual pages
are based on tolower(3) and toupper(3) instead of the old towlower(3).
2002-10-03 11:23:06 +00:00
Tim J. Robbins
9981ef2702
Point out that although toupper() and tolower() really accept rune_t's
...
and not just unsigned char's, callers should use towupper() and towlower()
instead when working with wide characters if portability is a concern.
2002-10-03 11:14:00 +00:00
Tim J. Robbins
73d6e4a5a2
towlower() appeared twice in the synopsis; one of the occurrences should
...
have been towupper(). Add towupper() to the Name section while I'm at it.
Obtained from: NetBSD (junyoung)
2002-10-03 10:40:01 +00:00
Tim J. Robbins
f2a67ef1bd
Add an Examples section with an example of how to use the functions.
2002-10-03 08:49:29 +00:00
Tim J. Robbins
03ab141313
Warn when setinvalidrune() is referenced for consistency with the rest
...
of the rune functions (except sgetrune() and sputrune(), which are really
macros).
2002-09-24 09:25:37 +00:00
Tim J. Robbins
1302dabd28
Add the remaining C99 wide character string to integer conversion functions.
...
Restrict qualifiers were added to the existing prototypes in <inttypes.h>
and the typedef for wchar_t was removed.
2002-09-22 08:06:45 +00:00
Tim J. Robbins
530bb9225d
Deprecate the rest of the rune interface.
2002-09-18 06:19:12 +00:00
Tim J. Robbins
7948cae0d2
Mark mbmb(), mbrune(), and mbrrune() as deprecated functions. We want to
...
get applications to move to the ISO C interfaces as well as have the
freedom to replace the rune interfaces with ones that support stateful
conversions some time in the future.
2002-09-18 06:11:21 +00:00
Tim J. Robbins
03b716c4bd
Add wcstod() as a wrapper around strtod(). It does not handle any characters
...
that strtod() does not (alternate digit characters, etc. are not handled).
2002-09-15 08:38:51 +00:00
Tim J. Robbins
528bebffb1
Use the heap instead of the stack to store temporary multibyte string
...
buffers; this is slower but safer for threaded programs where threads
often have relatively low stack size limits.
2002-09-15 08:06:17 +00:00
Tim J. Robbins
3a67d8efd0
Correct type of second argument: it is wchar_t ** restrict,
...
not wchar_t * restrict.
2002-09-12 09:25:27 +00:00
Tim J. Robbins
47794211c8
Add an implementation of wcsftime() (wide character version of strftime()).
2002-09-11 08:57:11 +00:00
Tim J. Robbins
5fd1762445
Add wcstol() and wcstoul(), based on strtol() and strtoul().
2002-09-08 13:27:26 +00:00
Tim J. Robbins
58d38e2520
Style: One space between "restrict" qualifier and "*".
2002-09-06 11:24:06 +00:00
Tim J. Robbins
f0c6c306f9
Set errno to EILSEQ when invalid multibyte sequences are detected
...
(XSI extension to 1003.1-2001).
2002-09-03 01:09:47 +00:00
Tim J. Robbins
d384a6795d
Typo: refer to MB_LEN_MAX instead of MB_CHAR_MAX (which does not exist).
2002-09-01 07:21:58 +00:00
Tim J. Robbins
9771f1e24e
Add restrict qualifiers to the arguments of mbstowcs, mbtowc() and
...
wcstombs().
2002-09-01 07:08:22 +00:00
Tim J. Robbins
a5f76f1911
Implement the XSI extension which allows the destination string to be
...
NULL, and returns the number of bytes that would be required to store
the result of the conversion without storing anything.
PR: 17694
2002-08-31 14:16:12 +00:00
Tim J. Robbins
7438fc3aa8
Split ansi.c into a separate source file for each function.
2002-08-31 11:26:55 +00:00
Andrey A. Chernov
c14170612e
Use ntohl() to read cnains number in new format
2002-08-31 01:05:39 +00:00
Andrey A. Chernov
cbc98d0541
Style fix
2002-08-30 20:39:53 +00:00
Andrey A. Chernov
8e52da4dfc
Prepare for switching to unlimited chains format.
...
Optimize chains lookup a bit.
2002-08-30 20:26:02 +00:00
Mike Barcroft
abbd890233
o Merge <machine/ansi.h> and <machine/types.h> into a new header
...
called <machine/_types.h>.
o <machine/ansi.h> will continue to live so it can define MD clock
macros, which are only MD because of gratuitous differences between
architectures.
o Change all headers to make use of this. This mainly involves
changing:
#ifdef _BSD_FOO_T_
typedef _BSD_FOO_T_ foo_t;
#undef _BSD_FOO_T_
#endif
to:
#ifndef _FOO_T_DECLARED
typedef __foo_t foo_t;
#define _FOO_T_DECLARED
#endif
Concept by: bde
Reviewed by: jake, obrien
2002-08-21 16:20:02 +00:00
Tim J. Robbins
7d77551c77
Add a manual page for wcwidth().
2002-08-20 03:42:21 +00:00
Andrey A. Chernov
c1a0a78d00
Remove wcswidth.c from here (and move it to "string")
2002-08-20 01:59:26 +00:00
Andrey A. Chernov
8077fafd28
Remove space at the end of continuation line in prev. commit
2002-08-20 01:16:06 +00:00
Andrey A. Chernov
f999b4ba69
Implement wcswidth()
2002-08-19 20:46:10 +00:00
Andrey A. Chernov
1da6b56aca
Use modern-style arguments declaration
2002-08-19 20:32:27 +00:00
Andrey A. Chernov
853c779d87
Write null wide-character as L'\0' like in other places
2002-08-19 20:12:38 +00:00
Andrey A. Chernov
1e2cd54448
According to SUSv2, always return 0 for null wide-character code
2002-08-19 18:06:18 +00:00
Andrey A. Chernov
9424df445a
Move internal defines from ctype.h here
2002-08-19 09:02:49 +00:00
Tim J. Robbins
e92a3d83fc
Implement the ISO C90 Amd.1 restartable wide and multibyte character
...
manipulation functions mbrlen(), mbrtowc(), mbsinit(), mbsrtowcs(),
wcrtomb(), wcsrtombs().
2002-08-18 06:30:10 +00:00
Andrey A. Chernov
d8d0cebecd
Move wcwidth() to separate file, it doesn't belong to iswctype.c at all
2002-08-17 20:30:34 +00:00
Andrey A. Chernov
1c15ec1eab
According to SUSv2, wcwidth() should return -1 for non-printing characters
2002-08-17 20:11:31 +00:00
Andrey A. Chernov
88c669d2ea
Cosmetic - remove unneded brackets and #undef
2002-08-17 20:03:44 +00:00
Andrey A. Chernov
c87e6b26b0
wcwidth: fix espression to work correctly with SWIDTH0
2002-08-17 14:16:14 +00:00
Michael C . Wu
dff784192b
Add iswctype wcwidth function code
...
Submitted by: clkao@clkao.org
Reviewed by: keichii
Obtained from: NetBSD
MFC after: 1 month
2002-08-16 13:45:23 +00:00
Andrey A. Chernov
a2a26d0a3d
Reduce BSS size for programs which not load collate by eliminating
...
static buffer.
2002-08-13 14:55:17 +00:00
Andrey A. Chernov
e34fe8a408
Now malloc() is fixed, remove errno hardcoding to ENOMEM
2002-08-12 17:14:04 +00:00
Andrey A. Chernov
ec5ca2eba7
Add safeguards to never use errno == 0 as setrunelocale() error return code
2002-08-09 08:22:29 +00:00
Andrey A. Chernov
76692b8025
Rewrite locale loading procedures, so any load failure will not affect
...
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).
2002-08-08 05:51:54 +00:00
Andrey A. Chernov
57473ad215
Reset __mb_cur_max to 1 when "C" or "POSIX" locales loaded after multibyte one
2002-08-07 20:49:25 +00:00
Andrey A. Chernov
45206d5c69
Fix wrong address when EucInfo > "variable" size
2002-08-07 20:20:56 +00:00
Andrey A. Chernov
6892b144e8
Style fixes in preparation for rewritting
2002-08-07 18:02:45 +00:00
Andrey A. Chernov
ecc4c62066
Style fixes in preparation of code rewritting
2002-08-07 16:45:23 +00:00
Tim J. Robbins
71a63bac1b
Build iswctype.c and manual pages for the functions it defines.
2002-08-06 00:49:59 +00:00
Tim J. Robbins
677adc79c2
Add missing prototypes for extension functions to the SYNOPSIS.
2002-08-05 11:02:04 +00:00
Tim J. Robbins
21b7821a9e
Use In macro instead of Fd. Add crossref to wctype(3). Refer to 1003.1-2001
...
in STANDARDS section. Document functions which are extensions to the standard.
2002-08-05 10:50:39 +00:00
Tim J. Robbins
15c57797bb
Use the In macro instead of Fd. Add crossref to wctrans(3). Refer to
...
1003.1-2001 in STANDARDS section.
2002-08-05 10:48:05 +00:00
Tim J. Robbins
6b44a04d1c
Implement the missing <wctype.h> functions: isw*() (iswalnum() etc.),
...
towlower() and towupper() required by ISO C90 Amd. 1.
iswascii(), iswhexnumber(), iswideogram(), iswnumber(), iswphonogram(),
iswrune() and iswspecial() have also been implemented for consistency
with the BSD extensions in <ctype.h>.
2002-08-05 10:45:23 +00:00
Andrey A. Chernov
3a317a1229
Reject encoding > ENCODING_LEN at early stage instead of truncating it.
...
Use ptr == NULL instead of !ptr in few places.
Move saverr declaration to global section.
2002-08-05 09:58:45 +00:00
Tim J. Robbins
008a2c53ce
Manual pages for wide character classification (isw*) and case conversion
...
(tow*) functions from NetBSD, unmodified except for the addition of $FreeBSD$.
Obtained from: NetBSD
2002-08-05 08:04:58 +00:00
Tim J. Robbins
4bd5585fbd
Change wctype_t to an unsigned type to avoid warnings.
2002-08-04 12:43:53 +00:00
Tim J. Robbins
4645079944
Add the ISO C90 Amd. 1 wctrans(3) and towctrans(3) functions.
2002-08-04 12:09:08 +00:00
Tim J. Robbins
92ece88d16
Add btowc(3) to SEE ALSO section.
2002-08-04 11:02:21 +00:00
Andrey A. Chernov
f75bb0aa25
Use errno to indicate failure reason.
...
Remove incomplete checks for 'name' and 'PatchLocale', they must be
already checked at this point.
2002-08-04 09:37:28 +00:00
Bruce Evans
1a2140f531
Fixed some style bugs (unsorting of MLINKS, and more than 1 assignment to
...
MAN per section).
2002-08-04 07:54:41 +00:00
Andrey A. Chernov
10bc1114ce
Rewrite loadlocale() to eliminate LOAD_CATEGORY macro to save space.
2002-08-04 04:29:54 +00:00
Andrey A. Chernov
9bb322433e
Add ERRORS section according to POSIX (no errors)
2002-08-03 17:20:45 +00:00
Andrey A. Chernov
2f6754febb
Catch empty encoding name too
2002-08-03 17:09:21 +00:00
Andrey A. Chernov
40b97dcb2a
Fix return codes to match what setrunelocale() returns
2002-08-03 16:26:47 +00:00
Andrey A. Chernov
5740f28044
Preserve errno in fallback code
2002-08-03 15:56:25 +00:00
Tim J. Robbins
e9fb70115f
Add ISO C90 Amd. 1 btowc(3) and wctob(3) functions.
2002-08-03 13:49:55 +00:00
Tim J. Robbins
196099d661
Correct use of Nm macro in NAME section and a broken cross reference.
2002-08-03 12:39:41 +00:00
Andrey A. Chernov
710d708144
Return errno provided by fopen, not always ENOENT.
...
Return EFTYPE instead of EINVAL for wrong locale file format.
Whitespaces.
2002-08-03 11:55:19 +00:00
Andrey A. Chernov
256ddd5999
Check encoding for ".", ".." and / inside
2002-08-03 10:23:06 +00:00
Andrey A. Chernov
5568219d15
Return EINVAL for NULL or too long encoding, not EFAULT
2002-08-03 09:10:31 +00:00
Andrey A. Chernov
83c9580dbb
Return ENAMETOOLONG for long PATH_LOCALE, not EFAULT
2002-08-03 09:07:27 +00:00
Andrey A. Chernov
a17eafe2a8
1) Use errno to indicate faulure reason.
...
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.
2002-08-03 09:04:44 +00:00
Tim J. Robbins
5b32667c57
Add ISO C90 Amd. 1 wctype(3) and iswctype(3) functions.
2002-08-03 04:18:40 +00:00
Andrey A. Chernov
4e7b46d8e2
Sligtly modify previous out-of-bounds fix: just break instead of
...
return(NULL) for upward compatibility with more LC_* categories may be
implemented in future.
2002-08-02 13:36:54 +00:00
Andrey A. Chernov
ef1e7a2656
Prevent out of bounds writting for too many slashes case.
...
Replace strnpy + ='\0' with strlcpy
MFC after: 1 day
2002-08-02 01:04:49 +00:00
Jeroen Ruigrok van der Werven
eb12e52a25
Remove the hard-coded limit of 3 bytes for EUC encodings.
...
Satoshi NIIMI-san kindly explained that EUC does not limit the byte length to
any arbitrary number.
We now set the limit to the maximum octet length of the codeset and it is
locale-specific.
Submitted by: Yong-Jhen Hong <winard@ms11.url.com.tw>
2002-04-14 10:55:42 +00:00
Dag-Erling Smørgrav
0b759b867a
Install digittoint.3 (forgotten in rev 1.21)
...
PR: docs/26451
Submitted by: Adrian Filipi-Martin <adrian@ubergeeks.com>
2002-04-13 22:32:33 +00:00
Dima Dorfman
62538f5a03
This was recently MFC'd, so it will appear in 4.6.
...
PR: 37018
2002-04-13 04:25:56 +00:00
Jeroen Ruigrok van der Werven
a243e676fe
Fix EUC encoding conversion for codeset 3 and 4 to comply to the specification.
...
PR: 28552
Submitted by: NIIMI Satoshi <sa2c@and.or.jp>
2002-04-07 16:37:15 +00:00
Mark Murray
4cd0119367
Do not use __progname directly (except in [gs]etprogname(3)).
...
Also, make an internal _getprogname() that is used only inside
libc. For libc, getprogname(3) is a weak symbol in case a
function of the same name is defined in userland.
2002-03-29 22:43:43 +00:00
David E. O'Brien
333fc21e3c
Fix the style of the SCM ID's.
...
I believe have made all of libc .c's as consistent as possible.
2002-03-22 21:53:29 +00:00
David E. O'Brien
c05ac53b8b
Remove __P() usage.
2002-03-21 22:49:10 +00:00
Ruslan Ermilov
c8c5079d10
mdoc(7) police: tidy up.
2002-03-18 15:44:27 +00:00
Ruslan Ermilov
dab055db89
bde got caught by mdoc(7) police. :-)
2002-03-15 17:53:20 +00:00
Ruslan Ermilov
9a04350e3d
mdoc(7) police: don't you notice the warnings?
2002-03-15 17:50:21 +00:00
Mike Barcroft
fd8e4ebc8c
o Move NTOHL() and associated macros into <sys/param.h>. These are
...
deprecated in favor of the POSIX-defined lowercase variants.
o Change all occurrences of NTOHL() and associated marcros in the
source tree to use the lowercase function variants.
o Add missing license bits to sparc64's <machine/endian.h>.
Approved by: jake
o Clean up <machine/endian.h> files.
o Remove unused __uint16_swap_uint32() from i386's <machine/endian.h>.
o Remove prototypes for non-existent bswapXX() functions.
o Include <machine/endian.h> in <arpa/inet.h> to define the
POSIX-required ntohl() family of functions.
o Do similar things to expose the ntohl() family in libstand, <netinet/in.h>,
and <sys/param.h>.
o Prepend underscores to the ntohl() family to help deal with
complexities associated with having MD (asm and inline) versions, and
having to prevent exposure of these functions in other headers that
happen to make use of endian-specific defines.
o Create weak aliases to the canonical function name to help deal with
third-party software forgetting to include an appropriate header.
o Remove some now unneeded pollution from <sys/types.h>.
o Add missing <arpa/inet.h> includes in userland.
Tested on: alpha, i386
Reviewed by: bde, jake, tmm
2002-02-18 20:35:27 +00:00