2 WCRTOMB: wchar_t wcrtomb (char *s, wchar_t wc, mbstate_t *ps)
5 #define TST_FUNCTION wcrtomb
7 #include "tsp_common.c"
8 #include "dat_wcrtomb.c"
12 tst_wcrtomb (FILE * fp
, int debug_flg
)
14 TST_DECL_VARS (wchar_t);
16 char s
[MBSSIZE
], *s_in
, *s_ex
;
18 static mbstate_t t
= { 0 };
24 TST_HEAD_LOCALE (wcrtomb
, S_WCRTOMB
);
27 TST_GET_ERRET (wcrtomb
);
28 s_in
= ((TST_INPUT (wcrtomb
).s_flg
) == 0) ? (char *) NULL
: s
;
29 wc
= TST_INPUT (wcrtomb
).wc
;
30 t_flg
= TST_INPUT (wcrtomb
).t_flg
;
31 t_ini
= TST_INPUT (wcrtomb
).t_init
;
32 pt
= (t_flg
== 0) ? NULL
: &t
;
36 memset (&t
, 0, sizeof (t
));
40 ret
= wcrtomb (s_in
, wc
, pt
);
45 fprintf (stdout
, "wcrtomb() [ %s : %d ] ret = %lu\n", locale
,
46 rec
+ 1, (unsigned long int) ret
);
47 fprintf (stdout
, " errno = %d\n", errno_save
);
50 TST_IF_RETURN (S_WCRTOMB
)
54 s_ex
= TST_EXPECT (wcrtomb
).s
;
58 for (i
= 0, err
= 0; *(s_ex
+ i
) != 0 && i
< MBSSIZE
; i
++)
60 if (s_in
[i
] != s_ex
[i
])
64 Result (C_FAILURE
, S_WCRTOMB
, CASE_4
,
65 "copied string is different from an "
72 Result (C_SUCCESS
, S_WCRTOMB
, CASE_4
, MS_PASSED
);