1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2003-06-20 06:22:50 +00:00
parent 068bc7e43a
commit 65ba3eba64
6 changed files with 55 additions and 23 deletions

View file

@ -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.

View file

@ -165,6 +165,16 @@ flush_register_windows(void)
#endif
#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

6
dln.c
View file

@ -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) {

40
hash.c
View file

@ -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;

2
ruby.c
View file

@ -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];
}

View file

@ -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