* ruby.c (cmdline_arguments): split argc and argv from cmdline_options.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15229 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
95e59bd9e0
commit
c30d2489dd
@ -1,4 +1,6 @@
|
|||||||
Fri Jan 25 15:12:42 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Fri Jan 25 15:41:20 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* ruby.c (cmdline_arguments): split argc and argv from cmdline_options.
|
||||||
|
|
||||||
* ruby.c (process_options): not set encoding of -e option from -E
|
* ruby.c (process_options): not set encoding of -e option from -E
|
||||||
option if they are not compatible.
|
option if they are not compatible.
|
||||||
|
23
ruby.c
23
ruby.c
@ -66,8 +66,6 @@ VALUE rb_parser_set_yydebug(VALUE, VALUE);
|
|||||||
char *ruby_inplace_mode = 0;
|
char *ruby_inplace_mode = 0;
|
||||||
|
|
||||||
struct cmdline_options {
|
struct cmdline_options {
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
int sflag, xflag;
|
int sflag, xflag;
|
||||||
int do_loop, do_print;
|
int do_loop, do_print;
|
||||||
int do_check, do_line;
|
int do_check, do_line;
|
||||||
@ -88,6 +86,12 @@ struct cmdline_options {
|
|||||||
} src, ext;
|
} src, ext;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct cmdline_arguments {
|
||||||
|
int argc;
|
||||||
|
char **argv;
|
||||||
|
struct cmdline_options *opt;
|
||||||
|
};
|
||||||
|
|
||||||
static NODE *load_file(VALUE, const char *, int, struct cmdline_options *);
|
static NODE *load_file(VALUE, const char *, int, struct cmdline_options *);
|
||||||
static void forbid_setid(const char *);
|
static void forbid_setid(const char *);
|
||||||
|
|
||||||
@ -880,9 +884,10 @@ opt_enc_index(VALUE enc_name)
|
|||||||
static VALUE
|
static VALUE
|
||||||
process_options(VALUE arg)
|
process_options(VALUE arg)
|
||||||
{
|
{
|
||||||
struct cmdline_options *opt = (struct cmdline_options *)arg;
|
struct cmdline_arguments *argp = (struct cmdline_arguments *)arg;
|
||||||
int argc = opt->argc;
|
struct cmdline_options *opt = argp->opt;
|
||||||
char **argv = opt->argv;
|
int argc = argp->argc;
|
||||||
|
char **argv = argp->argv;
|
||||||
NODE *tree = 0;
|
NODE *tree = 0;
|
||||||
VALUE parser;
|
VALUE parser;
|
||||||
rb_encoding *enc;
|
rb_encoding *enc;
|
||||||
@ -1437,18 +1442,20 @@ true_value(void)
|
|||||||
void *
|
void *
|
||||||
ruby_process_options(int argc, char **argv)
|
ruby_process_options(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
struct cmdline_arguments args;
|
||||||
struct cmdline_options opt;
|
struct cmdline_options opt;
|
||||||
NODE *tree;
|
NODE *tree;
|
||||||
|
|
||||||
MEMZERO(&opt, opt, 1);
|
MEMZERO(&opt, opt, 1);
|
||||||
ruby_script(argv[0]); /* for the time being */
|
ruby_script(argv[0]); /* for the time being */
|
||||||
rb_argv0 = rb_progname;
|
rb_argv0 = rb_progname;
|
||||||
opt.argc = argc;
|
args.argc = argc;
|
||||||
opt.argv = argv;
|
args.argv = argv;
|
||||||
|
args.opt = &opt;
|
||||||
opt.src.enc.index = -1;
|
opt.src.enc.index = -1;
|
||||||
opt.ext.enc.index = -1;
|
opt.ext.enc.index = -1;
|
||||||
tree = (NODE *)rb_vm_call_cfunc(rb_vm_top_self(),
|
tree = (NODE *)rb_vm_call_cfunc(rb_vm_top_self(),
|
||||||
process_options, (VALUE)&opt,
|
process_options, (VALUE)&args,
|
||||||
0, rb_progname);
|
0, rb_progname);
|
||||||
|
|
||||||
rb_define_readonly_boolean("$-p", opt.do_print);
|
rb_define_readonly_boolean("$-p", opt.do_print);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user