You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

runrc.cmd 1.0 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. Copyright (c) 2003 The Apache Software Foundation. All rights
  3. reserved.
  4. Run RC file, name is in the first arg, second arg is either PATH
  5. ENV or -r or nothing
  6. */
  7. parse arg name path rest
  8. if name = '' then do
  9. say 'RC file name is missing'
  10. exit 1
  11. end
  12. if rest \= '' then do
  13. say 'Too many parameters'
  14. exit 1
  15. end
  16. call runit name path
  17. exit 0
  18. runit: procedure
  19. parse arg name path dir
  20. if path \= '' & path \= '-r' then do
  21. dir = value(translate(path),,'OS2ENVIRONMENT')
  22. if dir = '' then return
  23. dir = translate(dir, '\', '/') /* change UNIX-like path to OS/2 */
  24. end
  25. if dir = '' then dir = directory()
  26. if path = '-r' then do /* recursive call */
  27. subdir = filespec('path', dir)
  28. if subdir \= '\' then do
  29. subdir = left(subdir, length(subdir)-1)
  30. call runit name path filespec('drive', dir) || subdir
  31. end
  32. end
  33. /* Look for the file and run it */
  34. if right(dir, 1) \= '\' then dir = dir || '\'
  35. rcfile = stream(dir || name, 'c', 'query exists')
  36. if rcfile \= '' then interpret 'call "' || rcfile || '"'
  37. return