1/***********************************************************************/
2/*                                                                     */
3/* Front-end EXEC to set up linkage to the C runtime libraries         */
4/* before executing a MODULE generated from C code.                    */
5/*                                                                     */
6/* Copy this file as an EXEC with a filename matching the C MODULE.    */
7/*                                                                     */
8/* Greg Hartwig (ghartwig@vnet.ibm.com)   7/31/97, 4/24/98.            */
9/*                                                                     */
10/***********************************************************************/
11Address Command
12Parse Arg argstring
13Parse Source . . myname .
14
15/* Set output and input character translation so brackets show up */
16'SET OUTPUT AD' 'BA'x
17'SET OUTPUT BD' 'BB'x
18'SET INPUT  BA   AD'
19'SET INPUT  BB   BD'
20
21Call CLIB
22If rc<>0 Then Do
23   Say 'The required C runtime libraries don''t appear to be available.'
24   Say myname 'can not run.'
25   Exit 12
26End
27
28/* Run the command */
29myname argstring
30Exit rc
31
32
33
34
35/* Contents of the CLIB EXEC, modified for RC checking.        */
36/* Removed TXTLIB setting.  Only LOADLIB needed for execution. */
37CLIB:
38/***************************************************/
39/*      SET UP LIBRARIES FOR LE for MVS & VM       */
40/***************************************************/
41Address COMMAND
42
43loadlib  ='EDCLINK'               /* C/370 runtime                 */
44loadlib  ='SCEERUN'               /* LE runtime                    */
45
46
47theirs=queued()                           /* old stack contentsM068*/
48 'QUERY LOADLIB ( LIFO'                   /* old setting       M068*/
49 LoadlibList=''                           /* init list         M068*/
50rc=0
51 Do while queued()^=theirs                /* all lines from cmdM068*/
52   Parse upper pull 'LOADLIB' '=' Ltemp   /* get one line      M068*/
53   LoadlibList= Ltemp Loadliblist         /* was stacked LIFO  M068*/
54 End                                                         /*M068*/
55 If loadlibList='NONE' ,
56 Then Do
57  'GLOBAL LOADLIB' Loadlib          /* enforce what we need         */
58 End
59 Else Do
60  Do xx=1 to Words(loadlib)
61  If Find(loadliblist,word(loadlib,xx)) = 0 ,
62   then loadliblist = loadliblist word(loadlib,xx)
63  End
64  'GLOBAL LOADLIB' loadliblist       /* enforce what we need         */
65 End
66Return
67