GRAILS-1019: Allowing expressions to be used with the 'disabled' attribute for g...
[grails.git] / ant / bin / runrc.cmd
blob0337a80a2a681bd445c579f3e17ff978de8e3ee0
1 /*
2 Copyright 2003-2004 The Apache Software Foundation
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
8 http://www.apache.org/licenses/LICENSE-2.0
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.
16 Run RC file, name is in the first arg, second arg is either PATH
17 ENV or -r or nothing
20 parse arg name path rest
22 if name = '' then do
23 say 'RC file name is missing'
24 exit 1
25 end
27 if rest \= '' then do
28 say 'Too many parameters'
29 exit 1
30 end
32 call runit name path
33 exit 0
35 runit: procedure
36 parse arg name path dir
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
44 if dir = '' then dir = directory()
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
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 || '"'
59 return