-
Notifications
You must be signed in to change notification settings - Fork 2
/
tstarg2.c
54 lines (47 loc) · 1.93 KB
/
tstarg2.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <stdio.h>
#include <string.h>
#include <cmssys.h>
int main(int argc, char *argv[]) {
char *binary = "BINARY\x00ZZZ";
if (argc != 4) return 2;
if (CMScalltype() == 0) {
if (strcmp(argv[0], "TSTARG2")) return 3;
if (strcmp(argv[1], "ARGUMENT")) return 4;
if (strcmp(argv[2], "ARGUMENT")) return 5;
if (strcmp(argv[3], "ARGUMENT")) return 6;
} else if (CMScalltype() == 5) {
if (!strcmp(argv[0], "binaryargs")) {
if (strcmp(argv[1], "Argument\x001")) return 27;
if (strcmp(argv[2], "Argument\x002")) return 28;
if (strcmp(argv[3], "Argument\x003")) return 29;
CMSreturndata(binary, 10);
} else {
if (strcmp(argv[1], "Argument 1")) return 7;
if (strcmp(argv[2], "Argument 2")) return 8;
if (strcmp(argv[3], "Argument 3")) return 9;
if (!strcmp(argv[0], "stringreturn")) {
CMSreturnvalue("text return value");
} else if (!strcmp(argv[0], "binaryreturn")) {
CMSreturndata(binary, 10);
} else if (!strcmp(argv[0], "isproc")) {
if (!CMSisproc()) return 20;
} else if (!strcmp(argv[0], "isfunc")) {
if (CMSisproc()) return 21;
} else if (strcmp(argv[0], "tstarg2")) return 10;
}
} else {
if (strcmp(argv[0], "tstarg2")) return 11;
if (strcmp(argv[1], "Argument1")) return 12;
if (strcmp(argv[2], "Argument2")) return 13;
if (strcmp(argv[3], "Argument3")) return 14;
}
if (CMSargc() != argc) return 15;
if (CMSargv() != argv) return 16;
if (strncmp((char *) CMSplist(), "TSTARG2 ", 8)) return 17;
if (CMScalltype() != 0) {
if (strncmp(CMSeplist()->Command, "TSTARG2", 7) &&
strncmp(CMSeplist()->Command, "tstarg2", 7))
return 19;
}
return 1; /* 1 = OK - this tests that rc is returned ok */
}