]> pd.if.org Git - pdclib/blob - functions/wchar/wcrtomb.c
0372471957d557a7246f9c360df89cbba15b7f43
[pdclib] / functions / wchar / wcrtomb.c
1 /* wcrtomb(
2     char        *restrict   s, 
3     wchar_t                 wc,
4     mbstate_t   *restrict   ps);
5
6    This file is part of the Public Domain C Library (PDCLib).
7    Permission is granted to use, modify, and / or redistribute at will.
8 */
9
10 #ifndef REGTEST
11 #include <wchar.h>
12 #include <errno.h>
13 #include <stdint.h>
14 #include <assert.h>
15 #include <stdlib.h>
16 #include <_PDCLIB_encoding.h>
17 #include <_PDCLIB_locale.h>
18
19 size_t wcrtomb_l(
20     char        *restrict   s, 
21     wchar_t                 wc,
22     mbstate_t   *restrict   ps,
23     locale_t     restrict   l
24 )
25 {
26     return _PDCLIB_cwcrtomb_l(s, wc, ps, l);
27 }
28
29 size_t wcrtomb(
30     char        *restrict   s, 
31     wchar_t                 wc,
32     mbstate_t   *restrict   ps
33 )
34 {
35     static mbstate_t st;
36     return _PDCLIB_cwcrtomb(s, wc, ps ? ps : &st);
37 }
38
39 #endif
40
41 #ifdef TEST
42 #include <_PDCLIB_test.h>
43
44 int main( void )
45 {
46     TESTCASE( NO_TESTDRIVER );
47     return TEST_RESULTS;
48 }
49 #endif