xref: /openbsd-src/lib/libc/locale/c32rtomb.c (revision 46c354aa2baf687e7a81339ec07289555b065bb2)
1 /*	$OpenBSD: c32rtomb.c,v 1.1 2023/08/20 15:02:51 schwarze Exp $ */
2 /*
3  * Written by Ingo Schwarze <schwarze@openbsd.org>
4  * and placed in the public domain on March 19, 2022.
5  */
6 
7 #include <uchar.h>
8 #include <wchar.h>
9 
10 size_t
c32rtomb(char * s,char32_t c32,mbstate_t * ps)11 c32rtomb(char *s, char32_t c32, mbstate_t *ps)
12 {
13 	static mbstate_t mbs;
14 
15 	if (ps == NULL)
16 		ps = &mbs;
17 	return wcrtomb(s, c32, ps);
18 }
19