1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ruby.c (proc_options): source-encoding option.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2008-12-08 02:15:47 +00:00
parent ecc83033ba
commit ba274d1f46

9
ruby.c
View file

@ -960,6 +960,10 @@ proc_options(int argc, char **argv, struct cmdline_options *opt, int envopt)
if (!*(s = ++p)) break;
set_encoding_part(internal);
if (!*(s = ++p)) break;
#if ALLOW_DEFAULT_SOURCE_ENCODING
set_encoding_part(source);
if (!*(s = ++p)) break;
#endif
rb_raise(rb_eRuntimeError, "extra argument for %s: %s",
(arg[1] == '-' ? "--encoding" : "-E"), s);
# undef set_encoding_part
@ -971,6 +975,11 @@ proc_options(int argc, char **argv, struct cmdline_options *opt, int envopt)
else if (is_option_with_arg("external-encoding", Qfalse, Qtrue)) {
set_external_encoding_once(opt, s, 0);
}
#if ALLOW_DEFAULT_SOURCE_ENCODING
else if (is_option_with_arg("source-encoding", Qfalse, Qtrue)) {
set_source_encoding_once(opt, s, 0);
}
#endif
else if (strcmp("version", s) == 0) {
if (envopt) goto noenvopt_long;
opt->version = 1;