From 33b70fc6caa6a4e0c2c534f2c2b5a7d0c5f97b34 Mon Sep 17 00:00:00 2001
From: Konstantin Osipov <kostja.osipov@gmail.com>
Date: Sat, 14 May 2011 15:37:28 +0400
Subject: [PATCH] A (partial) fix for Bug#748630

A partial fix for Bug#748630
"Make --help and --version follow GNU standard".

Add product name to the --version output.
Leave --help intact, there is sufficient
information about how to report bug in it
already.

Update test results.

Remove an unused declaration from tarantool.h.

Add mod_name to each module and output
it in --version.
---
 core/tarantool.c     | 2 +-
 include/tarantool.h  | 3 ++-
 mod/feeder/feeder.c  | 1 +
 mod/silverbox/box.c  | 2 ++
 test/box/args.result | 4 ++--
 5 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/core/tarantool.c b/core/tarantool.c
index 12efa6df30..4d7353a155 100644
--- a/core/tarantool.c
+++ b/core/tarantool.c
@@ -389,7 +389,7 @@ main(int argc, char **argv)
 	binary_filename = argv[0];
 
 	if (gopt(opt, 'V')) {
-		puts(tarantool_version());
+		printf("Tarantool/%s %s\n", mod_name, tarantool_version());
 		return 0;
 	}
 
diff --git a/include/tarantool.h b/include/tarantool.h
index 2e8d409d09..5f5e1af9ad 100644
--- a/include/tarantool.h
+++ b/include/tarantool.h
@@ -34,6 +34,8 @@
 extern struct recovery_state *recovery_state;
 void mod_init(void);
 struct tarantool_cfg;
+
+extern const char *mod_name;
 i32 mod_check_config(struct tarantool_cfg *conf);
 void mod_reload_config(struct tarantool_cfg *old_conf, struct tarantool_cfg *new_conf);
 int mod_cat(const char *filename);
@@ -41,7 +43,6 @@ void mod_snapshot(struct log_io_iter *);
 void mod_info(struct tbuf *out);
 void mod_exec(char *str, int len, struct tbuf *out);
 
-extern struct tarantool_module module;
 extern struct tarantool_cfg cfg;
 extern struct tbuf *cfg_out;
 extern const char *cfg_filename;
diff --git a/mod/feeder/feeder.c b/mod/feeder/feeder.c
index f2c4233e55..16d31d8335 100644
--- a/mod/feeder/feeder.c
+++ b/mod/feeder/feeder.c
@@ -32,6 +32,7 @@
 #include <util.h>
 #include "cfg/tarantool_feeder_cfg.h"
 
+const char *mod_name = "Feeder";
 static char *custom_proc_title;
 
 static int
diff --git a/mod/silverbox/box.c b/mod/silverbox/box.c
index c4db16a74a..0288c8f677 100644
--- a/mod/silverbox/box.c
+++ b/mod/silverbox/box.c
@@ -45,6 +45,8 @@
 #include <mod/silverbox/box.h>
 #include <mod/silverbox/index.h>
 
+const char *mod_name = "Silverbox";
+
 bool box_updates_allowed = false;
 static char *status = "unknown";
 
diff --git a/test/box/args.result b/test/box/args.result
index c6e5528c54..43290bf08c 100644
--- a/test/box/args.result
+++ b/test/box/args.result
@@ -62,10 +62,10 @@ tarantool_silverbox --daemonize
 tarantool_silverbox: the daemon is already running
 
 tarantool_silverbox --version
-1.minor.patch-<rev>-<commit>
+Tarantool/Silverbox 1.minor.patch-<rev>-<commit>
 
 tarantool_silverbox -V
-1.minor.patch-<rev>-<commit>
+Tarantool/Silverbox 1.minor.patch-<rev>-<commit>
 
 #
 # A test case for Bug#726778 "Gopt broke wal_dir and snap_dir: they are no
-- 
GitLab