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
9 http://www.apache.org/licenses/LICENSE-2.0
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.
19 call RxFuncAdd "SysLoadFuncs", "RexxUtil", "SysLoadFuncs"
22 /* Prepare the parameters for later use */
30 do i = 1 to words(argv)
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'
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)
44 say 'Option' param 'ignored'
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)
61 classpath = prepend(classpath ANT_HOME || '\lib\ant-launcher.jar')
62 'SET CLASSPATH=' || classpath
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 || '"'
76 if path\='' & right(path, 1)\=';' then path = path || ';'
79 if substr(path, length(path)) = ';' then glue = ''
81 if pos(translate(elem), translate(path)) = 0 then path = path || glue || elem || ';'
87 if path\='' & right(path, 1)\=';' then path = path || ';'
90 if pos(translate(elem), translate(path)) = 0 then path = elem || ';' || path
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