carbidecpp20devenv/plugins/org.apache.ant_1.7.0.v200803061910/bin/runrc.cmd
changeset 1 82d1d1de1a01
equal deleted inserted replaced
-1:000000000000 1:82d1d1de1a01
       
     1 /* 
       
     2     Copyright 2003-2004 The Apache Software Foundation
       
     3   
       
     4     Licensed under the Apache License, Version 2.0 (the "License");
       
     5     you may not use this file except in compliance with the License.
       
     6     You may obtain a copy of the License at
       
     7   
       
     8         http://www.apache.org/licenses/LICENSE-2.0
       
     9   
       
    10     Unless required by applicable law or agreed to in writing, software
       
    11     distributed under the License is distributed on an "AS IS" BASIS,
       
    12     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       
    13     See the License for the specific language governing permissions and
       
    14     limitations under the License.
       
    15 
       
    16     Run RC file, name is in the first arg, second arg is either PATH
       
    17     ENV  or -r or nothing 
       
    18 */
       
    19 
       
    20 parse arg name path rest
       
    21 
       
    22 if name = '' then do
       
    23   say 'RC file name is missing'
       
    24   exit 1
       
    25 end
       
    26 
       
    27 if rest \= '' then do
       
    28   say 'Too many parameters'
       
    29   exit 1
       
    30 end
       
    31 
       
    32 call runit name path
       
    33 exit 0
       
    34 
       
    35 runit: procedure
       
    36 parse arg name path dir
       
    37 
       
    38 if path \= '' & path \= '-r' then do
       
    39   dir = value(translate(path),,'OS2ENVIRONMENT')
       
    40   if dir = '' then return
       
    41   dir = translate(dir, '\', '/') /* change UNIX-like path to OS/2 */
       
    42 end
       
    43 
       
    44 if dir = '' then dir = directory()
       
    45 
       
    46 if path = '-r' then do /* recursive call */
       
    47   subdir = filespec('path', dir)
       
    48   if subdir \= '\' then do
       
    49     subdir = left(subdir, length(subdir)-1)
       
    50     call runit name path filespec('drive', dir) || subdir
       
    51   end
       
    52 end
       
    53 
       
    54 /* Look for the file and run it */
       
    55 if right(dir, 1) \= '\' then dir = dir || '\'
       
    56 rcfile = stream(dir || name, 'c', 'query exists')
       
    57 if rcfile \= '' then interpret 'call "' || rcfile || '"'
       
    58 
       
    59 return