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 Run RC file, name is in the first arg, second arg is either PATH
809N/A ENV or -r or nothing
809N/A*/
809N/A
809N/Aparse arg name path rest
809N/A
809N/Aif name = '' then do
809N/A say 'RC file name is missing'
809N/A exit 1
809N/Aend
809N/A
809N/Aif rest \= '' then do
809N/A say 'Too many parameters'
809N/A exit 1
809N/Aend
809N/A
809N/Acall runit name path
809N/Aexit 0
809N/A
809N/Arunit: procedure
809N/Aparse arg name path dir
809N/A
809N/Aif path \= '' & path \= '-r' then do
809N/A dir = value(translate(path),,'OS2ENVIRONMENT')
809N/A if dir = '' then return
809N/A dir = translate(dir, '\', '/') /* change UNIX-like path to OS/2 */
809N/Aend
809N/A
809N/Aif dir = '' then dir = directory()
809N/A
809N/Aif path = '-r' then do /* recursive call */
809N/A subdir = filespec('path', dir)
809N/A if subdir \= '\' then do
809N/A subdir = left(subdir, length(subdir)-1)
809N/A call runit name path filespec('drive', dir) || subdir
809N/A end
809N/Aend
809N/A
809N/A/* Look for the file and run it */
809N/Aif right(dir, 1) \= '\' then dir = dir || '\'
809N/Arcfile = stream(dir || name, 'c', 'query exists')
809N/Aif rcfile \= '' then interpret 'call "' || rcfile || '"'
809N/A
809N/Areturn