8000 * ruby.c (process_options): re-set e_script. · jruby/ruby@f0248e8 · GitHub
[go: up one dir, main page]

Skip to content

Commit f0248e8

Browse files
committed
* ruby.c (process_options): re-set e_script.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/win32-unicode-test@17946 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 59ec1c0 commit f0248e8

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
Tue Jul 8 00:33:46 2008 NAKAMURA Usaku <usa@ruby-lang.org>
2+
3+
* ruby.c (process_options): re-set e_script.
4+
15
Tue Jul 8 00:03:20 2008 NAKAMURA Usaku <usa@ruby-lang.org>
26

37
* win32/win32.c, include/win32/win32.c (rb_w32_parse_cmndline): new

ruby.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ struct cmdline_options {
9090
const char *script;
9191
VALUE script_name;
9292
VALUE e_script;
93+
VALUE e_script_pos;
9394
struct {
9495
struct {
9596
VALUE name;
@@ -719,9 +720,11 @@ proc_options(int argc, char **argv, struct cmdline_options *opt)
719720
opt->e_script = rb_str_new(0, 0);
720721
if (opt->script == 0)
721722
opt->script = "-e";
723+
opt->e_script_pos = rb_ary_new();
722724
}
723725
rb_str_cat2(opt->e_script, s);
724726
rb_str_cat2(opt->e_script, "\n");
727+
rb_ary_push(opt->e_script_pos, INT2FIX(argc0 - argc));
725728
break;
726729

727730
case 'r':
@@ -1100,6 +1103,15 @@ process_options(VALUE arg)
11001103
rb_enc_set_default_external(rb_enc_from_encoding(enc));
11011104
#ifdef _WIN32
11021105
if ((argc = rb_w32_parse_cmdline(&argv, rb_enc_name(enc))) != 0) {
1106+
if (opt->e_script && opt->e_script_pos) {
1107+
opt->e_script = rb_str_new(0, 0);
1108+
for (i = 0; i < RARRAY_LEN(opt->e_script_pos); ++i) {
1109+
int pos = FIX2INT(RARRAY_PTR(opt->e_script_pos)[i]);
1110+
rb_enc_str_buf_cat(opt->e_script, argv[pos], strlen(argv[pos]),
1111+
enc);
1112+
rb_str_cat2(opt->e_script, "\n");
1113+
}
1114+
}
11031115
argc -= opnum;
11041116
argv += opnum;
11051117
ruby_set_argv(argc, argv);

0 commit comments

Comments
 (0)
0