-
Notifications
You must be signed in to change notification settings - Fork 2
/
resmain.c
54 lines (45 loc) · 1.16 KB
/
resmain.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 <ctype.h>
#include <cmssys.h>
#include <cmsruntm.h>
extern void CMSVTAB;
/* Compare argument */
static int is_same_arg(const char *arg, const char *val) {
const char *c1 = arg;
const char *c2 = val;
while (*c1 == toupper(*c2)) {
if (*c1 == 0) return 1;
c1++;
c2++;
}
return 0;
}
int main(int argc, char *argv[]) {
int anchor_addr;
int debug = 0;
int version = 0;
int *c;
anchor_addr = (int) &CMSVTAB;
if (argc > 2) goto error;
if (argc == 2) {
if (is_same_arg("VERSION", argv[1])) {
version = 1;
}
else if (is_same_arg("DEBUG", argv[1])) {
version = 1;
debug = 1;
CMSsetdebug(1);
}
else goto error;
}
/* Register Address */
CMSSetNUCON((void *) STUB_ANCHOR_ADDRESS, anchor_addr);
if (version) printf("GCCLIB Version %s\n", GCCLIB_VERSION);
if (debug) printf("GCC ANCHOR Address is 0x%x saved in NUCON at 0x%x\n", anchor_addr,
STUB_ANCHOR_ADDRESS);
return 0;
error:
printf("Invalid arguments\n");
printf(" GCCLIB [VERSION|DEBUG]\n");
return -1;
}