From 0e92dc4b729970112e8205fa1dd55b17af38d27a Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 9 Aug 2012 09:33:49 +0000 Subject: [PATCH] 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 --- ChangeLog | 6 ++++++ ruby.c | 7 ++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1eca24f59a..cd63b34936 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Thu Aug 9 18:33:46 2012 Nobuyoshi Nakada + + * 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 * test/openssl/test_config.rb (OpenSSL#test_constants): skip this diff --git a/ruby.c b/ruby.c index ab4b6747aa..0a5cee9474 100644 --- a/ruby.c +++ b/ruby.c @@ -62,6 +62,7 @@ enum disable_flag_bits { #define DUMP_BIT(bit) (1U << dump_##bit) enum dump_flag_bits { dump_version, + dump_version_v, dump_copyright, dump_usage, dump_yydebug, @@ -748,7 +749,7 @@ proc_options(long argc, char **argv, struct cmdline_options *opt, int envopt) s++; goto reswitch; } - ruby_show_version(); + opt->dump |= DUMP_BIT(version_v); opt->verbose = 1; case 'w': ruby_verbose = Qtrue; @@ -1271,9 +1272,9 @@ process_options(int argc, char **argv, struct cmdline_options *opt) if (opt->src.enc.name) 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(); - return Qtrue; + if (opt->dump & DUMP_BIT(version)) return Qtrue; } if (opt->dump & DUMP_BIT(copyright)) { ruby_show_copyright();