From 4b6dffad02114175e59729eeb38b5db19c01e571 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 3 Oct 2002 11:20:31 +0000 Subject: * bcc32/mkexports.rb: to work on cygwin via telnet. [ruby-win32:358] * ext/tcltklib/tcltklib.c (ip_invoke): requires command name argument. [ruby-dev:18438] * eval.c (ruby_init, ruby_options): Init_stack() with local location. (ruby-bugs-ja:PR#277) * eval.c (rb_call0): disable trace call. [ruby-dev:18074] * eval.c (eval, rb_load): enable trace call. [ruby-dev:18074] * eval.c (rb_f_require): set source file name for extension libraries. [ruby-dev:18445] * ruby.c (translate_char): translate a character in a string; DOSISH only. [ruby-dev:18274] * ruby.c (ruby_init_loadpath): added argv[0] handling under Human68K. [ruby-dev:18274] * ruby.c (proc_options): translate directory separator in $0 to '/'. [ruby-dev:18274] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2929 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ruby.c | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) (limited to 'ruby.c') diff --git a/ruby.c b/ruby.c index e6adcc7614..a9dde28241 100644 --- a/ruby.c +++ b/ruby.c @@ -203,10 +203,30 @@ ruby_incpush(path) } } -#if defined _WIN32 || defined __CYGWIN__ || defined __DJGPP__ || defined __EMX__ +#if defined DOSISH || defined __CYGWIN__ #define LOAD_RELATIVE 1 #endif +#ifdef DOSISH +static inline void translate_char _((char *, int, int)); + +static inline void +translate_char(p, from, to) + char *p; + int from, to; +{ + while (*p) { + if ((unsigned char)*p == from) + *p = to; +#ifdef CharNext /* defined as CharNext[AW] on Windows. */ + p = CharNext(p); +#else + p += mblen(p, MB_CUR_MAX); +#endif + } +} +#endif + void ruby_init_loadpath() { @@ -224,19 +244,16 @@ ruby_init_loadpath() #elif defined(DJGPP) extern char *__dos_argv0; strncpy(libpath, __dos_argv0, FILENAME_MAX); -#define CharNext(p) ((p) + mblen(p, MB_CUR_MAX)) +#elif defined(__human68k__) + extern char **_argv; + strncpy(libpath, _argv[0], FILENAME_MAX); #elif defined(__EMX__) _execname(libpath, FILENAME_MAX); #endif -#ifndef CharNext /* defined as CharNext[AW] on Windows. */ -#define CharNext(p) ((p) + 1) +#ifdef DOSISH + translate_char(libpath, '\\', '/'); #endif - - for (p = libpath; *p; p = CharNext(p)) - if (*p == '\\') - *p = '/'; - p = strrchr(libpath, '/'); if (p) { *p = 0; @@ -711,6 +728,9 @@ proc_options(argc, argv) if (!e_script) { argc--; argv++; } +#ifdef DOSISH + translate_char(script, '\\', '/'); +#endif } ruby_script(script); -- cgit v1.2.3