diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1998-04-20 05:55:38 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1998-04-20 05:55:38 +0000 |
commit | 5a1e96b22aa6759bde56ff9667759b44e9f6fa28 (patch) | |
tree | 956063703940ef9f3d450768628584dc08f97c42 /eval.c | |
parent | 4c97b921f2f6d71d7a3f2c0b2c0c089b15686973 (diff) |
*** empty log message ***
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 30 |
1 files changed, 22 insertions, 8 deletions
@@ -3982,6 +3982,18 @@ mod_module_eval(argc, argv, mod) VALUE rb_load_path; +static int +is_absolute_path(path) + char *path; +{ + if (path[0] == '/') return 1; +#if defined(MSDOS) || defined(NT) || defined(__human68k__) + if (path[0] == '\\') return 1; + if (strlen(path) > 2 && path[1] == ':') return 1; +#endif + return 0; +} + static char* find_file(file) char *file; @@ -3990,11 +4002,13 @@ find_file(file) VALUE vpath; char *path; - if (file[0] == '/') return file; -#if defined(MSDOS) || defined(NT) || defined(__human68k__) - if (file[0] == '\\') return file; - if (file[1] == ':') return file; -#endif + if (is_absolute_path(file)) { + FILE *f = fopen(file, "r"); + + if (f == NULL) return 0; + fclose(f); + return file; + } if (rb_load_path) { int i; @@ -4603,9 +4617,9 @@ Init_eval() rb_define_method(cModule, "module_eval", mod_module_eval, -1); rb_define_method(cModule, "class_eval", mod_module_eval, -1); - rb_define_method(cModule, "remove_method", mod_remove_method, 1); - rb_define_method(cModule, "undef_method", mod_undef_method, 1); - rb_define_method(cModule, "alias_method", mod_alias_method, 2); + rb_define_private_method(cModule, "remove_method", mod_remove_method, 1); + rb_define_private_method(cModule, "undef_method", mod_undef_method, 1); + rb_define_private_method(cModule, "alias_method", mod_alias_method, 2); rb_define_singleton_method(cModule, "nesting", mod_nesting, 0); rb_define_singleton_method(cModule, "constants", mod_s_constants, 0); |