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)11c32rtomb(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