summaryrefslogtreecommitdiff
path: root/ruby.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-06-28 08:31:35 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-06-28 08:31:35 +0000
commit224e59c6f82c98da0d507cfae3b39c97b6769d51 (patch)
tree1e844ef7bb01533ce06310b79a92cd0c75a53ba1 /ruby.c
parent1261c7e05550a72f3bb33eae75660142c6ea2a4e (diff)
matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@791 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c34
1 files changed, 12 insertions, 22 deletions
diff --git a/ruby.c b/ruby.c
index ce9d5dcf35..d848160c6f 100644
--- a/ruby.c
+++ b/ruby.c
@@ -225,6 +225,8 @@ add_modules(mod)
req_list_last = list;
}
+extern void Init_ext _((void));
+
void
require_libraries()
{
@@ -235,6 +237,12 @@ require_libraries()
struct req_list *list = req_list_head.next;
struct req_list *tmp;
+ if (rb_safe_level() == 0) {
+ rb_ary_push(rb_load_path, rb_str_new2("."));
+ addpath(getenv("RUBYLIB"));
+ }
+
+ Init_ext(); /* should be called here for some reason :-( */
ruby_sourcefile = 0;
save[0] = ruby_eval_tree;
save[1] = ruby_eval_tree_begin;
@@ -252,8 +260,6 @@ require_libraries()
ruby_sourcefile = orig_sourcefile;
}
-extern void Init_ext _((void));
-
static void
process_sflag()
{
@@ -626,34 +632,21 @@ proc_options(argc, argv)
ruby_set_argv(argc, argv);
process_sflag();
-#if 0
- Init_ext(); /* should be called here for some reason :-( */
- require_libraries();
-#endif
-
ruby_sourcefile = argv0;
if (e_script) {
+ require_libraries();
rb_compile_string(script, e_script, 1);
}
else if (strlen(script) == 1 && script[0] == '-') {
+ require_libraries();
load_stdin();
}
else {
load_file(script, 1);
}
- if (rb_safe_level() == 0) {
- rb_ary_push(rb_load_path, rb_str_new2("."));
- addpath(getenv("RUBYLIB"));
- }
-
process_sflag();
xflag = 0;
-
-#if 1
- Init_ext(); /* should be called here for some reason :-( */
- require_libraries();
-#endif
}
extern int ruby__end__seen;
@@ -760,13 +753,10 @@ load_file(fname, script)
}
}
}
- else if (NIL_P(c)) {
- rb_io_close(f);
- return;
- }
- else {
+ else if (!NIL_P(c)) {
rb_io_ungetc(f, c);
}
+ require_libraries(); /* Why here? unnatural */
}
rb_compile_file(fname, f, line_start);
if (script && ruby__end__seen) {