1 | /* |
2 | * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY |
3 | * Main driver |
4 | */ |
5 | |
6 | |
7 | #define TST_FUNCTION_CALL(func) _TST_FUNCTION_CALL(func) |
8 | #define _TST_FUNCTION_CALL(func) tst ##_## func |
9 | |
10 | #include <stdio.h> |
11 | #include <stdlib.h> |
12 | #include <string.h> |
13 | #include <locale.h> |
14 | #include <errno.h> |
15 | #include <signal.h> |
16 | |
17 | #include "tst_types.h" |
18 | #include "tgn_locdef.h" |
19 | |
20 | |
21 | int |
22 | main (int argc, char *argv[]) |
23 | { |
24 | int ret; |
25 | int debug; |
26 | |
27 | debug = argc > 1 ? atoi (argv[1]) : 0; |
28 | |
29 | if (debug) |
30 | { |
31 | fprintf (stdout, "\nTST_MBWC ===> %s ...\n" , argv[0]); |
32 | } |
33 | ret = TST_FUNCTION_CALL (TST_FUNCTION) (stdout, debug); |
34 | |
35 | return (ret != 0); |
36 | } |
37 | |
38 | #define MAX_RESULT_REC 132 |
39 | char result_rec[MAX_RESULT_REC]; |
40 | |
41 | |
42 | int |
43 | result (FILE * fp, char res, const char *func, const char *loc, int rec_no, |
44 | int seq_no, int case_no, const char *msg) |
45 | { |
46 | if (fp == NULL |
47 | || strlen (func) + strlen (loc) + strlen (msg) + 32 > MAX_RESULT_REC) |
48 | { |
49 | fprintf (stderr, |
50 | "Warning: result(): can't write the result: %s:%s:%d:%d:%s\n" , |
51 | func, loc, rec_no, case_no, msg); |
52 | return 0; |
53 | } |
54 | |
55 | sprintf (result_rec, "%s:%s:%d:%d:%d:%c:%s\n" , func, loc, rec_no, seq_no, |
56 | case_no, res, msg); |
57 | |
58 | if (fputs (result_rec, fp) == EOF) |
59 | { |
60 | return 0; |
61 | } |
62 | |
63 | return 1; |
64 | } |
65 | |