This source file includes following definitions.
- main
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 #include <config.h>
18
19 #include <stdio.h>
20 #include <string.h>
21
22
23
24 #undef fclose
25 #undef fopen
26 #undef fprintf
27 #undef fread
28
29 #if defined _AIX && defined _LARGE_FILES
30 # define fopen fopen64
31 #endif
32
33 #define EXPECTED_DATA_FILE "t-sq-data.tmp"
34
35 int
36 main (int argc, char *argv[])
37 {
38 const char *arg;
39 char expected_data[1000];
40 size_t expected_data_len;
41
42 if (argc < 2)
43
44 return 2;
45 if (argc > 2)
46
47 return 3;
48 arg = argv[1];
49
50
51 {
52 FILE *fp = fopen (EXPECTED_DATA_FILE, "rb");
53 if (fp == NULL)
54 return 4;
55 expected_data_len = fread (expected_data, 1, sizeof (expected_data), fp);
56 if (fclose (fp))
57 return 5;
58 }
59
60 if (!(strlen (arg) == expected_data_len
61 && memcmp (arg, expected_data, expected_data_len) == 0))
62 {
63
64 fprintf (stderr, "expected: %.*s\nreceived: %s\n",
65 (int)expected_data_len, expected_data, arg);
66 return 1;
67 }
68 else
69 return 0;
70 }