809N/A/*
809N/A Licensed to the Apache Software Foundation (ASF) under one or more
809N/A contributor license agreements. See the NOTICE file distributed with
809N/A this work for additional information regarding copyright ownership.
809N/A The ASF licenses this file to You under the Apache License, Version 2.0
809N/A (the "License"); you may not use this file except in compliance with
809N/A the License. You may obtain a copy of the License at
809N/A
809N/A http://www.apache.org/licenses/LICENSE-2.0
809N/A
809N/A Unless required by applicable law or agreed to in writing, software
809N/A distributed under the License is distributed on an "AS IS" BASIS,
809N/A WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
809N/A See the License for the specific language governing permissions and
809N/A limitations under the License.
809N/A*/
809N/A
809N/A'@echo off'
809N/Acall RxFuncAdd "SysLoadFuncs", "RexxUtil", "SysLoadFuncs"
809N/Acall SysLoadFuncs
809N/A
809N/A/* Prepare the parameters for later use */
809N/Aparse arg argv
809N/Amode = ''
809N/Aargs = ''
809N/Aopts = ''
809N/Acp = ''
809N/Alcp = ''
809N/A
809N/Ado i = 1 to words(argv)
809N/A param = word(argv, i)
809N/A select
809N/A when param='-lcp' then mode = 'l'
809N/A when param='-cp' | param='-classpath' then mode = 'c'
809N/A when abbrev('-opts', param, 4) then mode = 'o'
809N/A when abbrev('-args', param, 4) then mode = 'a'
809N/A otherwise
809N/A select
809N/A when mode = 'a' then args = space(args param, 1)
809N/A when mode = 'c' then cp = space(cp param, 1)
809N/A when mode = 'l' then lcp = space(lcp param, 1)
809N/A when mode = 'o' then opts = space(opts param, 1)
809N/A otherwise
809N/A say 'Option' param 'ignored'
809N/A end
809N/A end
809N/Aend
809N/A
809N/Aenv="OS2ENVIRONMENT"
809N/Aantconf = _getenv_('antconf' 'antconf.cmd')
809N/Arunrc = _getenv_('runrc')
809N/Ainterpret 'call "' || runrc || '"' '"' || antconf || '"' 'ETC'
809N/AANT_HOME = value('ANT_HOME',,env)
809N/AJAVA_HOME = value('JAVA_HOME',,env)
809N/Aclasspath = value('CLASSPATH',,env)
809N/Aclasses = stream(JAVA_HOME || "\lib\classes.zip", "C", "QUERY EXISTS")
809N/Aif classes \= '' then classpath = prepend(classpath classes)
809N/Aclasses = stream(JAVA_HOME || "\lib\tools.jar", "C", "QUERY EXISTS")
809N/Aif classes \= '' then classpath = prepend(classpath classes)
809N/A
809N/Aclasspath = prepend(classpath ANT_HOME || '\lib\ant-launcher.jar')
809N/A'SET CLASSPATH=' || classpath
809N/A
809N/A/* Setting classpathes, options and arguments */
809N/Aenvset = _getenv_('envset')
809N/Aif cp\='' then interpret 'call "' || envset || '"' '"; CLASSPATH"' '"' || cp || '"'
809N/Aif lcp\='' then interpret 'call "' || envset || '"' '"; LOCALCLASSPATH"' '"' || lcp || '"'
809N/Aif opts\='' then interpret 'call "' || envset || '"' '"-D ANT_OPTS"' '"' || opts || '"'
809N/Aif args\='' then interpret 'call "' || envset || '"' '"ANT_ARGS"' '"' || args || '"'
809N/A
809N/Aexit 0
809N/A
809N/Aaddpath: procedure
809N/Aparse arg path elem
809N/Aif elem = '' then do
809N/A if path\='' & right(path, 1)\=';' then path = path || ';'
809N/A return path
809N/Aend
809N/Aif substr(path, length(path)) = ';' then glue = ''
809N/Aelse glue = ';'
809N/Aif pos(translate(elem), translate(path)) = 0 then path = path || glue || elem || ';'
809N/Areturn path
809N/A
809N/Aprepend: procedure
809N/Aparse arg path elem
809N/Aif elem = '' then do
809N/A if path\='' & right(path, 1)\=';' then path = path || ';'
809N/A return path
809N/Aend
809N/Aif pos(translate(elem), translate(path)) = 0 then path = elem || ';' || path
809N/Areturn path
809N/A
809N/A_getenv_: procedure expose env
809N/Aparse arg envar default
809N/Aif default = '' then default = envar
809N/Avar = value(translate(envar),,env)
809N/Aif var = '' then var = default
809N/Areturn var