mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
ruby.c: parse -W option
* ruby.c (proc_options): parse and skip '-W' option and its argument even if ignored. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53370 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
66fe2c0dd9
commit
1eafb3dd4b
1 changed files with 14 additions and 12 deletions
26
ruby.c
26
ruby.c
|
@ -888,28 +888,30 @@ proc_options(long argc, char **argv, struct cmdline_options *opt, int envopt)
|
|||
goto reswitch;
|
||||
|
||||
case 'W':
|
||||
if (!opt->warning) {
|
||||
{
|
||||
size_t numlen;
|
||||
int v = 2; /* -W as -W2 */
|
||||
|
||||
opt->warning = 1;
|
||||
if (*++s) {
|
||||
v = scan_oct(s, 1, &numlen);
|
||||
if (numlen == 0)
|
||||
v = 1;
|
||||
s += numlen;
|
||||
}
|
||||
switch (v) {
|
||||
case 0:
|
||||
ruby_verbose = Qnil;
|
||||
break;
|
||||
case 1:
|
||||
ruby_verbose = Qfalse;
|
||||
break;
|
||||
default:
|
||||
ruby_verbose = Qtrue;
|
||||
break;
|
||||
if (!opt->warning) {
|
||||
switch (v) {
|
||||
case 0:
|
||||
ruby_verbose = Qnil;
|
||||
break;
|
||||
case 1:
|
||||
ruby_verbose = Qfalse;
|
||||
break;
|
||||
default:
|
||||
ruby_verbose = Qtrue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
opt->warning = 1;
|
||||
}
|
||||
goto reswitch;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue