Index: stable/11/lib/libc/locale/euc.5 =================================================================== --- stable/11/lib/libc/locale/euc.5 (revision 352282) +++ stable/11/lib/libc/locale/euc.5 (revision 352283) @@ -1,134 +1,134 @@ .\" Copyright (c) 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" This code is derived from software contributed to Berkeley by .\" Paul Borman at Krystal Technologies. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)euc.4 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd November 8, 2003 +.Dd September 9, 2019 .Dt EUC 5 .Os .Sh NAME .Nm euc .Nd EUC encoding of wide characters .Sh SYNOPSIS .Nm ENCODING .Qq EUC .Pp .Nm VARIABLE .Ar len1 .Ar mask1 .Ar len2 .Ar mask2 .Ar len3 .Ar mask3 .Ar len4 .Ar mask4 .Ar mask .Sh DESCRIPTION .\"The .\".Nm EUC .\"encoding is provided for compatibility with .\".Ux .\"based systems. .\"See -.\".Xr mklocale 1 +.\".Xr localedef 1 .\"for a complete description of the .\".Ev LC_CTYPE .\"source file format. .\".Pp .Nm EUC implements a system of 4 multibyte codesets. A multibyte character in the first codeset consists of .Ar len1 bytes starting with a byte in the range of 0x00 to 0x7f. To allow use of .Tn ASCII , .Ar len1 is always 1. A multibyte character in the second codeset consists of .Ar len2 bytes starting with a byte in the range of 0x80-0xff excluding 0x8e and 0x8f. A multibyte character in the third codeset consists of .Ar len3 bytes starting with the byte 0x8e. A multibyte character in the fourth codeset consists of .Ar len4 bytes starting with the byte 0x8f. .Pp The .Vt wchar_t encoding of .Nm EUC multibyte characters is dependent on the .Ar len and .Ar mask arguments. First, the bytes are moved into a .Vt wchar_t as follows: .Bd -literal byte0 << ((\fIlen\fPN-1) * 8) | byte1 << ((\fIlen\fPN-2) * 8) | ... | byte\fIlen\fPN-1 .Ed .Pp The result is then ANDed with .Ar ~mask and ORed with .Ar maskN . Codesets 2 and 3 are special in that the leading byte (0x8e or 0x8f) is first removed and the .Ar lenN argument is reduced by 1. .Pp For example, the .Li ja_JP.eucJP locale has the following .Va VARIABLE line: .Bd -literal VARIABLE 1 0x0000 2 0x8080 2 0x0080 3 0x8000 0x8080 .Ed .Pp Codeset 1 consists of the values 0x0000 - 0x007f. .Pp Codeset 2 consists of the values who have the bits 0x8080 set. .Pp Codeset 3 consists of the values 0x0080 - 0x00ff. .Pp Codeset 4 consists of the values 0x8000 - 0xff7f excluding the values which have the 0x0080 bit set. .Pp Notice that the global .Ar mask is set to 0x8080, this implies that from those 2 bits the codeset can be determined. .Sh SEE ALSO -.Xr mklocale 1 , +.Xr localedef 1 , .Xr setlocale 3 Index: stable/11/lib/libc/locale/multibyte.3 =================================================================== --- stable/11/lib/libc/locale/multibyte.3 (revision 352282) +++ stable/11/lib/libc/locale/multibyte.3 (revision 352283) @@ -1,142 +1,142 @@ .\" Copyright (c) 2002-2004 Tim J. Robbins. All rights reserved. .\" Copyright (c) 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" This code is derived from software contributed to Berkeley by .\" Donn Seeley of BSDI. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)multibyte.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd April 8, 2004 +.Dd September 9, 2019 .Dt MULTIBYTE 3 .Os .Sh NAME .Nm multibyte .Nd multibyte and wide character manipulation functions .Sh LIBRARY .Lb libc .Sh SYNOPSIS .In limits.h .In stdlib.h .In wchar.h .Sh DESCRIPTION The basic elements of some written natural languages, such as Chinese, cannot be represented uniquely with single C .Vt char Ns s . The C standard supports two different ways of dealing with extended natural language encodings: wide characters and multibyte characters. Wide characters are an internal representation which allows each basic element to map to a single object of type .Vt wchar_t . Multibyte characters are used for input and output and code each basic element as a sequence of C .Vt char Ns s . Individual basic elements may map into one or more (up to .Dv MB_LEN_MAX ) bytes in a multibyte character. .Pp The current locale .Pq Xr setlocale 3 governs the interpretation of wide and multibyte characters. The locale category .Dv LC_CTYPE specifically controls this interpretation. The .Vt wchar_t type is wide enough to hold the largest value in the wide character representations for all locales. .Pp Multibyte strings may contain .Sq shift indicators to switch to and from particular modes within the given representation. If explicit bytes are used to signal shifting, these are not recognized as separate characters but are lumped with a neighboring character. There is always a distinguished .Sq initial shift state. Some functions (e.g., .Xr mblen 3 , .Xr mbtowc 3 and .Xr wctomb 3 ) maintain static shift state internally, whereas others store it in an .Vt mbstate_t object passed by the caller. Shift states are undefined after a call to .Xr setlocale 3 with the .Dv LC_CTYPE or .Dv LC_ALL categories. .Pp For convenience in processing, the wide character with value 0 (the null wide character) is recognized as the wide character string terminator, and the character with value 0 (the null byte) is recognized as the multibyte character string terminator. Null bytes are not permitted within multibyte characters. .Pp The C library provides the following functions for dealing with multibyte characters: .Bl -column "Description" .It Sy "Function Description" .It Xr mblen 3 Ta "get number of bytes in a character" .It Xr mbrlen 3 Ta "get number of bytes in a character (restartable)" .It Xr mbrtowc 3 Ta "convert a character to a wide-character code (restartable)" .It Xr mbsrtowcs 3 Ta "convert a character string to a wide-character string (restartable)" .It Xr mbstowcs 3 Ta "convert a character string to a wide-character string" .It Xr mbtowc 3 Ta "convert a character to a wide-character code" .It Xr wcrtomb 3 Ta "convert a wide-character code to a character (restartable)" .It Xr wcstombs 3 Ta "convert a wide-character string to a character string" .It Xr wcsrtombs 3 Ta "convert a wide-character string to a character string (restartable)" .It Xr wctomb 3 Ta "convert a wide-character code to a character" .El .Sh SEE ALSO -.Xr mklocale 1 , +.Xr localedef 1 , .Xr setlocale 3 , .Xr stdio 3 , .Xr big5 5 , .Xr euc 5 , .Xr gb18030 5 , .Xr gb2312 5 , .Xr gbk 5 , .Xr mskanji 5 , .Xr utf8 5 .Sh STANDARDS These functions conform to .St -isoC-99 . Index: stable/11/lib/libc/locale/setlocale.3 =================================================================== --- stable/11/lib/libc/locale/setlocale.3 (revision 352282) +++ stable/11/lib/libc/locale/setlocale.3 (revision 352283) @@ -1,173 +1,172 @@ .\" Copyright (c) 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" This code is derived from software contributed to Berkeley by .\" Donn Seeley at BSDI. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)setlocale.3 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd November 21, 2003 +.Dd September 9, 2019 .Dt SETLOCALE 3 .Os .Sh NAME .Nm setlocale .Nd natural language formatting for C .Sh LIBRARY .Lb libc .Sh SYNOPSIS .In locale.h .Ft char * .Fn setlocale "int category" "const char *locale" .Sh DESCRIPTION The .Fn setlocale function sets the C library's notion of natural language formatting style for particular sets of routines. Each such style is called a .Sq locale and is invoked using an appropriate name passed as a C string. .Pp The .Fn setlocale function recognizes several categories of routines. These are the categories and the sets of routines they select: .Bl -tag -width LC_MONETARY .It Dv LC_ALL Set the entire locale generically. .It Dv LC_COLLATE Set a locale for string collation routines. This controls alphabetic ordering in .Fn strcoll and .Fn strxfrm . .It Dv LC_CTYPE Set a locale for the .Xr ctype 3 and .Xr multibyte 3 functions. This controls recognition of upper and lower case, alphabetic or non-alphabetic characters, and so on. .It Dv LC_MESSAGES Set a locale for message catalogs, see .Xr catopen 3 function. .It Dv LC_MONETARY Set a locale for formatting monetary values; this affects the .Fn localeconv function. .It Dv LC_NUMERIC Set a locale for formatting numbers. This controls the formatting of decimal points in input and output of floating point numbers in functions such as .Fn printf and .Fn scanf , as well as values returned by .Fn localeconv . .It Dv LC_TIME Set a locale for formatting dates and times using the .Fn strftime function. .El .Pp Only three locales are defined by default, the empty string .Li \&"\|" which denotes the native environment, and the .Li \&"C" and .Li \&"POSIX" locales, which denote the C language environment. A .Fa locale argument of .Dv NULL causes .Fn setlocale to return the current locale. By default, C programs start in the .Li \&"C" locale. The only function in the library that sets the locale is .Fn setlocale ; the locale is never changed as a side effect of some other routine. .Sh RETURN VALUES Upon successful completion, .Fn setlocale returns the string associated with the specified .Fa category for the requested .Fa locale . The .Fn setlocale function returns .Dv NULL and fails to change the locale if the given combination of .Fa category and .Fa locale makes no sense. .Sh FILES .Bl -tag -width /usr/share/locale/locale/category -compact .It Pa $PATH_LOCALE/ Ns Em locale/category .It Pa /usr/share/locale/ Ns Em locale/category locale file for the locale .Em locale and the category .Em category . .El .Sh ERRORS No errors are defined. .Sh SEE ALSO -.Xr colldef 1 , -.Xr mklocale 1 , +.Xr localedef 1 , .Xr catopen 3 , .Xr ctype 3 , .Xr localeconv 3 , .Xr multibyte 3 , .Xr strcoll 3 , .Xr strxfrm 3 , .Xr euc 5 , .Xr utf8 5 , .Xr environ 7 .Sh STANDARDS The .Fn setlocale function conforms to .St -isoC-99 . .Sh HISTORY The .Fn setlocale function first appeared in .Bx 4.4 . Index: stable/11 =================================================================== --- stable/11 (revision 352282) +++ stable/11 (revision 352283) Property changes on: stable/11 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /head:r352127