わたなべです.

勝手に djgpp, cygwin 版に追加した RUBYLIB_PREFIX patch です.
ruby 1.2.5 用です.

--- ruby.c.orig Thu Apr 08 19:14:34 1999 +++ ruby.c Thu Apr 15 23:46:20 1999 @@ -102,2 +102,55 @@ +#define STATIC_FILE_LENGTH 255 + +static char * +rubylib_mangle(s, l) + char *s; + unsigned int l; +{ + static char *newp, *oldp; + static int newl, oldl, notfound; + static char ret[STATIC_FILE_LENGTH+1]; + + if (!newp && !notfound) { + newp = getenv("RUBYLIB_PREFIX"); + if (newp) { + char *s; + + oldp = newp; + while (*newp && !ISSPACE(*newp) && *newp != ';') { + newp++; oldl++; /* Skip digits. */ + } + while (*newp && (ISSPACE(*newp) || *newp == ';')) { + newp++; /* Skip whitespace. */ + } + newl = strlen(newp); + if (newl == 0 || oldl == 0) { + Fatal("Malformed RUBYLIB_PREFIX"); + } + strcpy(ret, newp); + s = ret; + while (*s) { + if (*s == '\\') *s = '/'; + s++; + } + } else { + notfound = 1; + } + } + if (!newp) { + return s; + } + if (l == 0) { + l = strlen(s); + } + if (l < oldl || strncasecmp(oldp, s, oldl) != 0) { + return s; + } + if (l + newl - oldl > STATIC_FILE_LENGTH || newl > STATIC_FILE_LENGTH) { + Fatal("Malformed RUBYLIB_PREFIX"); + } + strcpy(ret + newl, s + oldl); + return ret; +} + static void @@ -122,3 +175,3 @@ if (s = strchr(p, RUBY_LIB_SEP)) { - ary_push(ary, str_new(p, (int)(s-p))); + ary_push(ary, str_new2(rubylib_mangle(p, (int)(s-p)))); p = s + 1; @@ -126,3 +179,3 @@ else { - ary_push(ary, str_new2(p)); + ary_push(ary, str_new2(rubylib_mangle(p, 0))); break; @@ -133,3 +186,3 @@ else { - ary_unshift(rb_load_path, str_new2(path)); + ary_unshift(rb_load_path, str_new2(rubylib_mangle(path, 0))); }