diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-09-14 07:07:31 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-09-14 07:07:31 +0000 |
commit | 387d645af066d28624e8ed826fe8a50333a8afb4 (patch) | |
tree | a3d293efcb27d1ebb5056ed8a90d66cef46d5393 | |
parent | 975ecd2f3feec5623d296cfff38a779ad4393add (diff) | |
download | ruby-387d645af066d28624e8ed826fe8a50333a8afb4.tar.gz |
* ruby.c (process_options): associates the locale encoding with $0 as
well as ARGV.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | ruby.c | 9 |
2 files changed, 11 insertions, 3 deletions
@@ -1,3 +1,8 @@ +Sun Sep 14 16:07:04 2008 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * ruby.c (process_options): associates the locale encoding with $0 as + well as ARGV. + Sun Sep 14 13:48:03 2008 Yuki Sonoda (Yugui) <yugui@yugui.jp> * object.c (Init_Object): added metameta-class initialization for @@ -967,6 +967,7 @@ process_options(VALUE arg) NODE *tree = 0; VALUE parser; VALUE iseq; + VALUE args; rb_encoding *enc, *lenc; const char *s; char fbuf[MAXPATHLEN]; @@ -1067,7 +1068,7 @@ process_options(VALUE arg) #if defined DOSISH || defined __CYGWIN__ translate_char(RSTRING_PTR(rb_progname), '\\', '/'); #endif - opt->script_name = rb_str_new4(rb_progname); + opt->script_name = rb_progname; opt->script = RSTRING_PTR(opt->script_name); safe = rb_safe_level(); rb_set_safe_level_force(0); @@ -1077,8 +1078,10 @@ process_options(VALUE arg) ruby_init_loadpath(); ruby_init_gems(!(opt->disable & DISABLE_BIT(gems))); lenc = rb_locale_encoding(); - for (i = 0; i < RARRAY_LEN(rb_argv); i++) { - rb_enc_associate(RARRAY_PTR(rb_argv)[i], lenc); + rb_enc_associate(rb_progname, lenc); + opt->script_name = rb_str_new4(rb_progname); + for (i = 0, args = rb_argv; i < RARRAY_LEN(args); i++) { + rb_enc_associate(RARRAY_PTR(args)[i], lenc); } parser = rb_parser_new(); if (opt->yydebug) rb_parser_set_yydebug(parser, Qtrue); |