ruby.c: show version only once

* ruby.c (proc_options): show version only once even if -v and
  --verbose are given together.
  http://twitter.com/d6rkaiz/status/233491797085671424


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2012-08-09 09:33:49 +00:00
Родитель f207f7793d
Коммит 0e92dc4b72
2 изменённых файлов: 10 добавлений и 3 удалений

Просмотреть файл

@ -1,3 +1,9 @@
Thu Aug 9 18:33:46 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ruby.c (proc_options): show version only once even if -v and
--verbose are given together.
http://twitter.com/d6rkaiz/status/233491797085671424
Thu Aug 9 12:37:22 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com> Thu Aug 9 12:37:22 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
* test/openssl/test_config.rb (OpenSSL#test_constants): skip this * test/openssl/test_config.rb (OpenSSL#test_constants): skip this

7
ruby.c
Просмотреть файл

@ -62,6 +62,7 @@ enum disable_flag_bits {
#define DUMP_BIT(bit) (1U << dump_##bit) #define DUMP_BIT(bit) (1U << dump_##bit)
enum dump_flag_bits { enum dump_flag_bits {
dump_version, dump_version,
dump_version_v,
dump_copyright, dump_copyright,
dump_usage, dump_usage,
dump_yydebug, dump_yydebug,
@ -748,7 +749,7 @@ proc_options(long argc, char **argv, struct cmdline_options *opt, int envopt)
s++; s++;
goto reswitch; goto reswitch;
} }
ruby_show_version(); opt->dump |= DUMP_BIT(version_v);
opt->verbose = 1; opt->verbose = 1;
case 'w': case 'w':
ruby_verbose = Qtrue; ruby_verbose = Qtrue;
@ -1271,9 +1272,9 @@ process_options(int argc, char **argv, struct cmdline_options *opt)
if (opt->src.enc.name) if (opt->src.enc.name)
rb_warning("-K is specified; it is for 1.8 compatibility and may cause odd behavior"); rb_warning("-K is specified; it is for 1.8 compatibility and may cause odd behavior");
if (opt->dump & DUMP_BIT(version)) { if (opt->dump & (DUMP_BIT(version) | DUMP_BIT(version_v))) {
ruby_show_version(); ruby_show_version();
return Qtrue; if (opt->dump & DUMP_BIT(version)) return Qtrue;
} }
if (opt->dump & DUMP_BIT(copyright)) { if (opt->dump & DUMP_BIT(copyright)) {
ruby_show_copyright(); ruby_show_copyright();