[Midnightbsd-cvs] src [10577] trunk/lib/libc/locale: sync

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Thu Jun 7 22:30:58 EDT 2018


Revision: 10577
          http://svnweb.midnightbsd.org/src/?rev=10577
Author:   laffer1
Date:     2018-06-07 22:30:57 -0400 (Thu, 07 Jun 2018)
Log Message:
-----------
sync

Modified Paths:
--------------
    trunk/lib/libc/locale/DESIGN.xlocale
    trunk/lib/libc/locale/Makefile.inc
    trunk/lib/libc/locale/Symbol.map
    trunk/lib/libc/locale/ascii.c
    trunk/lib/libc/locale/big5.5
    trunk/lib/libc/locale/big5.c
    trunk/lib/libc/locale/btowc.3
    trunk/lib/libc/locale/btowc.c
    trunk/lib/libc/locale/collate.c
    trunk/lib/libc/locale/collate.h
    trunk/lib/libc/locale/collcmp.c
    trunk/lib/libc/locale/ctype.3
    trunk/lib/libc/locale/ctype.c
    trunk/lib/libc/locale/ctype_l.3
    trunk/lib/libc/locale/digittoint.3
    trunk/lib/libc/locale/duplocale.3
    trunk/lib/libc/locale/euc.5
    trunk/lib/libc/locale/euc.c
    trunk/lib/libc/locale/fix_grouping.c
    trunk/lib/libc/locale/freelocale.3
    trunk/lib/libc/locale/gb18030.5
    trunk/lib/libc/locale/gb18030.c
    trunk/lib/libc/locale/gb2312.5
    trunk/lib/libc/locale/gb2312.c
    trunk/lib/libc/locale/gbk.5
    trunk/lib/libc/locale/gbk.c
    trunk/lib/libc/locale/isalnum.3
    trunk/lib/libc/locale/isalpha.3
    trunk/lib/libc/locale/isascii.3
    trunk/lib/libc/locale/isblank.3
    trunk/lib/libc/locale/iscntrl.3
    trunk/lib/libc/locale/isctype.c
    trunk/lib/libc/locale/isdigit.3
    trunk/lib/libc/locale/isgraph.3
    trunk/lib/libc/locale/isideogram.3
    trunk/lib/libc/locale/islower.3
    trunk/lib/libc/locale/isphonogram.3
    trunk/lib/libc/locale/isprint.3
    trunk/lib/libc/locale/ispunct.3
    trunk/lib/libc/locale/isrune.3
    trunk/lib/libc/locale/isspace.3
    trunk/lib/libc/locale/isspecial.3
    trunk/lib/libc/locale/isupper.3
    trunk/lib/libc/locale/iswalnum.3
    trunk/lib/libc/locale/iswalnum_l.3
    trunk/lib/libc/locale/iswctype.c
    trunk/lib/libc/locale/isxdigit.3
    trunk/lib/libc/locale/ldpart.c
    trunk/lib/libc/locale/ldpart.h
    trunk/lib/libc/locale/lmessages.c
    trunk/lib/libc/locale/lmessages.h
    trunk/lib/libc/locale/lmonetary.c
    trunk/lib/libc/locale/lmonetary.h
    trunk/lib/libc/locale/lnumeric.c
    trunk/lib/libc/locale/lnumeric.h
    trunk/lib/libc/locale/localeconv.3
    trunk/lib/libc/locale/localeconv.c
    trunk/lib/libc/locale/mblen.3
    trunk/lib/libc/locale/mblen.c
    trunk/lib/libc/locale/mblocal.h
    trunk/lib/libc/locale/mbrlen.3
    trunk/lib/libc/locale/mbrlen.c
    trunk/lib/libc/locale/mbrtowc.3
    trunk/lib/libc/locale/mbrtowc.c
    trunk/lib/libc/locale/mbsinit.3
    trunk/lib/libc/locale/mbsinit.c
    trunk/lib/libc/locale/mbsnrtowcs.c
    trunk/lib/libc/locale/mbsrtowcs.3
    trunk/lib/libc/locale/mbsrtowcs.c
    trunk/lib/libc/locale/mbstowcs.3
    trunk/lib/libc/locale/mbstowcs.c
    trunk/lib/libc/locale/mbtowc.3
    trunk/lib/libc/locale/mbtowc.c
    trunk/lib/libc/locale/mskanji.5
    trunk/lib/libc/locale/mskanji.c
    trunk/lib/libc/locale/multibyte.3
    trunk/lib/libc/locale/newlocale.3
    trunk/lib/libc/locale/nextwctype.3
    trunk/lib/libc/locale/nextwctype.c
    trunk/lib/libc/locale/nl_langinfo.3
    trunk/lib/libc/locale/nl_langinfo.c
    trunk/lib/libc/locale/nomacros.c
    trunk/lib/libc/locale/none.c
    trunk/lib/libc/locale/querylocale.3
    trunk/lib/libc/locale/rpmatch.3
    trunk/lib/libc/locale/rpmatch.c
    trunk/lib/libc/locale/rune.c
    trunk/lib/libc/locale/runefile.h
    trunk/lib/libc/locale/runetype.c
    trunk/lib/libc/locale/setlocale.3
    trunk/lib/libc/locale/setlocale.c
    trunk/lib/libc/locale/setlocale.h
    trunk/lib/libc/locale/setrunelocale.c
    trunk/lib/libc/locale/table.c
    trunk/lib/libc/locale/toascii.3
    trunk/lib/libc/locale/tolower.3
    trunk/lib/libc/locale/tolower.c
    trunk/lib/libc/locale/toupper.3
    trunk/lib/libc/locale/toupper.c
    trunk/lib/libc/locale/towlower.3
    trunk/lib/libc/locale/towupper.3
    trunk/lib/libc/locale/uselocale.3
    trunk/lib/libc/locale/utf8.5
    trunk/lib/libc/locale/utf8.c
    trunk/lib/libc/locale/wcrtomb.3
    trunk/lib/libc/locale/wcrtomb.c
    trunk/lib/libc/locale/wcsftime.3
    trunk/lib/libc/locale/wcsftime.c
    trunk/lib/libc/locale/wcsnrtombs.c
    trunk/lib/libc/locale/wcsrtombs.3
    trunk/lib/libc/locale/wcsrtombs.c
    trunk/lib/libc/locale/wcstod.3
    trunk/lib/libc/locale/wcstod.c
    trunk/lib/libc/locale/wcstof.c
    trunk/lib/libc/locale/wcstoimax.c
    trunk/lib/libc/locale/wcstol.3
    trunk/lib/libc/locale/wcstol.c
    trunk/lib/libc/locale/wcstold.c
    trunk/lib/libc/locale/wcstoll.c
    trunk/lib/libc/locale/wcstombs.3
    trunk/lib/libc/locale/wcstombs.c
    trunk/lib/libc/locale/wcstoul.c
    trunk/lib/libc/locale/wcstoull.c
    trunk/lib/libc/locale/wcstoumax.c
    trunk/lib/libc/locale/wctob.c
    trunk/lib/libc/locale/wctomb.3
    trunk/lib/libc/locale/wctomb.c
    trunk/lib/libc/locale/wctrans.3
    trunk/lib/libc/locale/wctrans.c
    trunk/lib/libc/locale/wctype.3
    trunk/lib/libc/locale/wctype.c
    trunk/lib/libc/locale/wcwidth.3
    trunk/lib/libc/locale/wcwidth.c
    trunk/lib/libc/locale/xlocale.3
    trunk/lib/libc/locale/xlocale.c
    trunk/lib/libc/locale/xlocale_private.h

Added Paths:
-----------
    trunk/lib/libc/locale/c16rtomb.c
    trunk/lib/libc/locale/c16rtomb_iconv.c
    trunk/lib/libc/locale/c32rtomb.c
    trunk/lib/libc/locale/c32rtomb_iconv.c
    trunk/lib/libc/locale/cXXrtomb_iconv.h
    trunk/lib/libc/locale/mbrtoc16.c
    trunk/lib/libc/locale/mbrtoc16_iconv.c
    trunk/lib/libc/locale/mbrtoc32.c
    trunk/lib/libc/locale/mbrtoc32_iconv.c
    trunk/lib/libc/locale/mbrtocXX_iconv.h

Property Changed:
----------------
    trunk/lib/libc/locale/DESIGN.xlocale
    trunk/lib/libc/locale/Makefile.inc
    trunk/lib/libc/locale/Symbol.map
    trunk/lib/libc/locale/big5.5
    trunk/lib/libc/locale/btowc.3
    trunk/lib/libc/locale/ctype.3
    trunk/lib/libc/locale/ctype_l.3
    trunk/lib/libc/locale/digittoint.3
    trunk/lib/libc/locale/duplocale.3
    trunk/lib/libc/locale/euc.5
    trunk/lib/libc/locale/freelocale.3
    trunk/lib/libc/locale/gb18030.5
    trunk/lib/libc/locale/gb2312.5
    trunk/lib/libc/locale/gbk.5
    trunk/lib/libc/locale/isalnum.3
    trunk/lib/libc/locale/isalpha.3
    trunk/lib/libc/locale/isascii.3
    trunk/lib/libc/locale/isblank.3
    trunk/lib/libc/locale/iscntrl.3
    trunk/lib/libc/locale/isdigit.3
    trunk/lib/libc/locale/isgraph.3
    trunk/lib/libc/locale/isideogram.3
    trunk/lib/libc/locale/islower.3
    trunk/lib/libc/locale/isphonogram.3
    trunk/lib/libc/locale/isprint.3
    trunk/lib/libc/locale/ispunct.3
    trunk/lib/libc/locale/isrune.3
    trunk/lib/libc/locale/isspace.3
    trunk/lib/libc/locale/isspecial.3
    trunk/lib/libc/locale/isupper.3
    trunk/lib/libc/locale/iswalnum.3
    trunk/lib/libc/locale/isxdigit.3
    trunk/lib/libc/locale/localeconv.3
    trunk/lib/libc/locale/mblen.3
    trunk/lib/libc/locale/mbrlen.3
    trunk/lib/libc/locale/mbrtowc.3
    trunk/lib/libc/locale/mbsinit.3
    trunk/lib/libc/locale/mbsrtowcs.3
    trunk/lib/libc/locale/mbstowcs.3
    trunk/lib/libc/locale/mbtowc.3
    trunk/lib/libc/locale/mskanji.5
    trunk/lib/libc/locale/multibyte.3
    trunk/lib/libc/locale/newlocale.3
    trunk/lib/libc/locale/nextwctype.3
    trunk/lib/libc/locale/nl_langinfo.3
    trunk/lib/libc/locale/querylocale.3
    trunk/lib/libc/locale/rpmatch.3
    trunk/lib/libc/locale/setlocale.3
    trunk/lib/libc/locale/toascii.3
    trunk/lib/libc/locale/tolower.3
    trunk/lib/libc/locale/toupper.3
    trunk/lib/libc/locale/towlower.3
    trunk/lib/libc/locale/towupper.3
    trunk/lib/libc/locale/uselocale.3
    trunk/lib/libc/locale/utf8.5
    trunk/lib/libc/locale/wcrtomb.3
    trunk/lib/libc/locale/wcsftime.3
    trunk/lib/libc/locale/wcsrtombs.3
    trunk/lib/libc/locale/wcstod.3
    trunk/lib/libc/locale/wcstol.3
    trunk/lib/libc/locale/wcstombs.3
    trunk/lib/libc/locale/wctomb.3
    trunk/lib/libc/locale/wctrans.3
    trunk/lib/libc/locale/wctype.3
    trunk/lib/libc/locale/wcwidth.3
    trunk/lib/libc/locale/xlocale.3

Modified: trunk/lib/libc/locale/DESIGN.xlocale
===================================================================
--- trunk/lib/libc/locale/DESIGN.xlocale	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/DESIGN.xlocale	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,4 +1,5 @@
 $MidnightBSD$
+$FreeBSD: stable/10/lib/libc/locale/DESIGN.xlocale 227753 2011-11-20 14:45:42Z theraven $
 
 Design of xlocale
 =================


Property changes on: trunk/lib/libc/locale/DESIGN.xlocale
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/Makefile.inc
===================================================================
--- trunk/lib/libc/locale/Makefile.inc	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/Makefile.inc	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,5 +1,6 @@
+# $MidnightBSD$
 #	from @(#)Makefile.inc	8.1 (Berkeley) 6/4/93
-# $MidnightBSD$
+# $FreeBSD: stable/10/lib/libc/locale/Makefile.inc 291871 2015-12-05 21:58:21Z ngie $
 
 # locale sources
 .PATH: ${.CURDIR}/${LIBC_ARCH}/locale ${.CURDIR}/locale
@@ -23,6 +24,12 @@
 	wcwidth.c\
 	xlocale.c
 
+.if ${MK_ICONV} != "no"
+SRCS+=	c16rtomb_iconv.c c32rtomb_iconv.c mbrtoc16_iconv.c mbrtoc32_iconv.c
+.else
+SRCS+=	c16rtomb.c c32rtomb.c mbrtoc16.c mbrtoc32.c
+.endif
+
 SYM_MAPS+=${.CURDIR}/locale/Symbol.map
 
 MAN+=	btowc.3 \
@@ -72,7 +79,10 @@
 	iswalnum_l.3 iswspecial_l.3 iswalnum_l.3 nextwctype_l.3 \
 	iswalnum_l.3 towctrans_l.3 iswalnum_l.3 wctrans_l.3
 MLINKS+=isxdigit.3 ishexnumber.3
+MLINKS+=localeconv.3 localeconv_l.3
+MLINKS+=mbrtowc.3 mbrtoc16.3 mbrtowc.3 mbrtoc32.3
 MLINKS+=mbsrtowcs.3 mbsnrtowcs.3
+MLINKS+=wcrtomb.3 c16rtomb.3 wcrtomb.3 c32rtomb.3
 MLINKS+=wcsrtombs.3 wcsnrtombs.3
 MLINKS+=wcstod.3 wcstof.3 wcstod.3 wcstold.3
 MLINKS+=wcstol.3 wcstoul.3 wcstol.3 wcstoll.3 wcstol.3 wcstoull.3 \


Property changes on: trunk/lib/libc/locale/Makefile.inc
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/Symbol.map
===================================================================
--- trunk/lib/libc/locale/Symbol.map	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/Symbol.map	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,5 +1,5 @@
-/*
- * $MidnightBSD$
+/* $MidnightBSD$
+ * $FreeBSD: stable/10/lib/libc/locale/Symbol.map 250883 2013-05-21 19:59:37Z ed $
  */
 
 FBSD_1.0 {
@@ -199,6 +199,14 @@
 	__istype_l;
 	__runes_for_locale;
 	_ThreadRuneLocale;
+	c16rtomb;
+	c16rtomb_l;
+	c32rtomb;
+	c32rtomb_l;
+	mbrtoc16;
+	mbrtoc16_l;
+	mbrtoc32;
+	mbrtoc32_l;
 };
 
 FBSDprivate_1.0 {


Property changes on: trunk/lib/libc/locale/Symbol.map
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/ascii.c
===================================================================
--- trunk/lib/libc/locale/ascii.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/ascii.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2002-2004 Tim J. Robbins. All rights reserved.
  * Copyright (c) 1993
@@ -37,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/ascii.c 301245 2016-06-03 07:34:59Z ache $");
 
 #include <errno.h>
 #include <limits.h>
@@ -143,6 +144,7 @@
 	nchr = 0;
 	while (len-- > 0 && nms-- > 0) {
 		if (*s & 0x80) {
+			*src = s;
 			errno = EILSEQ;
 			return ((size_t)-1);
 		}
@@ -177,6 +179,7 @@
 	nchr = 0;
 	while (len-- > 0 && nwc-- > 0) {
 		if (*s < 0 || *s > 127) {
+			*src = s;
 			errno = EILSEQ;
 			return ((size_t)-1);
 		}

Modified: trunk/lib/libc/locale/big5.5
===================================================================
--- trunk/lib/libc/locale/big5.5	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/big5.5	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2002, 2003 Tim J. Robbins
 .\" All rights reserved.
 .\"
@@ -22,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/big5.5 131608 2004-07-05 06:39:03Z ru $
 .\"
 .Dd August 7, 2003
 .Dt BIG5 5


Property changes on: trunk/lib/libc/locale/big5.5
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/big5.c
===================================================================
--- trunk/lib/libc/locale/big5.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/big5.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2002-2004 Tim J. Robbins. All rights reserved.
  * Copyright (c) 1993
@@ -44,7 +45,7 @@
 static char sccsid[] = "@(#)big5.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/big5.c 227753 2011-11-20 14:45:42Z theraven $");
 
 #include <sys/types.h>
 #include <errno.h>

Modified: trunk/lib/libc/locale/btowc.3
===================================================================
--- trunk/lib/libc/locale/btowc.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/btowc.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2002 Tim J. Robbins
 .\" All rights reserved.
 .\"
@@ -22,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/btowc.3 248803 2013-03-27 21:31:40Z jilles $
 .\"
 .Dd February 13, 2012
 .Dt BTOWC 3


Property changes on: trunk/lib/libc/locale/btowc.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/btowc.c
===================================================================
--- trunk/lib/libc/locale/btowc.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/btowc.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2002, 2003 Tim J. Robbins.
  * All rights reserved.
@@ -30,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/btowc.c 227753 2011-11-20 14:45:42Z theraven $");
 
 #include <stdio.h>
 #include <wchar.h>

Added: trunk/lib/libc/locale/c16rtomb.c
===================================================================
--- trunk/lib/libc/locale/c16rtomb.c	                        (rev 0)
+++ trunk/lib/libc/locale/c16rtomb.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -0,0 +1,82 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2013 Ed Schouten <ed at FreeBSD.org>
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/c16rtomb.c 250883 2013-05-21 19:59:37Z ed $");
+
+#include <errno.h>
+#include <uchar.h>
+#include "xlocale_private.h"
+
+typedef struct {
+	char16_t	lead_surrogate;
+	mbstate_t	c32_mbstate;
+} _Char16State;
+
+size_t
+c16rtomb_l(char * __restrict s, char16_t c16, mbstate_t * __restrict ps,
+    locale_t locale)
+{
+	_Char16State *cs;
+	char32_t c32;
+
+	FIX_LOCALE(locale);
+	if (ps == NULL)
+		ps = &locale->c16rtomb;
+	cs = (_Char16State *)ps;
+
+	/* If s is a null pointer, the value of parameter c16 is ignored. */
+	if (s == NULL) {
+		c32 = 0;
+	} else if (cs->lead_surrogate >= 0xd800 &&
+	    cs->lead_surrogate <= 0xdbff) {
+		/* We should see a trail surrogate now. */
+		if (c16 < 0xdc00 || c16 > 0xdfff) {
+			errno = EILSEQ;
+			return ((size_t)-1);
+		}
+		c32 = 0x10000 + ((cs->lead_surrogate & 0x3ff) << 10 |
+		    (c16 & 0x3ff));
+	} else if (c16 >= 0xd800 && c16 <= 0xdbff) {
+		/* Store lead surrogate for next invocation. */
+		cs->lead_surrogate = c16;
+		return (0);
+	} else {
+		/* Regular character. */
+		c32 = c16;
+	}
+	cs->lead_surrogate = 0;
+
+	return (c32rtomb_l(s, c32, &cs->c32_mbstate, locale));
+}
+
+size_t
+c16rtomb(char * __restrict s, char16_t c16, mbstate_t * __restrict ps)
+{
+
+	return (c16rtomb_l(s, c16, ps, __get_locale()));
+}


Property changes on: trunk/lib/libc/locale/c16rtomb.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/lib/libc/locale/c16rtomb_iconv.c
===================================================================
--- trunk/lib/libc/locale/c16rtomb_iconv.c	                        (rev 0)
+++ trunk/lib/libc/locale/c16rtomb_iconv.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -0,0 +1,9 @@
+/* $MidnightBSD$ */
+/* $FreeBSD: stable/10/lib/libc/locale/c16rtomb_iconv.c 251314 2013-06-03 17:17:56Z ed $ */
+#define	charXX_t	char16_t
+#define	cXXrtomb	c16rtomb
+#define	cXXrtomb_l	c16rtomb_l
+#define	SRCBUF_LEN	2
+#define	UTF_XX_INTERNAL	"UTF-16-INTERNAL"
+
+#include "cXXrtomb_iconv.h"


Property changes on: trunk/lib/libc/locale/c16rtomb_iconv.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/lib/libc/locale/c32rtomb.c
===================================================================
--- trunk/lib/libc/locale/c32rtomb.c	                        (rev 0)
+++ trunk/lib/libc/locale/c32rtomb.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -0,0 +1,60 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2013 Ed Schouten <ed at FreeBSD.org>
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/c32rtomb.c 250883 2013-05-21 19:59:37Z ed $");
+
+#include <errno.h>
+#include <uchar.h>
+#include <wchar.h>
+#include "xlocale_private.h"
+
+size_t
+c32rtomb_l(char * __restrict s, char32_t c32, mbstate_t * __restrict ps,
+    locale_t locale)
+{
+
+	/* Unicode Standard 5.0, D90: ill-formed characters. */
+	if ((c32 >= 0xd800 && c32 <= 0xdfff) || c32 > 0x10ffff) {
+		errno = EILSEQ;
+		return ((size_t)-1);
+	}
+
+	FIX_LOCALE(locale);
+	if (ps == NULL)
+		ps = &locale->c32rtomb;
+
+	/* Assume wchar_t uses UTF-32. */
+	return (wcrtomb_l(s, c32, ps, locale));
+}
+
+size_t
+c32rtomb(char * __restrict s, char32_t c32, mbstate_t * __restrict ps)
+{
+
+	return (c32rtomb_l(s, c32, ps, __get_locale()));
+}


Property changes on: trunk/lib/libc/locale/c32rtomb.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/lib/libc/locale/c32rtomb_iconv.c
===================================================================
--- trunk/lib/libc/locale/c32rtomb_iconv.c	                        (rev 0)
+++ trunk/lib/libc/locale/c32rtomb_iconv.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -0,0 +1,9 @@
+/* $MidnightBSD$ */
+/* $FreeBSD: stable/10/lib/libc/locale/c32rtomb_iconv.c 251314 2013-06-03 17:17:56Z ed $ */
+#define	charXX_t	char32_t
+#define	cXXrtomb	c32rtomb
+#define	cXXrtomb_l	c32rtomb_l
+#define	SRCBUF_LEN	1
+#define	UTF_XX_INTERNAL	"UTF-32-INTERNAL"
+
+#include "cXXrtomb_iconv.h"


Property changes on: trunk/lib/libc/locale/c32rtomb_iconv.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/lib/libc/locale/cXXrtomb_iconv.h
===================================================================
--- trunk/lib/libc/locale/cXXrtomb_iconv.h	                        (rev 0)
+++ trunk/lib/libc/locale/cXXrtomb_iconv.h	2018-06-08 02:30:57 UTC (rev 10577)
@@ -0,0 +1,116 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2013 Ed Schouten <ed at FreeBSD.org>
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/cXXrtomb_iconv.h 282275 2015-04-30 16:08:47Z tijl $");
+
+#include <sys/queue.h>
+
+#include <assert.h>
+#include <errno.h>
+#include <langinfo.h>
+#include <uchar.h>
+
+#include "../iconv/citrus_hash.h"
+#include "../iconv/citrus_module.h"
+#include "../iconv/citrus_iconv.h"
+#include "xlocale_private.h"
+
+typedef struct {
+	bool			initialized;
+	struct _citrus_iconv	iconv;
+	union {
+		charXX_t	widechar[SRCBUF_LEN];
+		char		bytes[sizeof(charXX_t) * SRCBUF_LEN];
+	} srcbuf;
+	size_t			srcbuf_len;
+} _ConversionState;
+_Static_assert(sizeof(_ConversionState) <= sizeof(mbstate_t),
+    "Size of _ConversionState must not exceed mbstate_t's size.");
+
+size_t
+cXXrtomb_l(char * __restrict s, charXX_t c, mbstate_t * __restrict ps,
+    locale_t locale)
+{
+	_ConversionState *cs;
+	struct _citrus_iconv *handle;
+	char *src, *dst;
+	size_t srcleft, dstleft, invlen;
+	int err;
+
+	FIX_LOCALE(locale);
+	if (ps == NULL)
+		ps = &locale->cXXrtomb;
+	cs = (_ConversionState *)ps;
+	handle = &cs->iconv;
+
+	/* Reinitialize mbstate_t. */
+	if (s == NULL || !cs->initialized) {
+		if (_citrus_iconv_open(&handle, UTF_XX_INTERNAL,
+		    nl_langinfo_l(CODESET, locale)) != 0) {
+			cs->initialized = false;
+			errno = EINVAL;
+			return (-1);
+		}
+		handle->cv_shared->ci_discard_ilseq = true;
+		handle->cv_shared->ci_hooks = NULL;
+		cs->srcbuf_len = 0;
+		cs->initialized = true;
+		if (s == NULL)
+			return (1);
+	}
+
+	assert(cs->srcbuf_len < sizeof(cs->srcbuf.widechar) / sizeof(charXX_t));
+	cs->srcbuf.widechar[cs->srcbuf_len++] = c;
+
+	/* Perform conversion. */
+	src = cs->srcbuf.bytes;
+	srcleft = cs->srcbuf_len * sizeof(charXX_t);
+	dst = s;
+	dstleft = MB_CUR_MAX_L(locale);
+	err = _citrus_iconv_convert(handle, &src, &srcleft, &dst, &dstleft,
+	    0, &invlen);
+
+	/* Character is part of a surrogate pair. We need more input. */
+	if (err == EINVAL)
+		return (0);
+	cs->srcbuf_len = 0;
+	
+	/* Illegal sequence. */
+	if (dst == s) {
+		errno = EILSEQ;
+		return ((size_t)-1);
+	}
+	return (dst - s);
+}
+
+size_t
+cXXrtomb(char * __restrict s, charXX_t c, mbstate_t * __restrict ps)
+{
+
+	return (cXXrtomb_l(s, c, ps, __get_locale()));
+}


Property changes on: trunk/lib/libc/locale/cXXrtomb_iconv.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/lib/libc/locale/collate.c
===================================================================
--- trunk/lib/libc/locale/collate.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/collate.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1995 Alex Tatmanjants <alex at elvisti.kiev.ua>
  *		at Electronni Visti IA, Kiev, Ukraine.
@@ -31,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/collate.c 244126 2012-12-11 22:52:56Z jilles $");
 
 #include "namespace.h"
 #include <arpa/inet.h>
@@ -135,7 +136,7 @@
 	(void)strcat(buf, "/");
 	(void)strcat(buf, encoding);
 	(void)strcat(buf, "/LC_COLLATE");
-	if ((fp = fopen(buf, "r")) == NULL)
+	if ((fp = fopen(buf, "re")) == NULL)
 		return (_LDP_ERROR);
 
 	if (fread(strbuf, sizeof(strbuf), 1, fp) != 1) {

Modified: trunk/lib/libc/locale/collate.h
===================================================================
--- trunk/lib/libc/locale/collate.h	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/collate.h	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1995 Alex Tatmanjants <alex at elvisti.kiev.ua>
  *		at Electronni Visti IA, Kiev, Ukraine.
@@ -29,7 +30,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/lib/libc/locale/collate.h 303185 2016-07-22 14:24:17Z ache $
  */
 
 #ifndef _COLLATE_H_
@@ -72,7 +73,8 @@
 u_char	*__collate_substitute(struct xlocale_collate *, const u_char *);
 int	__collate_load_tables(const char *);
 void	__collate_lookup(struct xlocale_collate *, const u_char *, int *, int *, int *);
-int	__collate_range_cmp(struct xlocale_collate *, int, int);
+int	__collate_range_cmp(char, char);
+int	__wcollate_range_cmp(wchar_t, wchar_t);
 #ifdef COLLATE_DEBUG
 void	__collate_print_tables(void);
 #endif

Modified: trunk/lib/libc/locale/collcmp.c
===================================================================
--- trunk/lib/libc/locale/collcmp.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/collcmp.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (C) 1996 by Andrey A. Chernov, Moscow, Russia.
  * All rights reserved.
@@ -30,10 +31,10 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/collcmp.c 303191 2016-07-22 16:48:39Z ache $");
 
 #include <string.h>
-#include <xlocale.h>
+#include <wchar.h>
 #include "collate.h"
 
 /*
@@ -40,13 +41,24 @@
  * Compare two characters using collate
  */
 
-int __collate_range_cmp(struct xlocale_collate *table, int c1, int c2)
+int __collate_range_cmp(char c1, char c2)
 {
-	static char s1[2], s2[2];
+	char s1[2], s2[2];
 
 	s1[0] = c1;
+	s1[1] = '\0';
 	s2[0] = c2;
-	struct _xlocale l = {{0}};
-	l.components[XLC_COLLATE] = (struct xlocale_component *)table;
-	return (strcoll_l(s1, s2, &l));
+	s2[1] = '\0';
+	return (strcoll(s1, s2));
 }
+
+int __wcollate_range_cmp(wchar_t c1, wchar_t c2)
+{
+	wchar_t s1[2], s2[2];
+
+	s1[0] = c1;
+	s1[1] = L'\0';
+	s2[0] = c2;
+	s2[1] = L'\0';
+	return (wcscoll(s1, s2));
+}

Modified: trunk/lib/libc/locale/ctype.3
===================================================================
--- trunk/lib/libc/locale/ctype.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/ctype.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)ctype.3	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/ctype.3 233648 2012-03-29 05:02:12Z eadler $
 .\"
 .Dd March 30, 2004
 .Dt CTYPE 3


Property changes on: trunk/lib/libc/locale/ctype.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/ctype.c
===================================================================
--- trunk/lib/libc/locale/ctype.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/ctype.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2011 The FreeBSD Foundation
  * All rights reserved.
@@ -25,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/lib/libc/locale/ctype.c 227753 2011-11-20 14:45:42Z theraven $
  */
 #define _XLOCALE_INLINE
 #include <ctype.h>

Modified: trunk/lib/libc/locale/ctype_l.3
===================================================================
--- trunk/lib/libc/locale/ctype_l.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/ctype_l.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2011 The FreeBSD Foundation
 .\" All rights reserved.
 .\"
@@ -25,7 +26,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/ctype_l.3 237939 2012-07-01 22:18:20Z jilles $
 .\"
 .Dd March 6, 2012
 .Dt CTYPE_L 3


Property changes on: trunk/lib/libc/locale/ctype_l.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/digittoint.3
===================================================================
--- trunk/lib/libc/locale/digittoint.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/digittoint.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)digittoint.3	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/digittoint.3 233648 2012-03-29 05:02:12Z eadler $
 .\"
 .Dd April 6, 2001
 .Dt DIGITTOINT 3


Property changes on: trunk/lib/libc/locale/digittoint.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/duplocale.3
===================================================================
--- trunk/lib/libc/locale/duplocale.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/duplocale.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2011 The FreeBSD Foundation
 .\" All rights reserved.
 .\"
@@ -25,9 +26,9 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/duplocale.3 250244 2013-05-04 17:06:47Z pluknet $
 .\"
-.Dd September 17 2011
+.Dd September 17, 2011
 .Dt DUPLOCALE 3
 .Os
 .Sh NAME
@@ -44,10 +45,10 @@
 .Fa locale_t
 returning a new
 .Fa locale_t
-that refers to the same locale values but has independent internal state.
+that refers to the same locale values but has an independent internal state.
 Various functions, such as
 .Xr mblen 3
-require presistent state.
+require a persistent state.
 These functions formerly used static variables and calls to them from multiple
 threads had undefined behavior.
 They now use fields in the
@@ -58,15 +59,6 @@
 locale.
 The locale returned by this call must be freed with
 .Xr freelocale 3 .
-.Sh BUGS
-Ideally,
-.Xr uselocale 3
-should make a copy of the
-.Fa locale_t
-implicitly to ensure thread safety,
-and a copy of the global locale should be installed lazily on each thread.
-The FreeBSD implementation does not do this,
-for compatibility with Darwin.
 .Sh SEE ALSO
 .Xr freelocale 3 ,
 .Xr localeconv 3 ,
@@ -77,3 +69,12 @@
 .Sh STANDARDS
 This function conforms to
 .St -p1003.1-2008 .
+.Sh BUGS
+Ideally,
+.Xr uselocale 3
+should make a copy of the
+.Fa locale_t
+implicitly to ensure thread safety,
+and a copy of the global locale should be installed lazily on each thread.
+The FreeBSD implementation does not do this,
+for compatibility with Darwin.


Property changes on: trunk/lib/libc/locale/duplocale.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/euc.5
===================================================================
--- trunk/lib/libc/locale/euc.5	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/euc.5	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -29,7 +30,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)euc.4	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/euc.5 165903 2007-01-09 00:28:16Z imp $
 .\"
 .Dd November 8, 2003
 .Dt EUC 5


Property changes on: trunk/lib/libc/locale/euc.5
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/euc.c
===================================================================
--- trunk/lib/libc/locale/euc.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/euc.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2002-2004 Tim J. Robbins. All rights reserved.
  * Copyright (c) 1993
@@ -44,7 +45,7 @@
 static char sccsid[] = "@(#)euc.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/param.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/euc.c 227753 2011-11-20 14:45:42Z theraven $");
 
 #include <errno.h>
 #include <limits.h>

Modified: trunk/lib/libc/locale/fix_grouping.c
===================================================================
--- trunk/lib/libc/locale/fix_grouping.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/fix_grouping.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 2001 Alexey Zelkin <phantom at FreeBSD.org>
  * All rights reserved.
@@ -25,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/fix_grouping.c 116875 2003-06-26 10:46:16Z phantom $");
 
 #include <ctype.h>
 #include <limits.h>

Modified: trunk/lib/libc/locale/freelocale.3
===================================================================
--- trunk/lib/libc/locale/freelocale.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/freelocale.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2011 The FreeBSD Foundation
 .\" All rights reserved.
 .\"
@@ -25,8 +26,8 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
-.Dd September 17 2011
+.\" $FreeBSD: stable/10/lib/libc/locale/freelocale.3 250245 2013-05-04 17:21:44Z pluknet $
+.Dd September 17, 2011
 .Dt FREELOCALE 3
 .Os
 .Sh NAME
@@ -34,7 +35,7 @@
 .Nd Frees a locale created with
 .Xr duplocale 3
 or
-.Xr newlocale 3 .
+.Xr newlocale 3
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
@@ -57,5 +58,12 @@
 .Xr uselocale 3 ,
 .Xr xlocale 3
 .Sh STANDARDS
-This function conforms to
-.St -p1003.1-2008 .
+The
+.Fn freelocale
+function
+differs from
+.St -p1003.1-2008
+in that its return type is
+.Vt int
+rather than
+.Vt void .


Property changes on: trunk/lib/libc/locale/freelocale.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/gb18030.5
===================================================================
--- trunk/lib/libc/locale/gb18030.5	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/gb18030.5	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2002, 2003 Tim J. Robbins
 .\" All rights reserved.
 .\"
@@ -22,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/gb18030.5 131608 2004-07-05 06:39:03Z ru $
 .\"
 .Dd August 10, 2003
 .Dt GB18030 5


Property changes on: trunk/lib/libc/locale/gb18030.5
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/gb18030.c
===================================================================
--- trunk/lib/libc/locale/gb18030.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/gb18030.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2002-2004 Tim J. Robbins
  * All rights reserved.
@@ -35,7 +36,7 @@
  */
 
 #include <sys/param.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/gb18030.c 227753 2011-11-20 14:45:42Z theraven $");
 
 #include <errno.h>
 #include <runetype.h>

Modified: trunk/lib/libc/locale/gb2312.5
===================================================================
--- trunk/lib/libc/locale/gb2312.5	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/gb2312.5	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2003 Tim J. Robbins
 .\" All rights reserved.
 .\"
@@ -22,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/gb2312.5 131608 2004-07-05 06:39:03Z ru $
 .\"
 .Dd November 7, 2003
 .Dt GB2312 5


Property changes on: trunk/lib/libc/locale/gb2312.5
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/gb2312.c
===================================================================
--- trunk/lib/libc/locale/gb2312.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/gb2312.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2004 Tim J. Robbins. All rights reserved.
  * Copyright (c) 2003 David Xu <davidxu at freebsd.org>
@@ -31,7 +32,7 @@
  */
 
 #include <sys/param.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/gb2312.c 227753 2011-11-20 14:45:42Z theraven $");
 
 #include <errno.h>
 #include <runetype.h>

Modified: trunk/lib/libc/locale/gbk.5
===================================================================
--- trunk/lib/libc/locale/gbk.5	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/gbk.5	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2003 Tim J. Robbins
 .\" All rights reserved.
 .\"
@@ -22,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/gbk.5 131608 2004-07-05 06:39:03Z ru $
 .\"
 .Dd August 10, 2003
 .Dt GBK 5


Property changes on: trunk/lib/libc/locale/gbk.5
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/gbk.c
===================================================================
--- trunk/lib/libc/locale/gbk.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/gbk.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2002-2004 Tim J. Robbins. All rights reserved.
  * Copyright (c) 1993
@@ -37,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/gbk.c 227753 2011-11-20 14:45:42Z theraven $");
 
 #include <sys/types.h>
 #include <errno.h>

Modified: trunk/lib/libc/locale/isalnum.3
===================================================================
--- trunk/lib/libc/locale/isalnum.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/isalnum.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -30,7 +31,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)isalnum.3	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/isalnum.3 233992 2012-04-07 09:05:30Z joel $
 .\"
 .Dd July 17, 2005
 .Dt ISALNUM 3


Property changes on: trunk/lib/libc/locale/isalnum.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/isalpha.3
===================================================================
--- trunk/lib/libc/locale/isalpha.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/isalpha.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -30,7 +31,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)isalpha.3	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/isalpha.3 233992 2012-04-07 09:05:30Z joel $
 .\"
 .Dd July 17, 2005
 .Dt ISALPHA 3


Property changes on: trunk/lib/libc/locale/isalpha.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/isascii.3
===================================================================
--- trunk/lib/libc/locale/isascii.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/isascii.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)isascii.3	8.2 (Berkeley) 12/11/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/isascii.3 196820 2009-09-04 07:44:58Z des $
 .\"
 .Dd October 6, 2002
 .Dt ISASCII 3


Property changes on: trunk/lib/libc/locale/isascii.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/isblank.3
===================================================================
--- trunk/lib/libc/locale/isblank.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/isblank.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)isblank.3	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/isblank.3 248803 2013-03-27 21:31:40Z jilles $
 .\"
 .Dd July 17, 2005
 .Dt ISBLANK 3


Property changes on: trunk/lib/libc/locale/isblank.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/iscntrl.3
===================================================================
--- trunk/lib/libc/locale/iscntrl.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/iscntrl.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -30,7 +31,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)iscntrl.3	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/iscntrl.3 233992 2012-04-07 09:05:30Z joel $
 .\"
 .Dd July 17, 2005
 .Dt ISCNTRL 3
@@ -57,7 +58,6 @@
 .Pp
 In the ASCII character set, this includes the following characters
 (with their numeric values shown in octal):
-.Pp
 .Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__
 .It "\&000\ NUL" Ta "001\ SOH" Ta "002\ STX" Ta "003\ ETX" Ta "004\ EOT"
 .It "\&005\ ENQ" Ta "006\ ACK" Ta "007\ BEL" Ta "010\ BS" Ta "011\ HT"


Property changes on: trunk/lib/libc/locale/iscntrl.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/isctype.c
===================================================================
--- trunk/lib/libc/locale/isctype.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/isctype.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 1989, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -39,7 +40,7 @@
 static char sccsid[] = "@(#)isctype.c	8.3 (Berkeley) 2/24/94";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/isctype.c 172619 2007-10-13 16:28:22Z ache $");
 
 #include <ctype.h>
 

Modified: trunk/lib/libc/locale/isdigit.3
===================================================================
--- trunk/lib/libc/locale/isdigit.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/isdigit.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -30,7 +31,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)isdigit.3	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/isdigit.3 233992 2012-04-07 09:05:30Z joel $
 .\"
 .Dd May 4, 2007
 .Dt ISDIGIT 3
@@ -55,7 +56,6 @@
 .Fn isdigit
 function tests for a decimal digit character.
 Regardless of locale, this includes the following characters only:
-.Pp
 .Bl -column \&``0''______ \&``0''______ \&``0''______ \&``0''______ \&``0''______
 .It "\&``0''" Ta "``1''" Ta "``2''" Ta "``3''" Ta "``4''"
 .It "\&``5''" Ta "``6''" Ta "``7''" Ta "``8''" Ta "``9''"


Property changes on: trunk/lib/libc/locale/isdigit.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/isgraph.3
===================================================================
--- trunk/lib/libc/locale/isgraph.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/isgraph.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -30,7 +31,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)isgraph.3	8.2 (Berkeley) 12/11/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/isgraph.3 238919 2012-07-30 20:56:19Z issyl0 $
 .\"
 .Dd July 30, 2012
 .Dt ISGRAPH 3
@@ -60,7 +61,6 @@
 .Pp
 In the ASCII character set, this includes the following characters
 (with their numeric values shown in octal):
-.Pp
 .Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__
 .It "\&041\ ``!''" Ta "042\ ``""''" Ta "043\ ``#''" Ta "044\ ``$''" Ta "045\ ``%''"
 .It "\&046\ ``&''" Ta "047\ ``'''" Ta "050\ ``(''" Ta "051\ ``)''" Ta "052\ ``*''"


Property changes on: trunk/lib/libc/locale/isgraph.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/isideogram.3
===================================================================
--- trunk/lib/libc/locale/isideogram.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/isideogram.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"
 .\" Copyright (c) 2004 Tim J. Robbins
 .\" All rights reserved.
@@ -23,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/isideogram.3 196820 2009-09-04 07:44:58Z des $
 .\"
 .Dd March 30, 2004
 .Dt ISIDEOGRAM 3


Property changes on: trunk/lib/libc/locale/isideogram.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/islower.3
===================================================================
--- trunk/lib/libc/locale/islower.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/islower.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -30,7 +31,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)islower.3	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/islower.3 238920 2012-07-30 21:02:44Z joel $
 .\"
 .Dd July 30, 2012
 .Dt ISLOWER 3
@@ -57,7 +58,6 @@
 .Pp
 In the ASCII character set, this includes the following characters
 (with their numeric values shown in octal):
-.Pp
 .Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__
 .It "\&141\ ``a''" Ta "142\ ``b''" Ta "143\ ``c''" Ta "144\ ``d''" Ta "145\ ``e''"
 .It "\&146\ ``f''" Ta "147\ ``g''" Ta "150\ ``h''" Ta "151\ ``i''" Ta "152\ ``j''"


Property changes on: trunk/lib/libc/locale/islower.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/isphonogram.3
===================================================================
--- trunk/lib/libc/locale/isphonogram.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/isphonogram.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"
 .\" Copyright (c) 2004 Tim J. Robbins
 .\" All rights reserved.
@@ -23,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/isphonogram.3 196820 2009-09-04 07:44:58Z des $
 .\"
 .Dd March 30, 2004
 .Dt ISPHONOGRAM 3


Property changes on: trunk/lib/libc/locale/isphonogram.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/isprint.3
===================================================================
--- trunk/lib/libc/locale/isprint.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/isprint.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -30,7 +31,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)isprint.3	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/isprint.3 233992 2012-04-07 09:05:30Z joel $
 .\"
 .Dd July 17, 2005
 .Dt ISPRINT 3
@@ -56,7 +57,6 @@
 .Pp
 In the ASCII character set, this includes the following characters
 (with their numeric values shown in octal):
-.Pp
 .Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__
 .It "\&040\ sp" Ta "041\ ``!''" Ta "042\ ``""''" Ta "043\ ``#''" Ta "044\ ``$''"
 .It "\&045\ ``%''" Ta "046\ ``&''" Ta "047\ ``'''" Ta "050\ ``(''" Ta "051\ ``)''"


Property changes on: trunk/lib/libc/locale/isprint.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/ispunct.3
===================================================================
--- trunk/lib/libc/locale/ispunct.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/ispunct.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -30,7 +31,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)ispunct.3	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/ispunct.3 238919 2012-07-30 20:56:19Z issyl0 $
 .\"
 .Dd July 30, 2012
 .Dt ISPUNCT 3
@@ -62,7 +63,6 @@
 .Pp
 In the ASCII character set, this includes the following characters
 (with their numeric values shown in octal):
-.Pp
 .Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__
 .It "\&041\ ``!''" Ta "042\ ``""''" Ta "043\ ``#''" Ta "044\ ``$''" Ta "045\ ``%''"
 .It "\&046\ ``&''" Ta "047\ ``'''" Ta "050\ ``(''" Ta "051\ ``)''" Ta "052\ ``*''"


Property changes on: trunk/lib/libc/locale/ispunct.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/isrune.3
===================================================================
--- trunk/lib/libc/locale/isrune.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/isrune.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"
 .\" Copyright (c) 2004 Tim J. Robbins
 .\" All rights reserved.
@@ -23,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/isrune.3 196820 2009-09-04 07:44:58Z des $
 .\"
 .Dd March 30, 2004
 .Dt ISRUNE 3


Property changes on: trunk/lib/libc/locale/isrune.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/isspace.3
===================================================================
--- trunk/lib/libc/locale/isspace.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/isspace.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -30,7 +31,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)isspace.3	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/isspace.3 238919 2012-07-30 20:56:19Z issyl0 $
 .\"
 .Dd July 30, 2012
 .Dt ISSPACE 3
@@ -51,7 +52,6 @@
 .Fn isspace
 function tests for white-space characters.
 For any locale, this includes the following standard characters:
-.Pp
 .Bl -column \&`\et''___ \&``\et''___ \&``\et''___ \&``\et''___ \&``\et''___ \&``\et''___
 .It "\&``\et''" Ta "``\en''" Ta "``\ev''" Ta "``\ef''" Ta "``\er''" Ta "`` ''"
 .El


Property changes on: trunk/lib/libc/locale/isspace.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/isspecial.3
===================================================================
--- trunk/lib/libc/locale/isspecial.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/isspecial.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"
 .\" Copyright (c) 2004 Tim J. Robbins
 .\" All rights reserved.
@@ -23,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/isspecial.3 196820 2009-09-04 07:44:58Z des $
 .\"
 .Dd March 30, 2004
 .Dt ISSPECIAL 3


Property changes on: trunk/lib/libc/locale/isspecial.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/isupper.3
===================================================================
--- trunk/lib/libc/locale/isupper.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/isupper.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -30,7 +31,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)isupper.3	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/isupper.3 233992 2012-04-07 09:05:30Z joel $
 .\"
 .Dd July 17, 2005
 .Dt ISUPPER 3
@@ -55,7 +56,6 @@
 .Pp
 In the ASCII character set, this includes the following characters
 (with their numeric values shown in octal):
-.Pp
 .Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__
 .It "\&101\ ``A''" Ta "102\ ``B''" Ta "103\ ``C''" Ta "104\ ``D''" Ta "105\ ``E''"
 .It "\&106\ ``F''" Ta "107\ ``G''" Ta "110\ ``H''" Ta "111\ ``I''" Ta "112\ ``J''"


Property changes on: trunk/lib/libc/locale/isupper.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/iswalnum.3
===================================================================
--- trunk/lib/libc/locale/iswalnum.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/iswalnum.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"	$NetBSD: iswalnum.3,v 1.5 2002/07/10 14:46:10 yamt Exp $
 .\"
 .\" Copyright (c) 1991 The Regents of the University of California.
@@ -32,7 +33,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)isalnum.3	5.2 (Berkeley) 6/29/91
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/iswalnum.3 165903 2007-01-09 00:28:16Z imp $
 .\"
 .Dd October 3, 2002
 .Dt ISWALNUM 3


Property changes on: trunk/lib/libc/locale/iswalnum.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/iswalnum_l.3
===================================================================
--- trunk/lib/libc/locale/iswalnum_l.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/iswalnum_l.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2012 Isabell Long <issyl0 at FreeBSD.org>
 .\" All rights reserved.
 .\"
@@ -22,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $FreeBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/iswalnum_l.3 238808 2012-07-26 14:46:19Z joel $
 .\"
 .Dd July 25, 2012
 .Dt ISWALNUM_L 3

Modified: trunk/lib/libc/locale/iswctype.c
===================================================================
--- trunk/lib/libc/locale/iswctype.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/iswctype.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 1989, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -36,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/iswctype.c 172909 2007-10-23 17:39:28Z ache $");
 
 #include <wctype.h>
 

Modified: trunk/lib/libc/locale/isxdigit.3
===================================================================
--- trunk/lib/libc/locale/isxdigit.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/isxdigit.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -30,7 +31,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)isxdigit.3	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/isxdigit.3 233992 2012-04-07 09:05:30Z joel $
 .\"
 .Dd July 17, 2005
 .Dt ISXDIGIT 3
@@ -51,7 +52,6 @@
 .Fn isxdigit
 function tests for any hexadecimal-digit character.
 Regardless of locale, this includes the following characters only:
-.Pp
 .Bl -column \&``0''______ \&``0''______ \&``0''______ \&``0''______ \&``0''______
 .It "\&``0''" Ta "``1''" Ta "``2''" Ta "``3''" Ta "``4''"
 .It "\&``5''" Ta "``6''" Ta "``7''" Ta "``8''" Ta "``9''"


Property changes on: trunk/lib/libc/locale/isxdigit.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/ldpart.c
===================================================================
--- trunk/lib/libc/locale/ldpart.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/ldpart.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 2000, 2001 Alexey Zelkin <phantom at FreeBSD.org>
  * All rights reserved.
@@ -25,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/ldpart.c 241046 2012-09-29 11:54:34Z jilles $");
 
 #include "namespace.h"
 #include <sys/types.h>
@@ -87,7 +88,7 @@
 	strcat(filename, name);
 	strcat(filename, "/");
 	strcat(filename, category_filename);
-	if ((fd = _open(filename, O_RDONLY)) < 0)
+	if ((fd = _open(filename, O_RDONLY | O_CLOEXEC)) < 0)
 		return (_LDP_ERROR);
 	if (_fstat(fd, &st) != 0)
 		goto bad_locale;

Modified: trunk/lib/libc/locale/ldpart.h
===================================================================
--- trunk/lib/libc/locale/ldpart.h	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/ldpart.h	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2000, 2001 Alexey Zelkin <phantom at FreeBSD.org>
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/lib/libc/locale/ldpart.h 116274 2003-06-13 00:14:07Z jkh $
  */
 
 #ifndef _LDPART_H_

Modified: trunk/lib/libc/locale/lmessages.c
===================================================================
--- trunk/lib/libc/locale/lmessages.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/lmessages.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 2001 Alexey Zelkin <phantom at FreeBSD.org>
  * All rights reserved.
@@ -30,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/lmessages.c 227753 2011-11-20 14:45:42Z theraven $");
 
 #include <stddef.h>
 

Modified: trunk/lib/libc/locale/lmessages.h
===================================================================
--- trunk/lib/libc/locale/lmessages.h	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/lmessages.h	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2000, 2001 Alexey Zelkin <phantom at FreeBSD.org>
  * All rights reserved.
@@ -28,7 +29,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/lib/libc/locale/lmessages.h 227753 2011-11-20 14:45:42Z theraven $
  */
 
 #ifndef _LMESSAGES_H_

Modified: trunk/lib/libc/locale/lmonetary.c
===================================================================
--- trunk/lib/libc/locale/lmonetary.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/lmonetary.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 2000, 2001 Alexey Zelkin <phantom at FreeBSD.org>
  * All rights reserved.
@@ -30,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/lmonetary.c 227753 2011-11-20 14:45:42Z theraven $");
 
 #include <limits.h>
 #include <stddef.h>

Modified: trunk/lib/libc/locale/lmonetary.h
===================================================================
--- trunk/lib/libc/locale/lmonetary.h	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/lmonetary.h	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2000, 2001 Alexey Zelkin <phantom at FreeBSD.org>
  * All rights reserved.
@@ -28,7 +29,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/lib/libc/locale/lmonetary.h 227753 2011-11-20 14:45:42Z theraven $
  */
 
 #ifndef _LMONETARY_H_

Modified: trunk/lib/libc/locale/lnumeric.c
===================================================================
--- trunk/lib/libc/locale/lnumeric.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/lnumeric.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 2000, 2001 Alexey Zelkin <phantom at FreeBSD.org>
  * All rights reserved.
@@ -30,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/lnumeric.c 227753 2011-11-20 14:45:42Z theraven $");
 
 #include <limits.h>
 

Modified: trunk/lib/libc/locale/lnumeric.h
===================================================================
--- trunk/lib/libc/locale/lnumeric.h	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/lnumeric.h	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2000, 2001 Alexey Zelkin <phantom at FreeBSD.org>
  * All rights reserved.
@@ -28,7 +29,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/lib/libc/locale/lnumeric.h 227753 2011-11-20 14:45:42Z theraven $
  */
 
 #ifndef _LNUMERIC_H_

Modified: trunk/lib/libc/locale/localeconv.3
===================================================================
--- trunk/lib/libc/locale/localeconv.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/localeconv.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -30,7 +31,7 @@
 .\"
 .\" From @(#)setlocale.3	8.1 (Berkeley) 6/9/93
 .\" From FreeBSD: src/lib/libc/locale/setlocale.3,v 1.28 2003/11/15 02:26:04 tjr Exp
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/localeconv.3 321160 2017-07-18 18:37:56Z ngie $
 .\"
 .Dd November 21, 2003
 .Dt LOCALECONV 3
@@ -202,7 +203,8 @@
 .Pp
 The
 .Fn localeconv_l
-function takes an explicit locale parameter.  For more information, see
+function takes an explicit locale parameter.
+For more information, see
 .Xr xlocale 3 .
 .Sh RETURN VALUES
 The


Property changes on: trunk/lib/libc/locale/localeconv.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/localeconv.c
===================================================================
--- trunk/lib/libc/locale/localeconv.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/localeconv.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 2001 Alexey Zelkin <phantom at FreeBSD.org>
  * Copyright (c) 1991, 1993
@@ -37,7 +38,7 @@
 static char sccsid[] = "@(#)localeconv.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/localeconv.c 227753 2011-11-20 14:45:42Z theraven $");
 
 #include <locale.h>
 

Modified: trunk/lib/libc/locale/mblen.3
===================================================================
--- trunk/lib/libc/locale/mblen.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/mblen.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2002-2004 Tim J. Robbins. All rights reserved.
 .\" Copyright (c) 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -31,7 +32,7 @@
 .\"
 .\" From @(#)multibyte.3	8.1 (Berkeley) 6/4/93
 .\" From FreeBSD: src/lib/libc/locale/multibyte.3,v 1.22 2003/11/08 03:23:11 tjr Exp
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/mblen.3 165903 2007-01-09 00:28:16Z imp $
 .\"
 .Dd April 11, 2004
 .Dt MBLEN 3


Property changes on: trunk/lib/libc/locale/mblen.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/mblen.c
===================================================================
--- trunk/lib/libc/locale/mblen.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/mblen.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2002-2004 Tim J. Robbins.
  * All rights reserved.
@@ -30,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/mblen.c 227753 2011-11-20 14:45:42Z theraven $");
 
 #include <stdlib.h>
 #include <wchar.h>

Modified: trunk/lib/libc/locale/mblocal.h
===================================================================
--- trunk/lib/libc/locale/mblocal.h	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/mblocal.h	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2004 Tim J. Robbins.
  * All rights reserved.
@@ -28,7 +29,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/lib/libc/locale/mblocal.h 227753 2011-11-20 14:45:42Z theraven $
  */
 
 #ifndef _MBLOCAL_H_

Modified: trunk/lib/libc/locale/mbrlen.3
===================================================================
--- trunk/lib/libc/locale/mbrlen.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/mbrlen.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2002-2004 Tim J. Robbins
 .\" All rights reserved.
 .\"
@@ -22,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/mbrlen.3 131360 2004-06-30 19:32:41Z ru $
 .\"
 .Dd April 7, 2004
 .Dt MBRLEN 3


Property changes on: trunk/lib/libc/locale/mbrlen.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/mbrlen.c
===================================================================
--- trunk/lib/libc/locale/mbrlen.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/mbrlen.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2002-2004 Tim J. Robbins.
  * All rights reserved.
@@ -30,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/mbrlen.c 227753 2011-11-20 14:45:42Z theraven $");
 
 #include <wchar.h>
 #include "mblocal.h"

Added: trunk/lib/libc/locale/mbrtoc16.c
===================================================================
--- trunk/lib/libc/locale/mbrtoc16.c	                        (rev 0)
+++ trunk/lib/libc/locale/mbrtoc16.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -0,0 +1,90 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2013 Ed Schouten <ed at FreeBSD.org>
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/mbrtoc16.c 250883 2013-05-21 19:59:37Z ed $");
+
+#include <uchar.h>
+#include "xlocale_private.h"
+
+typedef struct {
+	char16_t	trail_surrogate;
+	mbstate_t	c32_mbstate;
+} _Char16State;
+
+size_t
+mbrtoc16_l(char16_t * __restrict pc16, const char * __restrict s, size_t n,
+    mbstate_t * __restrict ps, locale_t locale)
+{
+	_Char16State *cs;
+	char32_t c32;
+	ssize_t len;
+
+	FIX_LOCALE(locale);
+	if (ps == NULL)
+		ps = &locale->mbrtoc16;
+	cs = (_Char16State *)ps;
+
+	/*
+	 * Call straight into mbrtoc32_l() if we don't need to return a
+	 * character value. According to the spec, if s is a null
+	 * pointer, the value of parameter pc16 is also ignored.
+	 */
+	if (pc16 == NULL || s == NULL) {
+		cs->trail_surrogate = 0;
+		return (mbrtoc32_l(NULL, s, n, &cs->c32_mbstate, locale));
+	}
+
+	/* Return the trail surrogate from the previous invocation. */
+	if (cs->trail_surrogate >= 0xdc00 && cs->trail_surrogate <= 0xdfff) {
+		*pc16 = cs->trail_surrogate;
+		cs->trail_surrogate = 0;
+		return ((size_t)-3);
+	}
+
+	len = mbrtoc32_l(&c32, s, n, &cs->c32_mbstate, locale);
+	if (len >= 0) {
+		if (c32 < 0x10000) {
+			/* Fits in one UTF-16 character. */
+			*pc16 = c32;
+		} else {
+			/* Split up in a surrogate pair. */
+			c32 -= 0x10000;
+			*pc16 = 0xd800 | (c32 >> 10);
+			cs->trail_surrogate = 0xdc00 | (c32 & 0x3ff);
+		}
+	}
+	return (len);
+}
+
+size_t
+mbrtoc16(char16_t * __restrict pc16, const char * __restrict s, size_t n,
+    mbstate_t * __restrict ps)
+{
+
+	return (mbrtoc16_l(pc16, s, n, ps, __get_locale()));
+}


Property changes on: trunk/lib/libc/locale/mbrtoc16.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/lib/libc/locale/mbrtoc16_iconv.c
===================================================================
--- trunk/lib/libc/locale/mbrtoc16_iconv.c	                        (rev 0)
+++ trunk/lib/libc/locale/mbrtoc16_iconv.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -0,0 +1,9 @@
+/* $MidnightBSD$ */
+/* $FreeBSD: stable/10/lib/libc/locale/mbrtoc16_iconv.c 251314 2013-06-03 17:17:56Z ed $ */
+#define	charXX_t	char16_t
+#define	mbrtocXX	mbrtoc16
+#define	mbrtocXX_l	mbrtoc16_l
+#define	DSTBUF_LEN	2
+#define	UTF_XX_INTERNAL	"UTF-16-INTERNAL"
+
+#include "mbrtocXX_iconv.h"


Property changes on: trunk/lib/libc/locale/mbrtoc16_iconv.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/lib/libc/locale/mbrtoc32.c
===================================================================
--- trunk/lib/libc/locale/mbrtoc32.c	                        (rev 0)
+++ trunk/lib/libc/locale/mbrtoc32.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -0,0 +1,54 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2013 Ed Schouten <ed at FreeBSD.org>
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/mbrtoc32.c 250883 2013-05-21 19:59:37Z ed $");
+
+#include <uchar.h>
+#include <wchar.h>
+#include "xlocale_private.h"
+
+size_t
+mbrtoc32_l(char32_t * __restrict pc32, const char * __restrict s, size_t n,
+    mbstate_t * __restrict ps, locale_t locale)
+{
+
+	FIX_LOCALE(locale);
+	if (ps == NULL)
+		ps = &locale->mbrtoc32;
+
+	/* Assume wchar_t uses UTF-32. */
+	return (mbrtowc_l(pc32, s, n, ps, locale));
+}
+
+size_t
+mbrtoc32(char32_t * __restrict pc32, const char * __restrict s, size_t n,
+    mbstate_t * __restrict ps)
+{
+
+	return (mbrtoc32_l(pc32, s, n, ps, __get_locale()));
+}


Property changes on: trunk/lib/libc/locale/mbrtoc32.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/lib/libc/locale/mbrtoc32_iconv.c
===================================================================
--- trunk/lib/libc/locale/mbrtoc32_iconv.c	                        (rev 0)
+++ trunk/lib/libc/locale/mbrtoc32_iconv.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -0,0 +1,9 @@
+/* $MidnightBSD$ */
+/* $FreeBSD: stable/10/lib/libc/locale/mbrtoc32_iconv.c 251314 2013-06-03 17:17:56Z ed $ */
+#define	charXX_t	char32_t
+#define	mbrtocXX	mbrtoc32
+#define	mbrtocXX_l	mbrtoc32_l
+#define	DSTBUF_LEN	1
+#define	UTF_XX_INTERNAL	"UTF-32-INTERNAL"
+
+#include "mbrtocXX_iconv.h"


Property changes on: trunk/lib/libc/locale/mbrtoc32_iconv.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/lib/libc/locale/mbrtocXX_iconv.h
===================================================================
--- trunk/lib/libc/locale/mbrtocXX_iconv.h	                        (rev 0)
+++ trunk/lib/libc/locale/mbrtocXX_iconv.h	2018-06-08 02:30:57 UTC (rev 10577)
@@ -0,0 +1,159 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2013 Ed Schouten <ed at FreeBSD.org>
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/mbrtocXX_iconv.h 282275 2015-04-30 16:08:47Z tijl $");
+
+#include <sys/queue.h>
+
+#include <assert.h>
+#include <errno.h>
+#include <langinfo.h>
+#include <limits.h>
+#include <string.h>
+#include <uchar.h>
+
+#include "../iconv/citrus_hash.h"
+#include "../iconv/citrus_module.h"
+#include "../iconv/citrus_iconv.h"
+#include "xlocale_private.h"
+
+typedef struct {
+	bool			initialized;
+	struct _citrus_iconv	iconv;
+	char			srcbuf[MB_LEN_MAX];
+	size_t			srcbuf_len;
+	union {
+		charXX_t	widechar[DSTBUF_LEN];
+		char		bytes[sizeof(charXX_t) * DSTBUF_LEN];
+	} dstbuf;
+	size_t			dstbuf_len;
+} _ConversionState;
+_Static_assert(sizeof(_ConversionState) <= sizeof(mbstate_t),
+    "Size of _ConversionState must not exceed mbstate_t's size.");
+
+size_t
+mbrtocXX_l(charXX_t * __restrict pc, const char * __restrict s, size_t n,
+    mbstate_t * __restrict ps, locale_t locale)
+{
+	_ConversionState *cs;
+	struct _citrus_iconv *handle;
+	size_t i, retval;
+	charXX_t retchar;
+
+	FIX_LOCALE(locale);
+	if (ps == NULL)
+		ps = &locale->mbrtocXX;
+	cs = (_ConversionState *)ps;
+	handle = &cs->iconv;
+
+	/* Reinitialize mbstate_t. */
+	if (s == NULL || !cs->initialized) {
+		if (_citrus_iconv_open(&handle,
+		    nl_langinfo_l(CODESET, locale), UTF_XX_INTERNAL) != 0) {
+			cs->initialized = false;
+			errno = EINVAL;
+			return (-1);
+		}
+		handle->cv_shared->ci_discard_ilseq = true;
+		handle->cv_shared->ci_hooks = NULL;
+		cs->srcbuf_len = cs->dstbuf_len = 0;
+		cs->initialized = true;
+		if (s == NULL)
+			return (0);
+	}
+
+	/* See if we still have characters left from the previous invocation. */
+	if (cs->dstbuf_len > 0) {
+		retval = (size_t)-3;
+		goto return_char;
+	}
+
+	/* Fill up the read buffer as far as possible. */
+	if (n > sizeof(cs->srcbuf) - cs->srcbuf_len)
+		n = sizeof(cs->srcbuf) - cs->srcbuf_len;
+	memcpy(cs->srcbuf + cs->srcbuf_len, s, n);
+
+	/* Convert as few characters to the dst buffer as possible. */
+	for (i = 0; ; i++) {
+		char *src, *dst;
+		size_t srcleft, dstleft, invlen;
+		int err;
+
+		src = cs->srcbuf;
+		srcleft = cs->srcbuf_len + n;
+		dst = cs->dstbuf.bytes;
+		dstleft = i * sizeof(charXX_t);
+		assert(srcleft <= sizeof(cs->srcbuf) &&
+		    dstleft <= sizeof(cs->dstbuf.bytes));
+		err = _citrus_iconv_convert(handle, &src, &srcleft,
+		    &dst, &dstleft, 0, &invlen);
+		cs->dstbuf_len = (dst - cs->dstbuf.bytes) / sizeof(charXX_t);
+
+		/* Got new character(s). Return the first. */
+		if (cs->dstbuf_len > 0) {
+			assert(src - cs->srcbuf > cs->srcbuf_len);
+			retval = src - cs->srcbuf - cs->srcbuf_len;
+			cs->srcbuf_len = 0;
+			goto return_char;
+		}
+
+		/* Increase dst buffer size, to obtain the surrogate pair. */
+		if (err == E2BIG)
+			continue;
+
+		/* Illegal sequence. */
+		if (invlen > 0) {
+			cs->srcbuf_len = 0;
+			errno = EILSEQ;
+			return ((size_t)-1);
+		}
+
+		/* Save unprocessed remainder for the next invocation. */
+		memmove(cs->srcbuf, src, srcleft);
+		cs->srcbuf_len = srcleft;
+		return ((size_t)-2);
+	}
+
+return_char:
+	retchar = cs->dstbuf.widechar[0];
+	memmove(&cs->dstbuf.widechar[0], &cs->dstbuf.widechar[1],
+	    --cs->dstbuf_len * sizeof(charXX_t));
+	if (pc != NULL)
+		*pc = retchar;
+	if (retchar == 0)
+		return (0);
+	return (retval);
+}
+
+size_t
+mbrtocXX(charXX_t * __restrict pc, const char * __restrict s, size_t n,
+    mbstate_t * __restrict ps)
+{
+
+	return (mbrtocXX_l(pc, s, n, ps, __get_locale()));
+}


Property changes on: trunk/lib/libc/locale/mbrtocXX_iconv.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/lib/libc/locale/mbrtowc.3
===================================================================
--- trunk/lib/libc/locale/mbrtowc.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/mbrtowc.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2002-2004 Tim J. Robbins
 .\" All rights reserved.
 .\"
@@ -22,13 +23,15 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/mbrtowc.3 250883 2013-05-21 19:59:37Z ed $
 .\"
-.Dd April 8, 2004
+.Dd May 21, 2013
 .Dt MBRTOWC 3
 .Os
 .Sh NAME
-.Nm mbrtowc
+.Nm mbrtowc ,
+.Nm mbrtoc16 ,
+.Nm mbrtoc32
 .Nd "convert a character to a wide-character code (restartable)"
 .Sh LIBRARY
 .Lb libc
@@ -36,13 +39,27 @@
 .In wchar.h
 .Ft size_t
 .Fo mbrtowc
-.Fa "wchar_t * restrict pwc" "const char * restrict s" "size_t n"
+.Fa "wchar_t * restrict pc" "const char * restrict s" "size_t n"
 .Fa "mbstate_t * restrict ps"
 .Fc
+.In uchar.h
+.Ft size_t
+.Fo mbrtoc16
+.Fa "char16_t * restrict pc" "const char * restrict s" "size_t n"
+.Fa "mbstate_t * restrict ps"
+.Fc
+.Ft size_t
+.Fo mbrtoc32
+.Fa "char32_t * restrict pc" "const char * restrict s" "size_t n"
+.Fa "mbstate_t * restrict ps"
+.Fc
 .Sh DESCRIPTION
 The
-.Fn mbrtowc
-function inspects at most
+.Fn mbrtowc ,
+.Fn mbrtoc16
+and
+.Fn mbrtoc32
+functions inspect at most
 .Fa n
 bytes pointed to by
 .Fa s
@@ -49,13 +66,16 @@
 to determine the number of bytes needed to complete the next multibyte
 character.
 If a character can be completed, and
-.Fa pwc
+.Fa pc
 is not
 .Dv NULL ,
 the wide character which is represented by
 .Fa s
 is stored in the
-.Vt wchar_t
+.Vt wchar_t ,
+.Vt char16_t
+or
+.Vt char32_t
 it points to.
 .Pp
 If
@@ -62,9 +82,8 @@
 .Fa s
 is
 .Dv NULL ,
-.Fn mbrtowc
-behaves as if
-.Fa pwc
+these functions behave as if
+.Fa pc
 was
 .Dv NULL ,
 .Fa s
@@ -81,15 +100,24 @@
 is used to keep track of the shift state.
 If it is
 .Dv NULL ,
-.Fn mbrtowc
-uses an internal, static
+these functions use an internal, static
 .Vt mbstate_t
 object, which is initialized to the initial conversion state
 at program startup.
+.Pp
+As a single
+.Vt char16_t
+is not large enough to represent certain multibyte characters, the
+.Fn mbrtoc16
+function may need to be invoked multiple times to convert a single
+multibyte character sequence.
 .Sh RETURN VALUES
 The
-.Fn mbrtowc
-functions returns:
+.Fn mbrtowc ,
+.Fn mbrtoc16
+and
+.Fn mbrtoc32
+functions return:
 .Bl -tag -width indent
 .It 0
 The next
@@ -100,10 +128,13 @@
 .It >0
 The next
 .Fa n
-or fewer bytes
-represent a valid character,
-.Fn mbrtowc
-returns the number of bytes used to complete the multibyte character.
+or fewer bytes represent a valid character, these functions
+return the number of bytes used to complete the multibyte character.
+.It Po Vt size_t Pc Ns \-1
+An encoding error has occurred.
+The next
+.Fa n
+or fewer bytes do not contribute to a valid multibyte character.
 .It Po Vt size_t Pc Ns \-2
 The next
 .Fa n
@@ -111,16 +142,23 @@
 and all
 .Fa n
 bytes have been processed.
-.It Po Vt size_t Pc Ns \-1
-An encoding error has occurred.
-The next
-.Fa n
-or fewer bytes do not contribute to a valid multibyte character.
 .El
+.Pp
+The
+.Fn mbrtoc16
+function also returns:
+.Bl -tag -width indent
+.It Po Vt size_t Pc Ns \-3
+The next character resulting from a previous call has been stored.
+No bytes from the input have been consumed.
+.El
 .Sh ERRORS
 The
-.Fn mbrtowc
-function will fail if:
+.Fn mbrtowc ,
+.Fn mbrtoc16
+and
+.Fn mbrtoc32
+functions will fail if:
 .Bl -tag -width Er
 .It Bq Er EILSEQ
 An invalid multibyte sequence was detected.
@@ -134,6 +172,9 @@
 .Xr wcrtomb 3
 .Sh STANDARDS
 The
-.Fn mbrtowc
-function conforms to
-.St -isoC-99 .
+.Fn mbrtowc ,
+.Fn mbrtoc16
+and
+.Fn mbrtoc32
+functions conform to
+.St -isoC-2011 .


Property changes on: trunk/lib/libc/locale/mbrtowc.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/mbrtowc.c
===================================================================
--- trunk/lib/libc/locale/mbrtowc.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/mbrtowc.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2002-2004 Tim J. Robbins.
  * All rights reserved.
@@ -30,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/mbrtowc.c 227753 2011-11-20 14:45:42Z theraven $");
 
 #include <wchar.h>
 #include "mblocal.h"

Modified: trunk/lib/libc/locale/mbsinit.3
===================================================================
--- trunk/lib/libc/locale/mbsinit.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/mbsinit.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2002-2004 Tim J. Robbins
 .\" All rights reserved.
 .\"
@@ -22,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/mbsinit.3 128032 2004-04-08 09:59:02Z tjr $
 .\"
 .Dd April 8, 2004
 .Dt MBSINIT 3


Property changes on: trunk/lib/libc/locale/mbsinit.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/mbsinit.c
===================================================================
--- trunk/lib/libc/locale/mbsinit.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/mbsinit.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2002-2004 Tim J. Robbins.
  * All rights reserved.
@@ -30,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/mbsinit.c 227753 2011-11-20 14:45:42Z theraven $");
 
 #include <wchar.h>
 #include "mblocal.h"

Modified: trunk/lib/libc/locale/mbsnrtowcs.c
===================================================================
--- trunk/lib/libc/locale/mbsnrtowcs.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/mbsnrtowcs.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2002-2004 Tim J. Robbins.
  *
@@ -30,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/mbsnrtowcs.c 227753 2011-11-20 14:45:42Z theraven $");
 
 #include <errno.h>
 #include <limits.h>

Modified: trunk/lib/libc/locale/mbsrtowcs.3
===================================================================
--- trunk/lib/libc/locale/mbsrtowcs.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/mbsrtowcs.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2002-2004 Tim J. Robbins
 .\" All rights reserved.
 .\"
@@ -22,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/mbsrtowcs.3 140081 2005-01-11 20:50:51Z ru $
 .Dd July 21, 2004
 .Dt MBSRTOWCS 3
 .Os


Property changes on: trunk/lib/libc/locale/mbsrtowcs.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/mbsrtowcs.c
===================================================================
--- trunk/lib/libc/locale/mbsrtowcs.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/mbsrtowcs.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2002-2004 Tim J. Robbins.
  * All rights reserved.
@@ -30,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/mbsrtowcs.c 227753 2011-11-20 14:45:42Z theraven $");
 
 #include <errno.h>
 #include <limits.h>

Modified: trunk/lib/libc/locale/mbstowcs.3
===================================================================
--- trunk/lib/libc/locale/mbstowcs.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/mbstowcs.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2002-2004 Tim J. Robbins. All rights reserved.
 .\" Copyright (c) 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -31,7 +32,7 @@
 .\"
 .\" From @(#)multibyte.3	8.1 (Berkeley) 6/4/93
 .\" From FreeBSD: src/lib/libc/locale/multibyte.3,v 1.22 2003/11/08 03:23:11 tjr Exp
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/mbstowcs.3 165903 2007-01-09 00:28:16Z imp $
 .\"
 .Dd April 8, 2004
 .Dt MBSTOWCS 3


Property changes on: trunk/lib/libc/locale/mbstowcs.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/mbstowcs.c
===================================================================
--- trunk/lib/libc/locale/mbstowcs.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/mbstowcs.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2002-2004 Tim J. Robbins.
  * All rights reserved.
@@ -30,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/mbstowcs.c 227753 2011-11-20 14:45:42Z theraven $");
 
 #include <limits.h>
 #include <stdlib.h>

Modified: trunk/lib/libc/locale/mbtowc.3
===================================================================
--- trunk/lib/libc/locale/mbtowc.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/mbtowc.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2002-2004 Tim J. Robbins. All rights reserved.
 .\" Copyright (c) 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -31,7 +32,7 @@
 .\"
 .\" From @(#)multibyte.3	8.1 (Berkeley) 6/4/93
 .\" From FreeBSD: src/lib/libc/locale/multibyte.3,v 1.22 2003/11/08 03:23:11 tjr Exp
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/mbtowc.3 165903 2007-01-09 00:28:16Z imp $
 .\"
 .Dd April 11, 2004
 .Dt MBTOWC 3


Property changes on: trunk/lib/libc/locale/mbtowc.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/mbtowc.c
===================================================================
--- trunk/lib/libc/locale/mbtowc.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/mbtowc.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2002-2004 Tim J. Robbins.
  * All rights reserved.
@@ -30,8 +31,9 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/mbtowc.c 297440 2016-03-31 01:36:50Z pfg $");
 
+#include <errno.h>
 #include <stdlib.h>
 #include <wchar.h>
 #include "mblocal.h"
@@ -49,9 +51,15 @@
 		return (0);
 	}
 	rval = XLOCALE_CTYPE(locale)->__mbrtowc(pwc, s, n, &locale->mbtowc);
-	if (rval == (size_t)-1 || rval == (size_t)-2)
+	switch (rval) {
+	case (size_t)-2:
+		errno = EILSEQ;
+		/* FALLTHROUGH */
+	case (size_t)-1:
 		return (-1);
-	return ((int)rval);
+	default:
+		return ((int)rval);
+	}
 }
 int
 mbtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n)

Modified: trunk/lib/libc/locale/mskanji.5
===================================================================
--- trunk/lib/libc/locale/mskanji.5	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/mskanji.5	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2002, 2003 Tim J. Robbins
 .\" All rights reserved.
 .\"
@@ -22,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/mskanji.5 131608 2004-07-05 06:39:03Z ru $
 .\"
 .Dd August 7, 2003
 .Dt MSKANJI 5


Property changes on: trunk/lib/libc/locale/mskanji.5
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/mskanji.c
===================================================================
--- trunk/lib/libc/locale/mskanji.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/mskanji.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 2002-2004 Tim J. Robbins. All rights reserved.
  *
@@ -42,7 +43,7 @@
 static char sccsid[] = "@(#)mskanji.c	1.0 (Phase One) 5/5/95";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/mskanji.c 297798 2016-04-11 02:21:42Z ache $");
 
 #include <sys/types.h>
 #include <errno.h>
@@ -73,7 +74,7 @@
 	l->__mbsinit = _MSKanji_mbsinit;
 	l->runes = rl;
 	l->__mb_cur_max = 2;
-	l->__mb_sb_limit = 256;
+	l->__mb_sb_limit = 224;
 	return (0);
 }
 

Modified: trunk/lib/libc/locale/multibyte.3
===================================================================
--- trunk/lib/libc/locale/multibyte.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/multibyte.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2002-2004 Tim J. Robbins. All rights reserved.
 .\" Copyright (c) 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -30,7 +31,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)multibyte.3	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/multibyte.3 165903 2007-01-09 00:28:16Z imp $
 .\"
 .Dd April 8, 2004
 .Dt MULTIBYTE 3


Property changes on: trunk/lib/libc/locale/multibyte.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/newlocale.3
===================================================================
--- trunk/lib/libc/locale/newlocale.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/newlocale.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2011 The FreeBSD Foundation
 .\" All rights reserved.
 .\"
@@ -25,8 +26,8 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
-.Dd September 17 2011
+.\" $FreeBSD: stable/10/lib/libc/locale/newlocale.3 250244 2013-05-04 17:06:47Z pluknet $
+.Dd September 17, 2011
 .Dt NEWLOCALE 3
 .Os
 .Sh NAME
@@ -51,7 +52,7 @@
 The
 .Fa mask
 is either
-.Fa LC_ALL_MASK,
+.Fa LC_ALL_MASK ,
 indicating all possible locale components,
 or the logical OR of some combination of the following:
 .Bl -tag -width "LC_MESSAGES_MASK" -offset indent
@@ -59,7 +60,7 @@
 The locale for string collation routines.
 This controls alphabetic ordering in
 .Xr strcoll 3
- and
+and
 .Xr strxfrm 3 .
 .It LC_CTYPE_MASK
 The locale for the


Property changes on: trunk/lib/libc/locale/newlocale.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/nextwctype.3
===================================================================
--- trunk/lib/libc/locale/nextwctype.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/nextwctype.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"
 .\" Copyright (c) 2004 Tim J. Robbins
 .\" All rights reserved.
@@ -23,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/nextwctype.3 148232 2005-07-21 10:27:45Z tjr $
 .\"
 .Dd July 21, 2005
 .Dt NEXTWCTYPE 3


Property changes on: trunk/lib/libc/locale/nextwctype.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/nextwctype.c
===================================================================
--- trunk/lib/libc/locale/nextwctype.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/nextwctype.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2004 Tim J. Robbins.
  * All rights reserved.
@@ -30,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/nextwctype.c 227753 2011-11-20 14:45:42Z theraven $");
 
 #include <runetype.h>
 #include <wchar.h>

Modified: trunk/lib/libc/locale/nl_langinfo.3
===================================================================
--- trunk/lib/libc/locale/nl_langinfo.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/nl_langinfo.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2001 Alexey Zelkin <phantom at FreeBSD.org>
 .\" All rights reserved.
 .\"
@@ -22,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/nl_langinfo.3 238919 2012-07-30 20:56:19Z issyl0 $
 .\"
 .Dd July 30, 2012
 .Dt NL_LANGINFO 3


Property changes on: trunk/lib/libc/locale/nl_langinfo.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/nl_langinfo.c
===================================================================
--- trunk/lib/libc/locale/nl_langinfo.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/nl_langinfo.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2001, 2003 Alexey Zelkin <phantom at FreeBSD.org>
  * All rights reserved.
@@ -30,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/nl_langinfo.c 227753 2011-11-20 14:45:42Z theraven $");
 
 #include <langinfo.h>
 #include <limits.h>

Modified: trunk/lib/libc/locale/nomacros.c
===================================================================
--- trunk/lib/libc/locale/nomacros.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/nomacros.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,5 +1,6 @@
+/* $MidnightBSD$ */
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/nomacros.c 232626 2012-03-06 21:56:30Z dim $");
 
 /*
  * Tell <ctype.h> to generate extern versions of all its inline

Modified: trunk/lib/libc/locale/none.c
===================================================================
--- trunk/lib/libc/locale/none.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/none.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2002-2004 Tim J. Robbins. All rights reserved.
  * Copyright (c) 1993
@@ -40,7 +41,7 @@
 static char sccsid[] = "@(#)none.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/none.c 301245 2016-06-03 07:34:59Z ache $");
 
 #include <errno.h>
 #include <limits.h>
@@ -172,6 +173,7 @@
 	nchr = 0;
 	while (len-- > 0 && nwc-- > 0) {
 		if (*s < 0 || *s > UCHAR_MAX) {
+			*src = s;
 			errno = EILSEQ;
 			return ((size_t)-1);
 		}

Modified: trunk/lib/libc/locale/querylocale.3
===================================================================
--- trunk/lib/libc/locale/querylocale.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/querylocale.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2011 The FreeBSD Foundation
 .\" All rights reserved.
 .\"
@@ -25,7 +26,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/querylocale.3 250209 2013-05-03 12:42:43Z pluknet $
 .\"
 .Dd May 3, 2013
 .Dt QUERYLOCALE 3
@@ -32,7 +33,7 @@
 .Os
 .Sh NAME
 .Nm querylocale
-.Nd Look up the locale name for a specified category.
+.Nd Look up the locale name for a specified category
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
@@ -41,7 +42,7 @@
 .Fn querylocale "int mask" "locale_t locale"
 .Sh DESCRIPTION
 Returns the name of the locale for the category specified by
-.Fa mask.
+.Fa mask .
 This possible values for the mask are the same as those in
 .Xr newlocale 3 .
 If more than one bit in the mask is set, the returned value is undefined.


Property changes on: trunk/lib/libc/locale/querylocale.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/rpmatch.3
===================================================================
--- trunk/lib/libc/locale/rpmatch.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/rpmatch.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"
 .\" Copyright (c) 2005 Tim J. Robbins
 .\" All rights reserved.
@@ -23,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/rpmatch.3 148234 2005-07-21 10:53:27Z tjr $
 .\"
 .Dd July 21, 2005
 .Dt RPMATCH 3


Property changes on: trunk/lib/libc/locale/rpmatch.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/rpmatch.c
===================================================================
--- trunk/lib/libc/locale/rpmatch.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/rpmatch.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2004-2005 Tim J. Robbins.
  * All rights reserved.
@@ -25,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/rpmatch.c 139922 2005-01-09 03:55:13Z tjr $");
 
 #include <langinfo.h>
 #include <regex.h>

Modified: trunk/lib/libc/locale/rune.c
===================================================================
--- trunk/lib/libc/locale/rune.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/rune.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -34,7 +35,7 @@
 static char sccsid[] = "@(#)rune.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/rune.c 165903 2007-01-09 00:28:16Z imp $");
 
 #include "namespace.h"
 #include <arpa/inet.h>

Modified: trunk/lib/libc/locale/runefile.h
===================================================================
--- trunk/lib/libc/locale/runefile.h	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/runefile.h	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2005 Ruslan Ermilov
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/lib/libc/locale/runefile.h 146261 2005-05-16 09:32:41Z ru $
  */
 
 #ifndef _RUNEFILE_H_

Modified: trunk/lib/libc/locale/runetype.c
===================================================================
--- trunk/lib/libc/locale/runetype.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/runetype.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -36,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/runetype.c 227753 2011-11-20 14:45:42Z theraven $");
 
 #include <ctype.h>
 #include <stdio.h>

Modified: trunk/lib/libc/locale/setlocale.3
===================================================================
--- trunk/lib/libc/locale/setlocale.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/setlocale.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -29,7 +30,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)setlocale.3	8.1 (Berkeley) 6/9/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/setlocale.3 213573 2010-10-08 12:40:16Z uqs $
 .\"
 .Dd November 21, 2003
 .Dt SETLOCALE 3


Property changes on: trunk/lib/libc/locale/setlocale.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/setlocale.c
===================================================================
--- trunk/lib/libc/locale/setlocale.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/setlocale.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 1996 - 2002 FreeBSD Project
  * Copyright (c) 1991, 1993
@@ -35,7 +36,7 @@
 static char sccsid[] = "@(#)setlocale.c	8.1 (Berkeley) 7/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/setlocale.c 228921 2011-12-27 23:28:01Z jilles $");
 
 #include <sys/types.h>
 #include <sys/stat.h>

Modified: trunk/lib/libc/locale/setlocale.h
===================================================================
--- trunk/lib/libc/locale/setlocale.h	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/setlocale.h	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (C) 1997 by Andrey A. Chernov, Moscow, Russia.
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/lib/libc/locale/setlocale.h 117270 2003-07-06 02:03:37Z ache $
  */
 
 #ifndef _SETLOCALE_H_

Modified: trunk/lib/libc/locale/setrunelocale.c
===================================================================
--- trunk/lib/libc/locale/setrunelocale.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/setrunelocale.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -36,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/setrunelocale.c 284524 2015-06-17 19:12:18Z delphij $");
 
 #define __RUNETYPE_INTERNAL 1
 
@@ -129,7 +130,7 @@
 	(void) strcat(name, encoding);
 	(void) strcat(name, "/LC_CTYPE");
 
-	if ((fp = fopen(name, "r")) == NULL)
+	if ((fp = fopen(name, "re")) == NULL)
 		return (errno == 0 ? ENOENT : errno);
 
 	if ((rl = _Read_RuneMagi(fp)) == NULL) {
@@ -202,6 +203,8 @@
 
 	if (loc == NULL) {
 		_ThreadRuneLocale = &_DefaultRuneLocale;
+	} else if (loc == LC_GLOBAL_LOCALE) {
+		_ThreadRuneLocale = 0;
 	} else {
 		_ThreadRuneLocale = XLOCALE_CTYPE(loc)->runes;
 	}

Modified: trunk/lib/libc/locale/table.c
===================================================================
--- trunk/lib/libc/locale/table.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/table.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -39,7 +40,7 @@
 static char sccsid[] = "@(#)table.c	8.1 (Berkeley) 6/27/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/table.c 232498 2012-03-04 15:31:13Z theraven $");
 
 #include <ctype.h>
 #include <runetype.h>

Modified: trunk/lib/libc/locale/toascii.3
===================================================================
--- trunk/lib/libc/locale/toascii.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/toascii.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)toascii.3	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/toascii.3 196820 2009-09-04 07:44:58Z des $
 .\"
 .Dd June 4, 1993
 .Dt TOASCII 3


Property changes on: trunk/lib/libc/locale/toascii.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/tolower.3
===================================================================
--- trunk/lib/libc/locale/tolower.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/tolower.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -30,7 +31,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)tolower.3	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/tolower.3 210468 2010-07-25 13:32:19Z bcr $
 .\"
 .Dd July 25, 2010
 .Dt TOLOWER 3


Property changes on: trunk/lib/libc/locale/tolower.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/tolower.c
===================================================================
--- trunk/lib/libc/locale/tolower.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/tolower.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -36,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/tolower.c 227753 2011-11-20 14:45:42Z theraven $");
 
 #include <ctype.h>
 #include <stdio.h>

Modified: trunk/lib/libc/locale/toupper.3
===================================================================
--- trunk/lib/libc/locale/toupper.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/toupper.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -30,7 +31,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)toupper.3	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/toupper.3 210468 2010-07-25 13:32:19Z bcr $
 .\"
 .Dd July 25, 2010
 .Dt TOUPPER 3


Property changes on: trunk/lib/libc/locale/toupper.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/toupper.c
===================================================================
--- trunk/lib/libc/locale/toupper.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/toupper.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -36,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/toupper.c 235239 2012-05-10 20:03:34Z dim $");
 
 #include <ctype.h>
 #include <stdio.h>

Modified: trunk/lib/libc/locale/towlower.3
===================================================================
--- trunk/lib/libc/locale/towlower.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/towlower.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -30,7 +31,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)tolower.3	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/towlower.3 165903 2007-01-09 00:28:16Z imp $
 .\"
 .Dd October 3, 2002
 .Dt TOWLOWER 3


Property changes on: trunk/lib/libc/locale/towlower.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/towupper.3
===================================================================
--- trunk/lib/libc/locale/towupper.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/towupper.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -30,7 +31,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)toupper.3	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/towupper.3 165903 2007-01-09 00:28:16Z imp $
 .\"
 .Dd October 3, 2002
 .Dt TOWUPPER 3


Property changes on: trunk/lib/libc/locale/towupper.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/uselocale.3
===================================================================
--- trunk/lib/libc/locale/uselocale.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/uselocale.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2011 The FreeBSD Foundation
 .\" All rights reserved.
 .\"
@@ -25,14 +26,14 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/uselocale.3 250244 2013-05-04 17:06:47Z pluknet $
 .\"
-.Dd September 17 2011
+.Dd September 17, 2011
 .Dt USELOCALE 3
 .Os
 .Sh NAME
 .Nm uselocale
-.Nd Sets a thread-local locale.
+.Nd Sets a thread-local locale
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS


Property changes on: trunk/lib/libc/locale/uselocale.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/utf8.5
===================================================================
--- trunk/lib/libc/locale/utf8.5	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/utf8.5	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -29,7 +30,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)utf2.4	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/utf8.5 165903 2007-01-09 00:28:16Z imp $
 .\"
 .Dd April 7, 2004
 .Dt UTF8 5


Property changes on: trunk/lib/libc/locale/utf8.5
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/utf8.c
===================================================================
--- trunk/lib/libc/locale/utf8.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/utf8.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,4 +1,6 @@
+/* $MidnightBSD$ */
 /*-
+ * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  * Copyright (c) 2002-2004 Tim J. Robbins
  * All rights reserved.
  *
@@ -30,7 +32,7 @@
  */
 
 #include <sys/param.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/utf8.c 287393 2015-09-02 05:55:57Z bapt $");
 
 #include <errno.h>
 #include <limits.h>
@@ -112,13 +114,6 @@
 		/* Incomplete multibyte sequence */
 		return ((size_t)-2);
 
-	if (us->want == 0 && ((ch = (unsigned char)*s) & ~0x7f) == 0) {
-		/* Fast path for plain ASCII characters. */
-		if (pwc != NULL)
-			*pwc = ch;
-		return (ch != '\0' ? 1 : 0);
-	}
-
 	if (us->want == 0) {
 		/*
 		 * Determine the number of octets that make up this character
@@ -134,10 +129,12 @@
 		 */
 		ch = (unsigned char)*s;
 		if ((ch & 0x80) == 0) {
-			mask = 0x7f;
-			want = 1;
-			lbound = 0;
-		} else if ((ch & 0xe0) == 0xc0) {
+			/* Fast path for plain ASCII characters. */
+			if (pwc != NULL)
+				*pwc = ch;
+			return (ch != '\0' ? 1 : 0);
+		}
+		if ((ch & 0xe0) == 0xc0) {
 			mask = 0x1f;
 			want = 2;
 			lbound = 0x80;
@@ -149,14 +146,6 @@
 			mask = 0x07;
 			want = 4;
 			lbound = 0x10000;
-		} else if ((ch & 0xfc) == 0xf8) {
-			mask = 0x03;
-			want = 5;
-			lbound = 0x200000;
-		} else if ((ch & 0xfe) == 0xfc) {
-			mask = 0x01;
-			want = 6;
-			lbound = 0x4000000;
 		} else {
 			/*
 			 * Malformed input; input is not UTF-8.
@@ -203,6 +192,13 @@
 		errno = EILSEQ;
 		return ((size_t)-1);
 	}
+	if ((wch >= 0xd800 && wch <= 0xdfff) || wch > 0x10ffff) {
+		/*
+		 * Malformed input; invalid code points.
+		 */
+		errno = EILSEQ;
+		return ((size_t)-1);
+	}
 	if (pwc != NULL)
 		*pwc = wch;
 	us->want = 0;
@@ -309,12 +305,6 @@
 		/* Reset to initial shift state (no-op) */
 		return (1);
 
-	if ((wc & ~0x7f) == 0) {
-		/* Fast path for plain ASCII characters. */
-		*s = (char)wc;
-		return (1);
-	}
-
 	/*
 	 * Determine the number of octets needed to represent this character.
 	 * We always output the shortest sequence possible. Also specify the
@@ -322,23 +312,22 @@
 	 * about the sequence length.
 	 */
 	if ((wc & ~0x7f) == 0) {
-		lead = 0;
-		len = 1;
+		/* Fast path for plain ASCII characters. */
+		*s = (char)wc;
+		return (1);
 	} else if ((wc & ~0x7ff) == 0) {
 		lead = 0xc0;
 		len = 2;
 	} else if ((wc & ~0xffff) == 0) {
+		if (wc >= 0xd800 && wc <= 0xdfff) {
+			errno = EILSEQ;
+			return ((size_t)-1);
+		}
 		lead = 0xe0;
 		len = 3;
-	} else if ((wc & ~0x1fffff) == 0) {
+	} else if (wc >= 0 && wc <= 0x10ffff) {
 		lead = 0xf0;
 		len = 4;
-	} else if ((wc & ~0x3ffffff) == 0) {
-		lead = 0xf8;
-		len = 5;
-	} else if ((wc & ~0x7fffffff) == 0) {
-		lead = 0xfc;
-		len = 6;
 	} else {
 		errno = EILSEQ;
 		return ((size_t)-1);

Modified: trunk/lib/libc/locale/wcrtomb.3
===================================================================
--- trunk/lib/libc/locale/wcrtomb.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/wcrtomb.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2002-2004 Tim J. Robbins
 .\" All rights reserved.
 .\"
@@ -22,13 +23,15 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/wcrtomb.3 250883 2013-05-21 19:59:37Z ed $
 .\"
-.Dd April 8, 2004
+.Dd May 21, 2013
 .Dt WCRTOMB 3
 .Os
 .Sh NAME
-.Nm wcrtomb
+.Nm wcrtomb ,
+.Nm c16rtomb ,
+.Nm c32rtomb
 .Nd "convert a wide-character code to a character (restartable)"
 .Sh LIBRARY
 .Lb libc
@@ -35,13 +38,21 @@
 .Sh SYNOPSIS
 .In wchar.h
 .Ft size_t
-.Fn wcrtomb "char * restrict s" "wchar_t wc" "mbstate_t * restrict ps"
+.Fn wcrtomb "char * restrict s" "wchar_t c" "mbstate_t * restrict ps"
+.In uchar.h
+.Ft size_t
+.Fn c16rtomb "char * restrict s" "char16_t c" "mbstate_t * restrict ps"
+.Ft size_t
+.Fn c32rtomb "char * restrict s" "char32_t c" "mbstate_t * restrict ps"
 .Sh DESCRIPTION
 The
-.Fn wcrtomb
-function stores a multibyte sequence representing the
+.Fn wcrtomb ,
+.Fn c16rtomb
+and
+.Fn c32rtomb
+functions store a multibyte sequence representing the
 wide character
-.Fa wc ,
+.Fa c ,
 including any necessary shift sequences, to the
 character array
 .Fa s ,
@@ -53,11 +64,10 @@
 .Fa s
 is
 .Dv NULL ,
-.Fn wcrtomb
-behaves as if
+these functions behave as if
 .Fa s
 pointed to an internal buffer and
-.Fa wc
+.Fa c
 was a null wide character (L'\e0').
 .Pp
 The
@@ -67,26 +77,32 @@
 is used to keep track of the shift state.
 If it is
 .Dv NULL ,
-.Fn wcrtomb
-uses an internal, static
+these functions use an internal, static
 .Vt mbstate_t
 object, which is initialized to the initial conversion state
 at program startup.
+.Pp
+As certain multibyte characters may only be represented by a series of
+16-bit characters, the
+.Fn c16rtomb
+may need to invoked multiple times before a multibyte sequence is
+returned.
 .Sh RETURN VALUES
-The
-.Fn wcrtomb
-functions returns the length (in bytes) of the multibyte sequence
+These functions return the length (in bytes) of the multibyte sequence
 needed to represent
-.Fa wc ,
+.Fa c ,
 or
 .Po Vt size_t Pc Ns \-1
 if
-.Fa wc
+.Fa c
 is not a valid wide character code.
 .Sh ERRORS
 The
-.Fn wcrtomb
-function will fail if:
+.Fn wcrtomb ,
+.Fn c16rtomb
+and
+.Fn c32rtomb
+functions will fail if:
 .Bl -tag -width Er
 .It Bq Er EILSEQ
 An invalid wide character code was specified.
@@ -100,6 +116,9 @@
 .Xr wctomb 3
 .Sh STANDARDS
 The
-.Fn wcrtomb
-function conforms to
-.St -isoC-99 .
+.Fn wcrtomb ,
+.Fn c16rtomb
+and
+.Fn c32rtomb
+functions conform to
+.St -isoC-2011 .


Property changes on: trunk/lib/libc/locale/wcrtomb.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/wcrtomb.c
===================================================================
--- trunk/lib/libc/locale/wcrtomb.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/wcrtomb.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2002-2004 Tim J. Robbins.
  * All rights reserved.
@@ -30,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/wcrtomb.c 227753 2011-11-20 14:45:42Z theraven $");
 
 #include <wchar.h>
 #include "mblocal.h"

Modified: trunk/lib/libc/locale/wcsftime.3
===================================================================
--- trunk/lib/libc/locale/wcsftime.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/wcsftime.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2002 Tim J. Robbins
 .\" All rights reserved.
 .\"
@@ -22,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/wcsftime.3 107392 2002-11-29 17:35:09Z ru $
 .\"
 .Dd September 8, 2002
 .Dt WCSFTIME 3


Property changes on: trunk/lib/libc/locale/wcsftime.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/wcsftime.c
===================================================================
--- trunk/lib/libc/locale/wcsftime.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/wcsftime.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2002 Tim J. Robbins
  * All rights reserved.
@@ -30,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/wcsftime.c 227753 2011-11-20 14:45:42Z theraven $");
 
 #include <errno.h>
 #include <limits.h>

Modified: trunk/lib/libc/locale/wcsnrtombs.c
===================================================================
--- trunk/lib/libc/locale/wcsnrtombs.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/wcsnrtombs.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2002-2004 Tim J. Robbins.
  * All rights reserved.
@@ -30,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/wcsnrtombs.c 227753 2011-11-20 14:45:42Z theraven $");
 
 #include <limits.h>
 #include <stdlib.h>

Modified: trunk/lib/libc/locale/wcsrtombs.3
===================================================================
--- trunk/lib/libc/locale/wcsrtombs.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/wcsrtombs.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2002-2004 Tim J. Robbins
 .\" All rights reserved.
 .\"
@@ -22,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/wcsrtombs.3 132497 2004-07-21 10:54:57Z tjr $
 .\"
 .Dd July 21, 2004
 .Dt WCSRTOMBS 3


Property changes on: trunk/lib/libc/locale/wcsrtombs.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/wcsrtombs.c
===================================================================
--- trunk/lib/libc/locale/wcsrtombs.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/wcsrtombs.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2002-2004 Tim J. Robbins.
  * All rights reserved.
@@ -30,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/wcsrtombs.c 227753 2011-11-20 14:45:42Z theraven $");
 
 #include <limits.h>
 #include <stdlib.h>

Modified: trunk/lib/libc/locale/wcstod.3
===================================================================
--- trunk/lib/libc/locale/wcstod.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/wcstod.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2002, 2003 Tim J. Robbins
 .\" All rights reserved.
 .\"
@@ -22,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/wcstod.3 115225 2003-05-22 13:02:28Z ru $
 .\"
 .Dd February 22, 2003
 .Dt WCSTOD 3


Property changes on: trunk/lib/libc/locale/wcstod.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/wcstod.c
===================================================================
--- trunk/lib/libc/locale/wcstod.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/wcstod.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2002 Tim J. Robbins
  * All rights reserved.
@@ -30,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/wcstod.c 309334 2016-11-30 20:48:44Z vangyzen $");
 
 #include <stdlib.h>
 #include <wchar.h>
@@ -54,11 +55,13 @@
 	mbstate_t mbs;
 	double val;
 	char *buf, *end;
-	const wchar_t *wcp = nptr;
+	const wchar_t *wcp;
 	size_t len;
-	size_t spaces = 0;
+	size_t spaces;
 	FIX_LOCALE(locale);
 
+	wcp = nptr;
+	spaces = 0;
 	while (iswspace_l(*wcp, locale)) {
 		wcp++;
 		spaces++;
@@ -80,8 +83,11 @@
 			*endptr = (wchar_t *)nptr;
 		return (0.0);
 	}
-	if ((buf = malloc(len + 1)) == NULL)
+	if ((buf = malloc(len + 1)) == NULL) {
+		if (endptr != NULL)
+			*endptr = (wchar_t *)nptr;
 		return (0.0);
+	}
 	mbs = initial;
 	wcsrtombs_l(buf, &wcp, len + 1, &mbs, locale);
 
@@ -95,13 +101,11 @@
 	 * corresponding position in the wide char string.
 	 */
 	if (endptr != NULL) {
-		/* XXX Assume each wide char is one byte. */
 		*endptr = (wchar_t *)nptr + (end - buf);
 		if (buf != end)
 			*endptr += spaces;
 	}
 
-
 	free(buf);
 
 	return (val);

Modified: trunk/lib/libc/locale/wcstof.c
===================================================================
--- trunk/lib/libc/locale/wcstof.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/wcstof.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2002, 2003 Tim J. Robbins
  * All rights reserved.
@@ -30,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/wcstof.c 309334 2016-11-30 20:48:44Z vangyzen $");
 
 #include <stdlib.h>
 #include <wchar.h>
@@ -50,12 +51,16 @@
 	char *buf, *end;
 	const wchar_t *wcp;
 	size_t len;
+	size_t spaces;
 	FIX_LOCALE(locale);
 
-	while (iswspace_l(*nptr, locale))
-		nptr++;
+	wcp = nptr;
+	spaces = 0;
+	while (iswspace_l(*wcp, locale)) {
+		wcp++;
+		spaces++;
+	}
 
-	wcp = nptr;
 	mbs = initial;
 	if ((len = wcsrtombs_l(NULL, &wcp, 0, &mbs, locale)) == (size_t)-1) {
 		if (endptr != NULL)
@@ -62,15 +67,21 @@
 			*endptr = (wchar_t *)nptr;
 		return (0.0);
 	}
-	if ((buf = malloc(len + 1)) == NULL)
+	if ((buf = malloc(len + 1)) == NULL) {
+		if (endptr != NULL)
+			*endptr = (wchar_t *)nptr;
 		return (0.0);
+	}
 	mbs = initial;
 	wcsrtombs_l(buf, &wcp, len + 1, &mbs, locale);
 
 	val = strtof_l(buf, &end, locale);
 
-	if (endptr != NULL)
+	if (endptr != NULL) {
 		*endptr = (wchar_t *)nptr + (end - buf);
+		if (buf != end)
+			*endptr += spaces;
+	}
 
 	free(buf);
 

Modified: trunk/lib/libc/locale/wcstoimax.c
===================================================================
--- trunk/lib/libc/locale/wcstoimax.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/wcstoimax.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -37,9 +38,9 @@
 #if defined(LIBC_SCCS) && !defined(lint)
 static char sccsid[] = "from @(#)strtol.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
-__MBSDID("FreeBSD: src/lib/libc/stdlib/strtoimax.c,v 1.8 2002/09/06 11:23:59 tjr Exp ");
+__FBSDID("FreeBSD: src/lib/libc/stdlib/strtoimax.c,v 1.8 2002/09/06 11:23:59 tjr Exp ");
 #endif
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/wcstoimax.c 227753 2011-11-20 14:45:42Z theraven $");
 
 #include <errno.h>
 #include <inttypes.h>

Modified: trunk/lib/libc/locale/wcstol.3
===================================================================
--- trunk/lib/libc/locale/wcstol.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/wcstol.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2002 Tim J. Robbins
 .\" All rights reserved.
 .\"
@@ -22,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/wcstol.3 107392 2002-11-29 17:35:09Z ru $
 .\"
 .Dd September 7, 2002
 .Dt WCSTOL 3


Property changes on: trunk/lib/libc/locale/wcstol.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/wcstol.c
===================================================================
--- trunk/lib/libc/locale/wcstol.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/wcstol.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1990, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -33,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/wcstol.c 227753 2011-11-20 14:45:42Z theraven $");
 
 #include <ctype.h>
 #include <errno.h>

Modified: trunk/lib/libc/locale/wcstold.c
===================================================================
--- trunk/lib/libc/locale/wcstold.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/wcstold.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2002, 2003 Tim J. Robbins
  * All rights reserved.
@@ -30,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/wcstold.c 309334 2016-11-30 20:48:44Z vangyzen $");
 
 #include <stdlib.h>
 #include <wchar.h>
@@ -48,17 +49,18 @@
 	mbstate_t mbs;
 	long double val;
 	char *buf, *end;
-	const wchar_t *wcp = nptr;
+	const wchar_t *wcp;
 	size_t len;
-	size_t spaces = 0;
+	size_t spaces;
 	FIX_LOCALE(locale);
 
+	wcp = nptr;
+	spaces = 0;
 	while (iswspace_l(*wcp, locale)) {
 		wcp++;
 		spaces++;
 	}
 
-	wcp = nptr;
 	mbs = initial;
 	if ((len = wcsrtombs_l(NULL, &wcp, 0, &mbs, locale)) == (size_t)-1) {
 		if (endptr != NULL)
@@ -65,8 +67,11 @@
 			*endptr = (wchar_t *)nptr;
 		return (0.0);
 	}
-	if ((buf = malloc(len + 1)) == NULL)
+	if ((buf = malloc(len + 1)) == NULL) {
+		if (endptr != NULL)
+			*endptr = (wchar_t *)nptr;
 		return (0.0);
+	}
 	mbs = initial;
 	wcsrtombs_l(buf, &wcp, len + 1, &mbs, locale);
 
@@ -73,7 +78,6 @@
 	val = strtold_l(buf, &end, locale);
 
 	if (endptr != NULL) {
-		/* XXX Assume each wide char is one byte. */
 		*endptr = (wchar_t *)nptr + (end - buf);
 		if (buf != end)
 			*endptr += spaces;

Modified: trunk/lib/libc/locale/wcstoll.c
===================================================================
--- trunk/lib/libc/locale/wcstoll.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/wcstoll.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -37,9 +38,9 @@
 #if defined(LIBC_SCCS) && !defined(lint)
 static char sccsid[] = "@(#)strtoq.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
-__MBSDID("FreeBSD: src/lib/libc/stdlib/strtoll.c,v 1.19 2002/09/06 11:23:59 tjr Exp ");
+__FBSDID("FreeBSD: src/lib/libc/stdlib/strtoll.c,v 1.19 2002/09/06 11:23:59 tjr Exp ");
 #endif
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/wcstoll.c 227753 2011-11-20 14:45:42Z theraven $");
 
 #include <errno.h>
 #include <limits.h>

Modified: trunk/lib/libc/locale/wcstombs.3
===================================================================
--- trunk/lib/libc/locale/wcstombs.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/wcstombs.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2002-2004 Tim J. Robbins. All rights reserved.
 .\" Copyright (c) 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -31,7 +32,7 @@
 .\"
 .\" From @(#)multibyte.3	8.1 (Berkeley) 6/4/93
 .\" From FreeBSD: src/lib/libc/locale/multibyte.3,v 1.22 2003/11/08 03:23:11 tjr Exp
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/wcstombs.3 165903 2007-01-09 00:28:16Z imp $
 .\"
 .Dd April 8, 2004
 .Dt WCSTOMBS 3


Property changes on: trunk/lib/libc/locale/wcstombs.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/wcstombs.c
===================================================================
--- trunk/lib/libc/locale/wcstombs.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/wcstombs.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2002-2004 Tim J. Robbins.
  * All rights reserved.
@@ -30,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/wcstombs.c 227753 2011-11-20 14:45:42Z theraven $");
 
 #include <limits.h>
 #include <stdlib.h>

Modified: trunk/lib/libc/locale/wcstoul.c
===================================================================
--- trunk/lib/libc/locale/wcstoul.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/wcstoul.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 1990, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -33,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/wcstoul.c 227753 2011-11-20 14:45:42Z theraven $");
 
 #include <ctype.h>
 #include <errno.h>

Modified: trunk/lib/libc/locale/wcstoull.c
===================================================================
--- trunk/lib/libc/locale/wcstoull.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/wcstoull.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -37,9 +38,9 @@
 #if defined(LIBC_SCCS) && !defined(lint)
 static char sccsid[] = "@(#)strtouq.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
-__MBSDID("FreeBSD: src/lib/libc/stdlib/strtoull.c,v 1.18 2002/09/06 11:23:59 tjr Exp ");
+__FBSDID("FreeBSD: src/lib/libc/stdlib/strtoull.c,v 1.18 2002/09/06 11:23:59 tjr Exp ");
 #endif
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/wcstoull.c 227753 2011-11-20 14:45:42Z theraven $");
 
 #include <errno.h>
 #include <limits.h>

Modified: trunk/lib/libc/locale/wcstoumax.c
===================================================================
--- trunk/lib/libc/locale/wcstoumax.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/wcstoumax.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -37,9 +38,9 @@
 #if defined(LIBC_SCCS) && !defined(lint)
 static char sccsid[] = "from @(#)strtoul.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
-__MBSDID("FreeBSD: src/lib/libc/stdlib/strtoumax.c,v 1.8 2002/09/06 11:23:59 tjr Exp ");
+__FBSDID("FreeBSD: src/lib/libc/stdlib/strtoumax.c,v 1.8 2002/09/06 11:23:59 tjr Exp ");
 #endif
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/wcstoumax.c 227753 2011-11-20 14:45:42Z theraven $");
 
 #include <errno.h>
 #include <inttypes.h>

Modified: trunk/lib/libc/locale/wctob.c
===================================================================
--- trunk/lib/libc/locale/wctob.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/wctob.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2002-2004 Tim J. Robbins.
  * All rights reserved.
@@ -30,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/wctob.c 227753 2011-11-20 14:45:42Z theraven $");
 
 #include <limits.h>
 #include <stdio.h>

Modified: trunk/lib/libc/locale/wctomb.3
===================================================================
--- trunk/lib/libc/locale/wctomb.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/wctomb.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2002-2004 Tim J. Robbins. All rights reserved.
 .\" Copyright (c) 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -31,7 +32,7 @@
 .\"
 .\" From @(#)multibyte.3	8.1 (Berkeley) 6/4/93
 .\" From FreeBSD: src/lib/libc/locale/multibyte.3,v 1.22 2003/11/08 03:23:11 tjr Exp
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/wctomb.3 165903 2007-01-09 00:28:16Z imp $
 .\"
 .Dd April 8, 2004
 .Dt WCTOMB 3


Property changes on: trunk/lib/libc/locale/wctomb.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/wctomb.c
===================================================================
--- trunk/lib/libc/locale/wctomb.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/wctomb.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2002-2004 Tim J. Robbins.
  * All rights reserved.
@@ -30,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/wctomb.c 227753 2011-11-20 14:45:42Z theraven $");
 
 #include <stdlib.h>
 #include <wchar.h>

Modified: trunk/lib/libc/locale/wctrans.3
===================================================================
--- trunk/lib/libc/locale/wctrans.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/wctrans.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2002 Tim J. Robbins
 .\" All rights reserved.
 .\"
@@ -22,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/wctrans.3 107392 2002-11-29 17:35:09Z ru $
 .\"
 .Dd October 3, 2002
 .Dt WCTRANS 3


Property changes on: trunk/lib/libc/locale/wctrans.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/wctrans.c
===================================================================
--- trunk/lib/libc/locale/wctrans.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/wctrans.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2002 Tim J. Robbins.
  * All rights reserved.
@@ -30,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/wctrans.c 227753 2011-11-20 14:45:42Z theraven $");
 
 #include <errno.h>
 #include <string.h>

Modified: trunk/lib/libc/locale/wctype.3
===================================================================
--- trunk/lib/libc/locale/wctype.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/wctype.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2002 Tim J. Robbins
 .\" All rights reserved.
 .\"
@@ -22,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/wctype.3 163314 2006-10-13 16:11:12Z ru $
 .\"
 .Dd March 27, 2004
 .Dt WCTYPE 3


Property changes on: trunk/lib/libc/locale/wctype.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/wctype.c
===================================================================
--- trunk/lib/libc/locale/wctype.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/wctype.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2002 Tim J. Robbins.
  * All rights reserved.
@@ -30,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/wctype.c 228269 2011-12-05 00:00:47Z jilles $");
 
 #include <ctype.h>
 #include <string.h>

Modified: trunk/lib/libc/locale/wcwidth.3
===================================================================
--- trunk/lib/libc/locale/wcwidth.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/wcwidth.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2002 Tim J. Robbins
 .\" All rights reserved.
 .\"
@@ -22,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/wcwidth.3 133915 2004-08-17 04:56:03Z trhodes $
 .\"
 .Dd August 17, 2004
 .Dt WCWIDTH 3


Property changes on: trunk/lib/libc/locale/wcwidth.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/wcwidth.c
===================================================================
--- trunk/lib/libc/locale/wcwidth.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/wcwidth.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 1989, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -41,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/locale/wcwidth.c 227753 2011-11-20 14:45:42Z theraven $");
 
 #include <wchar.h>
 #include <wctype.h>

Modified: trunk/lib/libc/locale/xlocale.3
===================================================================
--- trunk/lib/libc/locale/xlocale.3	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/xlocale.3	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2011 The FreeBSD Foundation
 .\" All rights reserved.
 .\"
@@ -25,14 +26,14 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/locale/xlocale.3 250244 2013-05-04 17:06:47Z pluknet $
 .\"
-.Dd September 17 2011
+.Dd September 17, 2011
 .Dt XLOCALE 3
 .Os
 .Sh NAME
 .Nm xlocale
-.Nd Thread-safe extended locale support.
+.Nd Thread-safe extended locale support
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
@@ -65,21 +66,6 @@
 The global locale is the locale set with the
 .Xr setlocale 3
 function.
-.Sh CAVEATS
-The
-.Xr setlocale 3
-function, and others in the family, refer to the global locale.
-Other functions that depend on the locale, however,
-will take the thread-local locale if one has been set.
-This means that the idiom of setting the locale using
-.Xr setlocale 3 ,
-calling a locale-dependent function,
-and then restoring the locale will not
-have the expected behavior if the current thread has had a locale set using
-.Xr uselocale 3 .
-You should avoid this idiom and prefer to use the
-.Fa _l
-suffixed versions instead.
 .Sh SEE ALSO
 .Xr duplocale 3 ,
 .Xr freelocale 3 ,
@@ -118,7 +104,6 @@
 For reference,
 a complete list of the locale-aware functions that are available in this form,
 along with the headers that expose them, is provided here:
-.Pp
 .Bl -tag -width "<monetary.h> "
 .It In wctype.h
 .Xr iswalnum_l 3 ,
@@ -279,3 +264,18 @@
 This implementation was written by David Chisnall,
 under sponsorship from the FreeBSD Foundation and first appeared in
 .Fx 9.1 .
+.Sh CAVEATS
+The
+.Xr setlocale 3
+function, and others in the family, refer to the global locale.
+Other functions that depend on the locale, however,
+will take the thread-local locale if one has been set.
+This means that the idiom of setting the locale using
+.Xr setlocale 3 ,
+calling a locale-dependent function,
+and then restoring the locale will not
+have the expected behavior if the current thread has had a locale set using
+.Xr uselocale 3 .
+You should avoid this idiom and prefer to use the
+.Fa _l
+suffixed versions instead.


Property changes on: trunk/lib/libc/locale/xlocale.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/locale/xlocale.c
===================================================================
--- trunk/lib/libc/locale/xlocale.c	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/xlocale.c	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2011 The FreeBSD Foundation
  * All rights reserved.
@@ -26,7 +27,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/lib/libc/locale/xlocale.c 284524 2015-06-17 19:12:18Z delphij $
  */
 
 #include <pthread.h>
@@ -154,23 +155,24 @@
 static void
 set_thread_locale(locale_t loc)
 {
+	locale_t l = (loc == LC_GLOBAL_LOCALE) ? 0 : loc;
 
 	_once(&once_control, init_key);
 	
-	if (NULL != loc) {
-		xlocale_retain((struct xlocale_refcounted*)loc);
+	if (NULL != l) {
+		xlocale_retain((struct xlocale_refcounted*)l);
 	}
 	locale_t old = pthread_getspecific(locale_info_key);
-	if ((NULL != old) && (loc != old)) {
+	if ((NULL != old) && (l != old)) {
 		xlocale_release((struct xlocale_refcounted*)old);
 	}
 	if (fake_tls) {
-		thread_local_locale = loc;
+		thread_local_locale = l;
 	} else {
-		pthread_setspecific(locale_info_key, loc);
+		pthread_setspecific(locale_info_key, l);
 	}
 #ifndef __NO_TLS
-	__thread_locale = loc;
+	__thread_locale = l;
 	__set_thread_rune_locale(loc);
 #endif
 }
@@ -361,9 +363,6 @@
 {
 	locale_t old = get_thread_locale();
 	if (NULL != loc) {
-		if (LC_GLOBAL_LOCALE == loc) {
-			loc = NULL;
-		}
 		set_thread_locale(loc);
 	}
 	return (old ? old : LC_GLOBAL_LOCALE);

Modified: trunk/lib/libc/locale/xlocale_private.h
===================================================================
--- trunk/lib/libc/locale/xlocale_private.h	2018-06-08 02:29:48 UTC (rev 10576)
+++ trunk/lib/libc/locale/xlocale_private.h	2018-06-08 02:30:57 UTC (rev 10577)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2011 The FreeBSD Foundation
  * All rights reserved.
@@ -26,7 +27,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/lib/libc/locale/xlocale_private.h 309485 2016-12-03 17:17:42Z ngie $
  */
 
 #ifndef _XLOCALE_PRIVATE__H_
@@ -109,6 +110,10 @@
 	__mbstate_t mblen;
 	/** Persistent state used by mbrlen() calls. */
 	__mbstate_t mbrlen;
+	/** Persistent state used by mbrtoc16() calls. */
+	__mbstate_t mbrtoc16;
+	/** Persistent state used by mbrtoc32() calls. */
+	__mbstate_t mbrtoc32;
 	/** Persistent state used by mbrtowc() calls. */
 	__mbstate_t mbrtowc;
 	/** Persistent state used by mbsnrtowcs() calls. */
@@ -117,6 +122,10 @@
 	__mbstate_t mbsrtowcs;
 	/** Persistent state used by mbtowc() calls. */
 	__mbstate_t mbtowc;
+	/** Persistent state used by c16rtomb() calls. */
+	__mbstate_t c16rtomb;
+	/** Persistent state used by c32rtomb() calls. */
+	__mbstate_t c32rtomb;
 	/** Persistent state used by wcrtomb() calls. */
 	__mbstate_t wcrtomb;
 	/** Persistent state used by wcsnrtombs() calls. */
@@ -147,12 +156,11 @@
 xlocale_release(void *val)
 {
 	struct xlocale_refcounted *obj = val;
-	long count = atomic_fetchadd_long(&(obj->retain_count), -1) - 1;
-	if (count < 0) {
-		if (0 != obj->destructor) {
-			obj->destructor(obj);
-		}
-	}
+	long count;
+
+	count = atomic_fetchadd_long(&(obj->retain_count), -1) - 1;
+	if (count < 0 && obj->destructor != NULL)
+		obj->destructor(obj);
 }
 
 /**



More information about the Midnightbsd-cvs mailing list