diff options
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | defines.h | 10 | ||||
-rw-r--r-- | dln.c | 6 | ||||
-rw-r--r-- | hash.c | 40 | ||||
-rw-r--r-- | ruby.c | 2 | ||||
-rw-r--r-- | version.h | 6 |
6 files changed, 55 insertions, 23 deletions
@@ -1,3 +1,17 @@ +Fri Jun 20 15:04:28 2003 NAKAMURA Usaku <usa@ruby-lang.org> + + * defines.h (PATH_ENV): name of PATH environment. [new]. + + * defines.h (ENV_IGNORECASE): define for case insensitive platforms + to access environment variables. + + * dln.c (dln_find_exe): use PATH_ENV instead of "PATH". + + * hash.c (env_delete, rb_f_getenv, env_fetch, rb_env_path_tainted, + env_aset): ditto. + + * ruby.c (proc_options): ditto. + Fri Jun 20 00:45:19 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org> * lib/csv.rb: Import csv module. @@ -166,6 +166,16 @@ flush_register_windows(void) #define PATH_SEP_CHAR PATH_SEP[0] #if defined(__human68k__) +#define PATH_ENV "path" +#else +#define PATH_ENV "PATH" +#endif + +#if defined(DOSISH) || !defined(__human68k__) +#define ENV_IGNORECASE +#endif + +#if defined(__human68k__) #undef HAVE_RANDOM #undef HAVE_SETITIMER #endif @@ -1591,11 +1591,7 @@ dln_find_exe(fname, path) const char *path; { if (!path) { -#if defined(__human68k__) - path = getenv("path"); -#else - path = getenv("PATH"); -#endif + path = getenv(PATH_ENV); } if (!path) { @@ -1017,10 +1017,10 @@ env_delete(obj, name) VALUE value = env_str_new2(val); ruby_setenv(nam, 0); -#ifdef DOSISH - if (strcasecmp(nam, "PATH") == 0) { +#ifdef ENV_IGNORECASE + if (strcasecmp(nam, PATH_ENV) == 0) { #else - if (strcmp(nam, "PATH") == 0) { + if (strcmp(nam, PATH_ENV) == 0) { #endif path_tainted = 0; } @@ -1053,10 +1053,10 @@ rb_f_getenv(obj, name) } env = getenv(nam); if (env) { -#ifdef DOSISH - if (strcasecmp(nam, "PATH") == 0 && !rb_env_path_tainted()) +#ifdef ENV_IGNORECASE + if (strcasecmp(nam, PATH_ENV) == 0 && !rb_env_path_tainted()) #else - if (strcmp(nam, "PATH") == 0 && !rb_env_path_tainted()) + if (strcmp(nam, PATH_ENV) == 0 && !rb_env_path_tainted()) #endif { VALUE str = rb_str_new2(env); @@ -1096,10 +1096,10 @@ env_fetch(argc, argv) } return if_none; } -#ifdef DOSISH - if (strcasecmp(nam, "PATH") == 0 && !rb_env_path_tainted()) +#ifdef ENV_IGNORECASE + if (strcasecmp(nam, PATH_ENV) == 0 && !rb_env_path_tainted()) #else - if (strcmp(nam, "PATH") == 0 && !rb_env_path_tainted()) + if (strcmp(nam, PATH_ENV) == 0 && !rb_env_path_tainted()) #endif return rb_str_new2(env); return env_str_new2(env); @@ -1116,7 +1116,7 @@ int rb_env_path_tainted() { if (path_tainted < 0) { - path_tainted_p(getenv("PATH")); + path_tainted_p(getenv(PATH_ENV)); } return path_tainted; } @@ -1131,8 +1131,8 @@ envix(nam) env = GET_ENVIRON(environ); for (i = 0; env[i]; i++) { if ( -#ifdef WIN32 - strnicmp(env[i],nam,len) == 0 +#ifdef ENV_IGNORECASE + strncasecmp(env[i],nam,len) == 0 #else memcmp(env[i],nam,len) == 0 #endif @@ -1148,7 +1148,7 @@ ruby_setenv(name, value) const char *name; const char *value; { -#if defined(WIN32) && !defined(__CYGWIN32__) +#if defined(_WIN32) /* The sane way to deal with the environment. * Has these advantages over putenv() & co.: * * enables us to store a truly empty value in the @@ -1259,7 +1259,11 @@ env_aset(obj, nm, val) rb_raise(rb_eArgError, "bad environment variable value"); ruby_setenv(name, value); - if (strcmp(name, "PATH") == 0) { +#ifdef ENV_IGNORECASE + if (strcasecmp(name, PATH_ENV) == 0) { +#else + if (strcmp(name, PATH_ENV) == 0) { +#endif if (OBJ_TAINTED(val)) { /* already tainted, no check */ path_tainted = 1; @@ -1580,7 +1584,11 @@ env_has_value(dmy, value) while (*env) { char *s = strchr(*env, '=')+1; if (s) { +#ifdef ENV_IGNORECASE + if (strncasecmp(s, RSTRING(value)->ptr, strlen(s)) == 0) { +#else if (strncmp(s, RSTRING(value)->ptr, strlen(s)) == 0) { +#endif FREE_ENVIRON(environ); return Qtrue; } @@ -1603,7 +1611,11 @@ env_index(dmy, value) while (*env) { char *s = strchr(*env, '=')+1; if (s) { +#ifdef ENV_IGNORECASE + if (strncasecmp(s, RSTRING(value)->ptr, strlen(s)) == 0) { +#else if (strncmp(s, RSTRING(value)->ptr, strlen(s)) == 0) { +#endif str = env_str_new(*env, s-*env-1); FREE_ENVIRON(environ); return str; @@ -726,7 +726,7 @@ proc_options(argc, argv) script = dln_find_file(argv[0], path); } if (!script) { - script = dln_find_file(argv[0], getenv("PATH")); + script = dln_find_file(argv[0], getenv(PATH_ENV)); } if (!script) script = argv[0]; } @@ -1,11 +1,11 @@ #define RUBY_VERSION "1.8.0" -#define RUBY_RELEASE_DATE "2003-06-19" +#define RUBY_RELEASE_DATE "2003-06-20" #define RUBY_VERSION_CODE 180 -#define RUBY_RELEASE_CODE 20030619 +#define RUBY_RELEASE_CODE 20030620 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 8 #define RUBY_VERSION_TEENY 0 #define RUBY_RELEASE_YEAR 2003 #define RUBY_RELEASE_MONTH 6 -#define RUBY_RELEASE_DAY 19 +#define RUBY_RELEASE_DAY 20 |