forked from adesutherland/CMS-370-GCCLIB
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcmsrtstb.c
More file actions
62 lines (53 loc) · 2.25 KB
/
cmsrtstb.c
File metadata and controls
62 lines (53 loc) · 2.25 KB
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
55
56
57
58
59
60
61
62
/**************************************************************************************************/
/* CMSRTSTB.C - CMS Runtime Stub to be linked to the Program (STUB) */
/* */
/* Part of GCCLIB - VM/370 CMS Native Std C Library; A Historic Computing Toy */
/* */
/* Proud Contributors: */
/* Robert O'Hara, Paul Edwards, Dave Wade, with a little hacking by Adrian Sutherland */
/* */
/* Released to the public domain. */
/**************************************************************************************************/
#include <cmsruntm.h>
#include <cmssys.h>
#include <stdio.h>
#include <signal.h>
#include <stdlib.h>
int main(int argc, char *argv[]);
void __exit(int rc);
int __cstub(PLIST *plist, EPLIST *eplist) {
GCCCRAB gcccrab;
CMSCRAB *cmscrab;
int x;
/* Default handlers */
SIGHANDLER *handlers[6] = {SIG_DFL, SIG_DFL, SIG_DFL, SIG_DFL, SIG_DFL,
SIG_DFL};
/* User Exits */
USEREXIT *userexits[__NATEXIT];
/* Init Exit functions */
for (x = 0; x < __NATEXIT; x++) userexits[x] = NULL;
/* Fixup the GCCCRAB */
cmscrab = GETCMSCRAB();
cmscrab->gcccrab = &gcccrab;
/* And add it to my parent (the root) CMSCRAB */
cmscrab = cmscrab->backchain;
cmscrab->gcccrab = &gcccrab;
gcccrab.rootcmscrab = cmscrab;
/* Set Global Variables */
gcccrab.exitfunc = __exit;
gcccrab.handlers = handlers;
gcccrab.userexits = userexits;
gcccrab.filehandles = NULL;
gcccrab.strtok_old = NULL;
gcccrab.process_global = NULL;
gcccrab.argv = NULL;
gcccrab.argbuffer = NULL;
gcccrab.plist = plist;
gcccrab.eplist = eplist;
gcccrab.calltype = -1;
gcccrab.evalblok = NULL;
gcccrab.isproc = 0;
gcccrab.argc = 0;
gcccrab.debug = 0;
return (__cstart(main));
}