1 |
d2a8c3fd
|
Marc NICOLAS
|
/*
|
2 |
|
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
3 |
|
|
contributor license agreements. See the NOTICE file distributed with
|
4 |
|
|
this work for additional information regarding copyright ownership.
|
5 |
|
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
6 |
|
|
(the "License"); you may not use this file except in compliance with
|
7 |
|
|
the License. You may obtain a copy of the License at
|
8 |
|
|
|
9 |
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
10 |
|
|
|
11 |
|
|
Unless required by applicable law or agreed to in writing, software
|
12 |
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
13 |
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14 |
|
|
See the License for the specific language governing permissions and
|
15 |
|
|
limitations under the License.
|
16 |
|
|
*/
|
17 |
|
|
|
18 |
|
|
'@echo off'
|
19 |
|
|
call RxFuncAdd "SysLoadFuncs", "RexxUtil", "SysLoadFuncs"
|
20 |
|
|
call SysLoadFuncs
|
21 |
|
|
|
22 |
|
|
/* Prepare the parameters for later use */
|
23 |
|
|
parse arg argv
|
24 |
|
|
mode = ''
|
25 |
|
|
args = ''
|
26 |
|
|
opts = ''
|
27 |
|
|
cp = ''
|
28 |
|
|
lcp = ''
|
29 |
|
|
|
30 |
|
|
do i = 1 to words(argv)
|
31 |
|
|
param = word(argv, i)
|
32 |
|
|
select
|
33 |
|
|
when param='-lcp' then mode = 'l'
|
34 |
|
|
when param='-cp' | param='-classpath' then mode = 'c'
|
35 |
|
|
when abbrev('-opts', param, 4) then mode = 'o'
|
36 |
|
|
when abbrev('-args', param, 4) then mode = 'a'
|
37 |
|
|
otherwise
|
38 |
|
|
select
|
39 |
|
|
when mode = 'a' then args = space(args param, 1)
|
40 |
|
|
when mode = 'c' then cp = space(cp param, 1)
|
41 |
|
|
when mode = 'l' then lcp = space(lcp param, 1)
|
42 |
|
|
when mode = 'o' then opts = space(opts param, 1)
|
43 |
|
|
otherwise
|
44 |
|
|
say 'Option' param 'ignored'
|
45 |
|
|
end
|
46 |
|
|
end
|
47 |
|
|
end
|
48 |
|
|
|
49 |
|
|
env="OS2ENVIRONMENT"
|
50 |
|
|
antconf = _getenv_('antconf' 'antconf.cmd')
|
51 |
|
|
runrc = _getenv_('runrc')
|
52 |
|
|
interpret 'call "' || runrc || '"' '"' || antconf || '"' 'ETC'
|
53 |
|
|
ANT_HOME = value('ANT_HOME',,env)
|
54 |
|
|
JAVA_HOME = value('JAVA_HOME',,env)
|
55 |
|
|
classpath = value('CLASSPATH',,env)
|
56 |
|
|
classes = stream(JAVA_HOME || "\lib\classes.zip", "C", "QUERY EXISTS")
|
57 |
|
|
if classes \= '' then classpath = prepend(classpath classes)
|
58 |
|
|
classes = stream(JAVA_HOME || "\lib\tools.jar", "C", "QUERY EXISTS")
|
59 |
|
|
if classes \= '' then classpath = prepend(classpath classes)
|
60 |
|
|
|
61 |
|
|
classpath = prepend(classpath ANT_HOME || '\lib\ant-launcher.jar')
|
62 |
|
|
'SET CLASSPATH=' || classpath
|
63 |
|
|
|
64 |
|
|
/* Setting classpathes, options and arguments */
|
65 |
|
|
envset = _getenv_('envset')
|
66 |
|
|
if cp\='' then interpret 'call "' || envset || '"' '"; CLASSPATH"' '"' || cp || '"'
|
67 |
|
|
if lcp\='' then interpret 'call "' || envset || '"' '"; LOCALCLASSPATH"' '"' || lcp || '"'
|
68 |
|
|
if opts\='' then interpret 'call "' || envset || '"' '"-D ANT_OPTS"' '"' || opts || '"'
|
69 |
|
|
if args\='' then interpret 'call "' || envset || '"' '"ANT_ARGS"' '"' || args || '"'
|
70 |
|
|
|
71 |
|
|
exit 0
|
72 |
|
|
|
73 |
|
|
addpath: procedure
|
74 |
|
|
parse arg path elem
|
75 |
|
|
if elem = '' then do
|
76 |
|
|
if path\='' & right(path, 1)\=';' then path = path || ';'
|
77 |
|
|
return path
|
78 |
|
|
end
|
79 |
|
|
if substr(path, length(path)) = ';' then glue = ''
|
80 |
|
|
else glue = ';'
|
81 |
|
|
if pos(translate(elem), translate(path)) = 0 then path = path || glue || elem || ';'
|
82 |
|
|
return path
|
83 |
|
|
|
84 |
|
|
prepend: procedure
|
85 |
|
|
parse arg path elem
|
86 |
|
|
if elem = '' then do
|
87 |
|
|
if path\='' & right(path, 1)\=';' then path = path || ';'
|
88 |
|
|
return path
|
89 |
|
|
end
|
90 |
|
|
if pos(translate(elem), translate(path)) = 0 then path = elem || ';' || path
|
91 |
|
|
return path
|
92 |
|
|
|
93 |
|
|
_getenv_: procedure expose env
|
94 |
|
|
parse arg envar default
|
95 |
|
|
if default = '' then default = envar
|
96 |
|
|
var = value(translate(envar),,env)
|
97 |
|
|
if var = '' then var = default
|
98 |
|
|
return var |