summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog14
-rw-r--r--defines.h10
-rw-r--r--dln.c6
-rw-r--r--hash.c40
-rw-r--r--ruby.c2
-rw-r--r--version.h6
6 files changed, 55 insertions, 23 deletions
diff --git a/ChangeLog b/ChangeLog
index b18b579918..c3f01c20a5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/defines.h b/defines.h
index 24bb3b0cda..59b348a2cc 100644
--- a/defines.h
+++ b/defines.h
@@ -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
diff --git a/dln.c b/dln.c
index 4140c10e53..f6950e1863 100644
--- a/dln.c
+++ b/dln.c
@@ -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) {
diff --git a/hash.c b/hash.c
index 30ad8459be..cf7a14bb34 100644
--- a/hash.c
+++ b/hash.c
@@ -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;
diff --git a/ruby.c b/ruby.c
index b7529b09b4..f48898e3f1 100644
--- a/ruby.c
+++ b/ruby.c
@@ -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];
}
diff --git a/version.h b/version.h
index 978c81ab79..1a45ccae53 100644
--- a/version.h
+++ b/version.h
@@ -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