diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-04-14 01:30:12 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-04-14 01:30:12 +0000 |
commit | 7343b492a20fccc753e77845a1c18bede5b070f8 (patch) | |
tree | c8e0689982671957d8cd976c903d3f211d4ca04b /template | |
parent | 1a88b871d1aae707bcc0760658c9f086f5f24eee (diff) |
ruby-runner.h
* template/ruby-runner.h.in: separate configured part from
ruby-runner.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54572 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'template')
-rw-r--r-- | template/ruby-runner.c.in | 37 | ||||
-rw-r--r-- | template/ruby-runner.h.in | 3 |
2 files changed, 3 insertions, 37 deletions
diff --git a/template/ruby-runner.c.in b/template/ruby-runner.c.in deleted file mode 100644 index 75be21573f..0000000000 --- a/template/ruby-runner.c.in +++ /dev/null @@ -1,37 +0,0 @@ -#define _POSIX_C_SOURCE 200809L -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - -#define BUILDDIR "@abs_top_builddir@" -#define LIBPATHENV "@LIBPATHENV@" -#define PATH_SEP '@PATH_SEPARATOR@' - -#define STRINGIZE(expr) STRINGIZE0(expr) -#define STRINGIZE0(expr) #expr - -int -main(int argc, char **argv) -{ - static const char builddir[] = BUILDDIR; - const char *libpath = getenv(LIBPATHENV); - char c = 0; - - if (libpath) { - while ((c = *libpath) == PATH_SEP) ++libpath; - } - if (c) { - size_t n = strlen(libpath); - char *e = malloc(sizeof(builddir)+n+1); - memcpy(e, builddir, sizeof(builddir)-1); - e[sizeof(builddir)-1] = PATH_SEP; - memcpy(e+sizeof(builddir), libpath, n+1); - libpath = e; - } - else { - libpath = builddir; - } - setenv(LIBPATHENV, libpath, 1); - execv(BUILDDIR"/"STRINGIZE(RUBY_INSTALL_NAME), argv); - return -1; -} diff --git a/template/ruby-runner.h.in b/template/ruby-runner.h.in new file mode 100644 index 0000000000..b0647fd0e1 --- /dev/null +++ b/template/ruby-runner.h.in @@ -0,0 +1,3 @@ +#define BUILDDIR "@abs_top_builddir@" +#define LIBPATHENV "@LIBPATHENV@" +#define PATH_SEP '@PATH_SEPARATOR@' |