summaryrefslogtreecommitdiff
path: root/ruby.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-08-09 09:33:49 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-08-09 09:33:49 +0000
commit0e92dc4b729970112e8205fa1dd55b17af38d27a (patch)
treecdc574e2d0256c4693b0988a689e1563536703d0 /ruby.c
parentf207f7793da422b0a5fec771c5413fb9bd5b2bc0 (diff)
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
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/ruby.c b/ruby.c
index ab4b674..0a5cee9 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();