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