2 STRFMON: size_t strfmon (char *buf, size_t nbyte, const char *fmt, ...)
5 #define TST_FUNCTION strfmon
7 #include "tsp_common.c"
8 #include "dat_strfmon.c"
12 tst_strfmon (FILE * fp
, int debug_flg
)
14 TST_DECL_VARS (size_t);
15 char buf
[MONSIZE
], *mon
;
22 TST_HEAD_LOCALE (strfmon
, S_STRFMON
);
25 TST_GET_ERRET (strfmon
);
26 nbt
= TST_INPUT (strfmon
).nbytes
;
27 fmt
= TST_INPUT (strfmon
).fmt
;
28 val
= TST_INPUT (strfmon
).val
;
29 memset (buf
, 0, MONSIZE
);
33 Result (C_FAILURE
, S_STRFMON
, CASE_3
, "buffer too small in test");
38 ret
= strfmon (buf
, nbt
, fmt
, val
, val
, val
);
41 if (debug_flg
) /* seems fprintf doesn't update the errno */
43 fprintf (stdout
, "strfmon() [ %s : %d ]\n", locale
, rec
+ 1);
44 fprintf (stdout
, " : err = %d | %s\n", errno_save
,
46 fprintf (stdout
, " : ret = %zd; \t fmt = |%s|\n", ret
, fmt
);
47 fprintf (stdout
, " : buf = |%s|\n\n", buf
);
50 TST_IF_RETURN (S_STRFMON
)
53 if (errno
!= 0 || ret
== -1)
58 mon
= TST_EXPECT (strfmon
).mon
;
60 if (!strcmp (buf
, mon
))
62 Result (C_SUCCESS
, S_STRFMON
, CASE_3
, MS_PASSED
);
67 Result (C_FAILURE
, S_STRFMON
, CASE_3
, "the formatted string is "
68 "different from an expected result");