Commit Graph

635 Commits

Author SHA1 Message Date
Andrey A. Chernov
5ebf111155 Better fix for longstanding segfault. Don't touch current locale at all
on unknown encoding. Previous fix resets it to POSIX.
2008-01-23 02:17:27 +00:00
Andrey A. Chernov
5776848851 1) Add (void) cast to _none_init() (while I am here)
2) Fix longstanding segfault in mb/wc code when unknown encoding is specified
in the locale file (mb/wc functions becomes NULL in that case).
2008-01-23 01:57:26 +00:00
Andrey A. Chernov
91e0bf6a77 Introduce new encoding: "ASCII"
It differs from default C/POSIX "NONE" mainly by stricter 8bit check
for mb*towc*/wc*tomb* family, returning EILSEQ
2008-01-21 23:48:12 +00:00
Alexey Zelkin
2992b5e82c Remove 3rd clause of license
Per request of: glenn halperin at symbian.com
2007-12-12 07:43:23 +00:00
Rong-En Fan
a964324e72 - Include runetype.h for _RuneLocale_ 2007-11-07 14:45:48 +00:00
Andrey A. Chernov
7f5004e7ba Back out 2nd part of wrong iswascii() change in prev. commit. 2007-10-23 17:39:28 +00:00
Andrey A. Chernov
4932c895e7 Add comment explaining __mb_sb_limit trick here. 2007-10-15 09:51:30 +00:00
Andrey A. Chernov
367ed4e13d The problem is: currently our single byte ctype(3) functions are broken
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@
2007-10-13 16:28:22 +00:00
Gabor Kovesdan
b9d8f1d9c7 - Fix typo
Approved by:	keramida (mentor)
MFC after:	3 days
2007-05-04 16:01:07 +00:00
Daniel Eischen
5f864214bb Use C comments since we now preprocess these files with CPP. 2007-04-29 14:05:22 +00:00
Warner Losh
c879ae3536 Per Regents of the University of Calfornia letter, remove advertising
clause.

# If I've done so improperly on a file, please let me know.
2007-01-09 00:28:16 +00:00
Ruslan Ermilov
9a29fb3baf Add missing comma. 2006-10-13 16:11:12 +00:00
Tom Rhodes
639dab2286 Fix a bug where, for 6-byte sequences, the top 6 bits get compared to
111111 rather than the top 7 bits being compared against 1111110 causing
illegal bytes fe and ff being treated the same as legal bytes fc and fd.
2006-03-30 09:04:12 +00:00
Daniel Eischen
4c6aab055d Add __collate_load_error and __collate_range_cmp to the list of
FBSDprivate locale symbols.  These functions are needed by
libcompat.

Add _cleanup to the list of stdio FBSDprivate symbols.  Some
third party applications use this.  This will be removed and
replaced by fcloseall() once libc version is bumped.

Add _res to the list of resolv symbols.

Found by:	portbuilder runs (thanks Kris!)
2006-03-30 04:37:08 +00:00
Daniel Eischen
6fad3aaf15 Add each directory's symbol map file to SYM_MAPS. 2006-03-13 01:15:01 +00:00
Daniel Eischen
cce72e8860 Add symbol maps and initial symbol version definitions to libc.
Reviewed by:	davidxu
2006-03-13 00:53:21 +00:00
Ruslan Ermilov
110e1704d3 -mdoc sweep. 2005-11-17 13:00:00 +00:00
Stefan Farfeleder
613100918d Include a couple of headers to ensure consistency between the prototype and
the function definition.
2005-09-12 19:52:42 +00:00
Tim J. Robbins
d2a57b3026 Add HISTORY section. 2005-07-21 10:53:27 +00:00
Tim J. Robbins
9376b9d71a Add cross-reference to nextwctype(3). 2005-07-21 10:32:17 +00:00
Tim J. Robbins
5a94ee1180 Add COMPATIBILITY and HISTORY sections. Fix typo. 2005-07-21 10:27:45 +00:00
Tim J. Robbins
a385e04b47 Remove confusing "single C char locales" phrase; arguments to these
functions and must now be either an unsigned char or EOF, regardless of
locale.
2005-07-17 04:11:06 +00:00
Tim J. Robbins
5b86168f54 Remove confusing "single C char locales" phrase; arguments to tolower()
and toupper() must now be either an unsigned char or EOF, regardless of
locale.
2005-07-17 03:37:00 +00:00
Ruslan Ermilov
228f8c4f8b Make <runefile.h> internal to libc.
Suggested by:	phantom
2005-05-16 09:32:41 +00:00
Ruslan Ermilov
edc431123e Make the format of LC_COLLATE files architecture independent. 2005-02-27 20:31:13 +00:00
Alexey Zelkin
e94c6cb4a2 . Static'ize functions exported via function reference variables only.
. 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
2005-02-27 15:11:09 +00:00
Alexey Zelkin
f9b5e461bb ANSI'fy prototypes 2005-02-27 14:54:23 +00:00
Ruslan Ermilov
3fb3a43079 Make the format of LC_CTYPE files architecture independent by
introducing the disk formats for _RuneLocale and friends.

The disk formats do not have (useless) pointers and have 32-bit
quantities instead of rune_t and long.  (htonl(3) only works
with 32-bit quantities, so there's no loss).

Bootstrap mklocale(1) when necessary.  (Bootstrapping from 4.x
would be trivial (verified), but we no longer provide pre-5.3
source upgrades and this is the first commit to actually break
it.)
2005-02-26 21:47:54 +00:00
Stefan Farfeleder
610b5a1fb1 Fix comparisons that test if an unsigned value is < 0.
Reviewed by:	tjr
2005-02-12 08:45:12 +00:00
Ruslan Ermilov
24a0682c64 Sort sections. 2005-01-20 09:17:07 +00:00
Ruslan Ermilov
e8fbc77632 Markup style. 2005-01-15 11:22:13 +00:00
Ruslan Ermilov
2d82ac3110 Scheduled mdoc(7) sweep. 2005-01-11 20:50:51 +00:00
Tim J. Robbins
17ebe40096 Implement rpmatch(), a semi-standard interface (as found on AIX, Tru64,
GNU) for determining whether a string is an affirmative or negative
response to a question according to the current locale. This is done
by matching the response against nl_langinfo(3) items YESEXPR and NOEXPR.
2005-01-09 03:55:13 +00:00
Andrey A. Chernov
27ecbe8a77 Remove setrunelocale() 2004-10-18 02:06:18 +00:00
Tim J. Robbins
31d330fb2a Remove the obsolete <rune.h> interface. 2004-10-17 06:51:50 +00:00
Tim J. Robbins
79a3948997 Remove support for the obsolete UTF2 encoding. 2004-10-17 02:29:15 +00:00
Stefan Farfeleder
e60b9f5130 Prefer C99's __func__ over GCC's __FUNCTION__. 2004-09-22 16:56:49 +00:00
Tim J. Robbins
8d2a49a247 Re-word warning about the UTF2 encoding, taking care to use the word
"obsolete" instead of "deprecated".
2004-08-21 08:08:29 +00:00
Tim J. Robbins
4740653c84 Bump document date for previous. 2004-08-21 08:03:18 +00:00
Tim J. Robbins
6a4d3d68c7 Re-word warning about the rune interface, taking care to use the word
"obsolete" instead of "deprecated".
2004-08-21 08:00:31 +00:00
Tim J. Robbins
5a52f3c22c Change "deprecated" in link-time warnings about various rune functions
to "obsolete".
2004-08-21 07:48:06 +00:00
Tim J. Robbins
b9b90a1312 Re-word compatibility section, taking care to use the word "obsolete" to
describe the 4.4BSD extension of accepting characters (runes) outside of
the range of unsigned char.
2004-08-21 07:37:08 +00:00
Tom Rhodes
1bdc6fddbf /me kicks cvs update
Revert previous commit, tjr already fixed it and I was too stupid to
notice this fact.

Approved by:	re (to avoid failing cvs ci)
2004-08-17 04:56:03 +00:00
Tom Rhodes
daa790840c Fix incorrect code in an example. The previous example would produce
19 column positions wide in the first line and 20 in the rest of the lines.
This fixes the example to provide the correct output.

PR:		53454
Noticed by:	Kuang-che Wu <kcwu@kcwu.homeip.net>
Submitted by:	Marc Silver <marcs@draenor.org>
Approved by:	re (scottl)
2004-08-17 04:45:52 +00:00
Tim J. Robbins
5349fd7f49 Fix example. 2004-08-12 12:32:14 +00:00
Tim J. Robbins
de6c9c9d5b Implement wcwidth() as an inline function. 2004-08-12 12:19:11 +00:00
Tim J. Robbins
0db74aa4a9 Re-word the COMPATIBILITY section, taking care to use the word "deprecated"
to describe the 4.4BSD extension of accepting arguments outside the range
of unsigned char. This gives us freedom to remove this extension when we
remove the <rune.h> interface in FreeBSD 6.
2004-07-29 23:32:41 +00:00
Tim J. Robbins
a351559479 Remove unnecessary #include directives. 2004-07-29 06:18:40 +00:00
Tim J. Robbins
a0998ce663 Prefer <runetype.h> to <rune.h>, since the latter is going away soon. 2004-07-29 06:16:19 +00:00
Tim J. Robbins
e214931fbf Remove useless checks for characters longer than INT_MAX bytes. 2004-07-29 06:08:31 +00:00
Tim J. Robbins
ea9a9a377b Add UTF-8-specific implementations of mbsnrtowcs() and wcsnrtombs().
These convert plain ASCII characters in-line, making them only slightly
slower than the single-byte ("NONE" encoding) version when processing
ASCII strings.
2004-07-27 06:29:48 +00:00
Tim J. Robbins
6740cd8374 Return the correct value when dst == NULL and conversion has stopped after
nwc dropping to zero.
2004-07-22 02:57:29 +00:00
Tim J. Robbins
1949a3470f Implement the GNU extensions of mbsnrtowcs() and wcsnrtombs(). These are
convenient when the source string isn't null-terminated.

Implement the other conversion functions (mbstowcs(), mbsrtowcs(), wcstombs(),
wcsrtombs()) in terms of these new functions.
2004-07-21 10:54:57 +00:00
Tim J. Robbins
550473de5b Add fast paths for conversion of plain ASCII characters. 2004-07-09 15:46:06 +00:00
Tim J. Robbins
ee446de0b1 Add a function to iterate over all characters in a particular character
class. This is necessary in order to implement tr(1) efficiently in
multibyte locales, since the brute force method of finding all characters
in a class is infeasible with a 32-bit (or wider) wchar_t.
2004-07-08 06:43:37 +00:00
Ruslan Ermilov
b9384efc1c Markup nits. 2004-07-05 06:39:03 +00:00
Ruslan Ermilov
1c85060a13 Sort SEE ALSO references (in dictionary order, ignoring case). 2004-07-04 20:55:50 +00:00
Ruslan Ermilov
1a0a934547 Mechanically kill hard sentence breaks. 2004-07-02 23:52:20 +00:00
Ruslan Ermilov
d37ea99837 Removed trailing whitespace. 2004-07-02 19:07:33 +00:00
Ruslan Ermilov
33992dc0ed Markup, grammar, and spelling fixes. 2004-06-30 20:09:10 +00:00
Ruslan Ermilov
bd486f888e Fixed a typo. 2004-06-30 19:32:41 +00:00
Tim J. Robbins
ddc1eded85 Prefix the names of members of _RuneLocale and its sub-structures
with ``__'' to avoid polluting the namespace. This doesn't change the
documented rune interface at all, but breaks applications that accessed
_RuneLocale directly.
2004-06-23 07:01:44 +00:00
Mike Pritchard
c20133b039 Spelling fixes. 2004-06-21 19:54:56 +00:00
Tim J. Robbins
c05bd9ae25 Buffer partial wide characters more efficiently: instead of storing the
multibyte representation in conversion state objects, store the
accumulated wide character, set number and number of bytes remaining
to avoid having to derive them every time mbrtowc() is called.
2004-05-27 10:54:34 +00:00
Tim J. Robbins
18b2031298 Scan the source string for invalid wide characters in wcsrtombs()
in the dst == NULL case.
2004-05-25 10:45:24 +00:00
Tim J. Robbins
675e7ddbee Grab all the information we need about a character with one call to
__maskrune() instead of one direct call and one through iswprint().
2004-05-23 13:20:09 +00:00
Tim J. Robbins
5e44d7ebe1 Use conversion state objects to store the accumulated wide character,
low bound, and the number of bytes remaining instead of storing the
raw byte sequence and deriving them every time mbrtowc() is called.
This is much faster -- about twice as fast in some crude benchmarks.
2004-05-17 12:32:40 +00:00
Tim J. Robbins
6107476759 Use a simpler and faster buffering scheme for partial multibyte characters. 2004-05-17 11:16:14 +00:00
Tim J. Robbins
b666b593eb Use a simpler, faster buffering scheme for partial characters in mbrtowc(). 2004-05-14 15:40:47 +00:00
Tim J. Robbins
ea4ac135ff Allow encoding modules to override the default implementations of
mbsrtowcs() and wcsrtombs(). Provide a fast implementation for the
trivial "NONE" encoding.
2004-05-13 11:20:27 +00:00
Tim J. Robbins
f789f94dbb Fix braino in previous: check that the second byte in the character
buffer is non-null when the character is two bytes long, not when
the buffer is two bytes long.
2004-05-13 03:08:28 +00:00
Tim J. Robbins
6155c34adf Reduce overhead by calling internal versions of the multibyte conversion
functions directly wherever possible.
2004-05-12 14:26:54 +00:00
Tim J. Robbins
2051a8f2d5 Move prototypes of various encoding-related functions into a new header
file to avoid extern'ing them all over the place.
2004-05-12 14:09:04 +00:00
Tim J. Robbins
88af941a73 In the absence of proper validation, at least check that null bytes
do not appear as anything but the first byte of a multibyte character.
2004-05-11 14:08:22 +00:00
Tim J. Robbins
45a11576f3 Use a binary search to find the range containing a character in
RuneRange arrays. This is much faster when there are hundreds of
ranges (as is the case in UTF-8 locales) and was inspired by a
similar change made by Apple in Darwin.
2004-05-09 13:04:49 +00:00
Andrey A. Chernov
28aec5a68c Rewrite split_lines() to operate safely
PR:             62694
Submitted by:   moulin p <moulin.p@calyopea.com>
2004-04-25 19:56:50 +00:00
Tim J. Robbins
fc813796d2 Perform some basic validation of multibyte conversion state objects. 2004-04-12 13:09:18 +00:00
Tim J. Robbins
c282a0a1ed Remove a nonsensical remark about byte order markers in UTF-8 streams. 2004-04-12 12:58:41 +00:00
Tim J. Robbins
78c4a3f225 Document the meaning of the zero return value. 2004-04-11 05:19:19 +00:00
David Xu
6464650388 Fix a typo. I was locked out for two days from my machine. 2004-04-10 14:36:57 +00:00
Tim J. Robbins
fa02ee78c8 Don't cast away const qualifiers.
Spotted by:	bde
2004-04-10 00:27:52 +00:00
Tim J. Robbins
8b8109275c Update manual pages for change to C99 mbrtowc() semantics. 2004-04-08 09:59:02 +00:00
Tim J. Robbins
ca2dae426e Allow partial multibyte characters to accumulate in conversion state
objects passed to mbrtowc(), mbsrtowcs(), and mbrlen(), as required
by C99.
2004-04-07 10:48:19 +00:00
Tim J. Robbins
e97e856274 Begin conversions for sgetrune() and sputrune() in the initial
conversion state.
2004-04-07 09:49:10 +00:00
Tim J. Robbins
dc763237da Prepare to handle state-dependent encodings. This mainly involves not
taking shortcuts when it comes to storing and passing around conversion
states.
2004-04-07 09:47:56 +00:00
Tim J. Robbins
ed870c6a8e Begin in the initial shift state in mbstowcs() and wcstombs().
(This change is non-functional since nothing uses states yet.)
2004-04-07 08:33:23 +00:00
Tim J. Robbins
74f90def09 Prepare to handle state-dependent encodings. This mainly involves not
taking shortcuts when it comes to storing and passing around conversion
states.
2004-04-06 13:14:03 +00:00
Tim J. Robbins
4fb9e805dc Remove support for emulating mbrtowc() and wcrtomb() in terms of the
old rune interface now that it is no longer needed.
2004-04-04 11:31:29 +00:00
Tim J. Robbins
4f6d4aa30d Reimplement the GB18030 encoding method using the new-style (mbrtowc()/
wcrtomb()) interface.
2004-04-04 11:00:42 +00:00
Tim J. Robbins
54c61797df Reimplement the deprecated UTF2 encoding method using the UTF-8 code
as a base. mbrtowc() and wcrtomb() are now implemented directly
instead of being emulatedi with sgetrune() and sputrune().
2004-04-04 10:49:45 +00:00
Tim J. Robbins
6de4bcc717 Add cross-references to isideogram(3), isphonogram(3), isrune(3),
isspecial(3) and wctype(3).
2004-03-30 08:11:57 +00:00
Tim J. Robbins
32d9553d83 Add basic manual pages for isideogram(), isphonogram(), isrune()
and isspecial().
2004-03-30 07:23:54 +00:00
Tim J. Robbins
bee1de57ca Trim cross-references. 2004-03-30 07:19:35 +00:00
Tim J. Robbins
ba6699086d Document the isnumber() and ishexnumber() functions, and explain how they
differ (at least in theory) from isdigit() and isxdigit().
2004-03-30 07:02:04 +00:00
Tim J. Robbins
ab02b93f75 Remove duplicate MLINK. 2004-03-29 21:46:52 +00:00
Tim J. Robbins
97062607cd Recognize the "rune" character class in wctype(). 2004-03-27 08:59:21 +00:00
Diomidis Spinellis
3f0a01ea87 Make consistent with the better written wcsrtombs function:
- Fix syntax
- Remove the (slightly wrong) duplicate explanation of the error condition
- Change reference to invalid multibyte character into invalid wide character
2004-02-27 15:03:22 +00:00
Andrey A. Chernov
41ddc53bca LC_ALL not always take priority over other LC_*
Obtained from:  NetBSD
PR:             62047
2004-01-31 19:15:32 +00:00
Andrey A. Chernov
e6e9fb749a Add reference to environ(7) 2004-01-29 09:27:24 +00:00
Jacques Vidrine
84d9142f58 Remove unused variables and function declarations. Add missing headers. 2004-01-06 18:26:15 +00:00
Andrey A. Chernov
ad4688e131 Properly advance "x/y/z" form slash-pointers in some rare cases
PR:             60539
2003-12-24 10:16:46 +00:00
Andrey A. Chernov
6abda1f093 First byte of GBK-like sequences is 0x81, not 0x80 2003-12-19 12:54:42 +00:00
Tim J. Robbins
40c5c1f8a1 Set __mbrtowc and __wcrtomb correctly when changing to the C/POSIX locale.
Save __mbrtowc and __wcrtomb and restore them when changing back to
the cached locale.

Reported by:	perky
2003-12-08 23:52:22 +00:00
Tim J. Robbins
bc0b3a1800 Split multibyte(3) into separate manual pages for each function.
Instead of just deleting it, turn the original page into a general
overview of the multibyte character conversion functions, somewhat
similar to stdio(3).
2003-12-07 06:33:52 +00:00
Tim J. Robbins
da44487bd7 Split the documentation for localeconv() off into a separate manual page. 2003-12-07 06:00:00 +00:00
Tim J. Robbins
8962b7a518 Update cross references after utf2/euc move. 2003-11-15 02:26:04 +00:00
Tim J. Robbins
f76c65296c Remove section 4 versions of these manual pages, they have been
moved into section 5.
2003-11-15 02:15:25 +00:00
Tim J. Robbins
93584b12e6 Install the section 5 versions of EUC and UTF2 manual pages instead of
the section 4 versions.
2003-11-15 02:13:09 +00:00
Tim J. Robbins
ee0694adb9 Update the EUC and UTF2 manual pages for their new home in section 5.
These have been repo-copied from euc.4 and utf2.4.
2003-11-15 01:54:46 +00:00
Tim J. Robbins
b1c572ad5b Fix a typo that caused mbrtowc() to always return 0. 2003-11-11 07:25:05 +00:00
Tim J. Robbins
cc7a3285a5 Add one more cross-reference to gb2312(5). 2003-11-08 03:23:11 +00:00
Tim J. Robbins
16854d3c8f Add cross-references to new gb2312(5) manual page. 2003-11-08 03:07:56 +00:00
Tim J. Robbins
e31d6d8149 Add a fairly simple manual page for the new GB2312 encoding. 2003-11-08 03:02:45 +00:00
Tim J. Robbins
9e0bd333f0 Remove unused #includes. 2003-11-08 02:58:37 +00:00
Tim J. Robbins
eb402e14d8 Use __inline instead of inline. 2003-11-08 02:56:03 +00:00
Tim J. Robbins
c2f9330393 Refer to wide characters instead of runes. Remove redundant example locale.
Catch up with renaming of "Japanese" to "ja_JP.eucJP". Comment out the
statement that EUC is provided for compatibility with UNIX-based systems;
this is not a very good opening paragraph.
2003-11-08 02:52:31 +00:00
Tim J. Robbins
5d9c483db1 Refer to wide characters instead of runes. 2003-11-08 02:46:02 +00:00
David Xu
6d7a04b013 Add gb2312 encoding. 2003-11-05 22:52:51 +00:00
Tim J. Robbins
90c7d99f5b Implement mbrtowc() and wcrtomb() directly (sync with big5.c). 2003-11-05 07:56:45 +00:00
Tim J. Robbins
02f4f60ad5 Convert the Big5, EUC, MSKanji and UTF-8 encoding methods to implement
mbrtowc() and wcrtomb() directly. GB18030, GBK and UTF2 are left
unconverted; GB18030 will be done eventually, but GBK and UTF2 may just
be removed, as they are subsets of GB18030 and UTF-8 respectively.
2003-11-02 10:09:33 +00:00
Tim J. Robbins
d390e53270 Remove TODO comment about creating a macro version of towctrans().
Remove unnecessary inclusion of <ctype.h>.
2003-11-01 08:20:58 +00:00
Tim J. Robbins
d4f6cd06dd Allow mbrtowc() and wcrtomb() to be implemented directly, instead of
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.
2003-11-01 05:13:13 +00:00
Tim J. Robbins
1e8742e9cd Don't bother passing a freshly-zeroed mbstate to mbsrtowcs() etc.
when the current implementation won't use it, anyway. Just pass NULL.
This will need to be changed when state-dependent encodings are
supported, but there's no need to take the performance hit
in the meantime.
2003-10-31 13:29:00 +00:00
Tim J. Robbins
cf651e6b5c Implement fgetrune(), fungetrune() and fputrune() as wrappers around
fgetwc(), ungetwc() and fputwc().
2003-10-31 10:55:19 +00:00
Tim J. Robbins
4539e95a0f Remove incomplete support for running FreeBSD userland on old NetBSD kernels
lacking the issetugid() and utrace() syscalls.
2003-10-29 10:45:01 +00:00
Ruslan Ermilov
fe08efe680 mdoc(7): Use the new feature of the .In macro. 2003-09-08 19:57:22 +00:00
Tim J. Robbins
4ae3aa59ef Remove an unused and incorrect prototype for _none_init(). 2003-09-05 09:01:31 +00:00
Tim J. Robbins
e43ffa4159 Fix the case of the encoding name in the ENCODING line. Names are
case-sensitive, and MSKANJI does not work.
2003-08-10 11:41:38 +00:00
Tim J. Robbins
dcb2df4c22 Cross-reference gbk(5). 2003-08-10 11:38:28 +00:00
Tim J. Robbins
dd5e8fdef8 Cross-reference gbk(5) now that it exists. Fix a copy & paste error:
one occurrence of GB 18030 should have been 11383.
2003-08-10 11:36:42 +00:00
Tim J. Robbins
f6d8a447d1 Add a fairly minimal manual page for the GBK encoding. 2003-08-10 11:34:35 +00:00
Tim J. Robbins
9e09ac8597 Add a cross reference to Unicode 3.0. 2003-08-10 11:26:18 +00:00
Tim J. Robbins
39e2a81e3f Add cross references to the new character encoding manual pages,
and to mbsinit(3) while I'm at it.
2003-08-10 09:25:52 +00:00
Tim J. Robbins
8ca5fa518c Add manual pages for the BIG5, GB18030 and MSKanji encodings. These may
need to be fleshed out a little, especially big5(5).
2003-08-10 09:23:51 +00:00
Tim J. Robbins
b85aa4e3f7 Implement mblen(s, n) as mbtowc(NULL, s, n) to avoid calling sgetrune()
and to simplify things. This is only valid until we start supporting
state-dependent encodings.
2003-08-07 09:34:51 +00:00
Tim J. Robbins
b69a98d6d3 Implement mbstowcs() as a wrapper around mbsrtowcs(), and wcstombs()
as a wrapper around wcsrtombs().
2003-08-07 08:04:01 +00:00
Tim J. Robbins
998e124837 Implement mbtowc() in terms of mbrtowc(), and wctomb() in terms of wcrtomb(). 2003-08-07 07:59:36 +00:00
Tim J. Robbins
dab4fca49b Implement btowc() in terms of mbrtowc() instead of sgetrune(), and
wctob() in terms of wcrtomb() instead of sputrune(). There should be
no functional differences, but there may be a small performance hit
because we make an extra function call.

The aim here is to have as few functions as possible calling
s{get,put}rune() to make it easier to remove them in the future.
2003-08-07 07:45:35 +00:00
Andrey A. Chernov
a9d25ab17f Restore including of "collate.h", for its own prototype (mis)match detection 2003-08-03 19:28:23 +00:00
Andrey A. Chernov
8841d0081c Remove commented out and never used code 2003-08-03 05:20:31 +00:00
Andrey A. Chernov
17f67afe28 Remove __collate_range_cmp() stabilization, it conflicts with ranges 2003-08-03 04:40:40 +00:00
Andrey A. Chernov
a03081087c Add support for gb18030 encoding
PR:             51729
Submitted by:   Kang Liu <liukang@bjpu.edu.cn>
2003-07-29 07:52:44 +00:00
Andrey A. Chernov
8b2749e901 Add const to __setrunelocale prototype 2003-07-06 04:01:09 +00:00
Andrey A. Chernov
68d429c3fc Reorganize wrapper around setrunelocale() to mark it as deprecated
in FreeBSD 6
2003-07-06 02:03:37 +00:00
Alexey Zelkin
683fe11379 . style(9)
. fix/add comments (to cover changes done thru last 20 months)
. extend monetary testcase to cover int_* values
2003-06-26 10:46:16 +00:00
Alexey Zelkin
fca2738d67 Reduce code duplication by separating _PathLocle detection code into
internal helper function.
2003-06-25 22:42:33 +00:00
Alexey Zelkin
93c847344b Move _PathLocale declaration to more logical place (setlocale.c) 2003-06-25 22:34:13 +00:00
Alexey Zelkin
d8d4841398 Catch up with _PATH_LOCALE move from rune.h to paths.h 2003-06-25 22:31:42 +00:00
Tim J. Robbins
77156cb782 Mark the following interfaces as OBSOLETE_IN_6:
fgetrune(), fputrune(), fungetrune(), mbrune(), mbrrune(), mbmb(),
    setinvalidrune(), UTF2 encoding method.
These have been marked as being deprecated in their manual pages since 5.0,
and their use causes a linker warning.
2003-06-13 07:13:54 +00:00
Jordan K. Hubbard
3dfdc427f1 Fixes to locale code to properly use indirect pointers in order to prevent
memory leaks (fixes bugs earlier purported to be fixed).
Submitted by:	Ed Moy <emoy@apple.com>
Obtained from:	Apple Computer, Inc.
MFC after:	2 weeks
2003-06-13 00:14:07 +00:00
Andrey A. Chernov
0c7fbc6c40 Remove transition period hack 2003-06-10 01:26:04 +00:00
Andrey A. Chernov
9d793e98ec Add GBK encoding
PR:             51504
Submitted by:   Statue <statue@freebsd.sinica.edu.tw>
2003-06-01 15:30:56 +00:00
Ruslan Ermilov
3a5146d9e2 Assorted mdoc(7) fixes.
Approved by:	re (blanket)
2003-05-22 13:02:28 +00:00
Jacques Vidrine
d05090827f Back out the `hiding' of strlcpy and strlcat. Several people
vocally objected to this safety belt.
2003-05-01 19:03:14 +00:00
Jacques Vidrine
5723e501ab `Hide' strlcpy and strlcat (using the namespace.h / __weak_reference
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
2003-04-29 21:13:50 +00:00
Tim J. Robbins
e3e8878435 When called with s == NULL, behave as if wc == L'\0' as required by the
standard.
2003-04-10 09:20:38 +00:00
Andrey A. Chernov
cfcd9a45b5 According to C99 decimal_point can't be the empty string, mention it. 2003-03-20 08:13:34 +00:00
Andrey A. Chernov
befb332a6b decimal_point can't be "" according to C99, so set it to standard "."
in that case.
2003-03-20 08:05:20 +00:00
Tim J. Robbins
542bd65fcb MFp4: Implementations of the wcstof() and wcstold() functions. 2003-03-13 06:29:53 +00:00
Tim J. Robbins
60bf07bd33 Fix a bad free() call that would occur if some #if 0'd code was used. 2003-02-22 00:06:05 +00:00
Jacques Vidrine
6d7bd75a4e Whack 28 unused variables. 2003-02-18 13:39:52 +00:00
Philippe Charnier
d649825182 The .Fn function 2003-02-06 11:04:47 +00:00
Jens Schweikhardt
9d5abbddbf Correct typos, mostly s/ a / an / where appropriate. Some whitespace cleanup,
especially in troff files.
2003-01-01 18:49:04 +00:00
Ruslan Ermilov
facc67676f mdoc(7) police: Deal with self-xrefs. 2002-12-24 13:41:48 +00:00
Ruslan Ermilov
2efeeba554 mdoc(7) police: "The .Fa argument.". 2002-12-19 09:40:28 +00:00
Ruslan Ermilov
5c564bae0a mdoc(7) police: Fixed abuses of the .Ar and .Em macros. 2002-12-18 13:33:04 +00:00
Ruslan Ermilov
1fae73b137 mdoc(7) police: "The .Fn function". 2002-12-18 12:45:11 +00:00
Ruslan Ermilov
db8993ce9e Capitalize ASCII code names.
Approved by:	re
2002-12-05 08:50:00 +00:00
Ruslan Ermilov
279062fae1 mdoc(7) police: sweep. 2002-11-29 17:35:09 +00:00
Ruslan Ermilov
92b1f2f7a3 mdoc(7) police: sweep. 2002-11-29 16:42:23 +00:00
Ruslan Ermilov
c51d717f0c libc_r wasn't so tied to libc for 22 months. 2002-11-18 09:50:57 +00:00
Tim J. Robbins
b18146b4c2 Add cross references to mbrtowc(3) and wcrtomb(3). 2002-11-10 11:14:58 +00:00
Tim J. Robbins
2f5154a2c1 Don't check whether the first byte of the buffer is a null byte when
the buffer has zero length (n == 0).
2002-11-10 10:49:14 +00:00
Tim J. Robbins
7183f43d95 Describe the n' and ps' arguments to mbrlen(). 2002-11-09 10:21:01 +00:00
Tim J. Robbins
f4937dbebc Typo: pointer to -> pointed to 2002-11-09 09:47:06 +00:00
Tim J. Robbins
490eeb06b4 Use wide character ctype functions directly instead of relying on
4.4BSD extensions to the single-byte ctype functions.
2002-11-09 05:19:08 +00:00
Tim J. Robbins
39df93ae41 Add a missing return statement for the pwcs == NULL case (XSI extension). 2002-11-09 04:13:26 +00:00
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