From eb26bf6e09f714bfeda8e411b411b4991edf1c4d Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sun, 11 Dec 2022 00:11:43 +0100 Subject: [PATCH] unify client/tool version string it should now always be /path/to/exe Ver Distrib for () in all tools and clients --- client/mariadb-conv.cc | 8 +++----- client/mysql.cc | 4 ++-- client/mysql_plugin.c | 11 ++++------- client/mysql_upgrade.c | 6 ++---- client/mysqladmin.cc | 9 +-------- client/mysqlbinlog.cc | 7 +------ client/mysqlcheck.c | 10 +--------- client/mysqldump.c | 13 +++---------- client/mysqlimport.c | 9 +-------- client/mysqlshow.c | 9 +-------- client/mysqlslap.c | 9 +-------- client/mysqltest.cc | 8 +------- extra/innochecksum.cc | 16 ++-------------- extra/mariabackup/xbstream.cc | 11 ++--------- extra/my_print_defaults.c | 13 ++++--------- extra/perror.c | 9 +-------- extra/replace.c | 6 +++--- extra/resolve_stack_dump.c | 10 ++-------- extra/resolveip.c | 10 ++-------- include/welcome_copyright_notice.h | 8 ++++++++ mysql-test/main/mysqlbinlog.result | 2 +- mysql-test/main/mysqlbinlog.test | 2 +- sql/tztime.cc | 10 ++-------- storage/archive/archive_reader.c | 8 +------- storage/maria/aria_chk.c | 10 ++-------- storage/maria/aria_dump_log.c | 10 +++------- storage/maria/aria_pack.c | 8 ++------ storage/maria/aria_s3_copy.cc | 8 ++------ storage/myisam/myisamchk.c | 10 ++-------- storage/myisam/myisamlog.c | 5 +++-- storage/myisam/myisampack.c | 9 ++------- tests/mysql_client_fw.c | 6 +++--- 32 files changed, 69 insertions(+), 205 deletions(-) diff --git a/client/mariadb-conv.cc b/client/mariadb-conv.cc index 1774debe5f9..0e35812d9eb 100644 --- a/client/mariadb-conv.cc +++ b/client/mariadb-conv.cc @@ -20,13 +20,12 @@ Character set conversion utility */ +#define VER "1.0" #include "mariadb.h" #include "client_priv.h" #include "sql_string.h" #include "my_dir.h" - -#define CONV_VERSION "1.0" - +#include class CmdOpt { @@ -415,8 +414,7 @@ public: } void usage(void) { - printf("%s Ver %s Distrib %s for %s on %s\n", my_progname, CONV_VERSION, - MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE); + print_version(); puts("Character set conversion utility for MariaDB"); puts("Usage:"); printf("%s [OPTION...] [FILE...]\n", my_progname); diff --git a/client/mysql.cc b/client/mysql.cc index 0e704f70ecb..0ec8c734f24 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1850,11 +1850,11 @@ static void usage(int version) #else const char* readline= "readline"; #endif - printf("%s Ver %s Distrib %s, for %s (%s) using %s %s\n", + printf("%s Ver %s Distrib %s for %s (%s) using %s %s\n", my_progname, VER, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE, readline, rl_library_version); #else - printf("%s Ver %s Distrib %s, for %s (%s), source revision %s\n", my_progname, VER, + printf("%s Ver %s Distrib %s for %s (%s), source revision %s\n", my_progname, VER, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE,SOURCE_REVISION); #endif diff --git a/client/mysql_plugin.c b/client/mysql_plugin.c index d9084ec7c35..3b2dc78040e 100644 --- a/client/mysql_plugin.c +++ b/client/mysql_plugin.c @@ -15,17 +15,14 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ +#define VER "1.0" #include #include #include #include #include #include - -#define SHOW_VERSION "1.0.0" -#define PRINT_VERSION do { printf("%s Ver %s Distrib %s\n", \ - my_progname, SHOW_VERSION, MYSQL_SERVER_VERSION); \ - } while(0) +#include /* Global variables. */ static uint my_end_arg= 0; @@ -418,7 +415,7 @@ exit: static void usage(void) { - PRINT_VERSION; + print_version(); puts("Copyright (c) 2011, 2015, Oracle and/or its affiliates. " "All rights reserved.\n"); puts("Enable or disable plugins."); @@ -504,7 +501,7 @@ get_one_option(const struct my_option *opt, opt_verbose++; break; case 'V': - PRINT_VERSION; + print_version(); exit(0); break; case '?': diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index d026c347c82..ba42549ecfc 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -20,9 +20,8 @@ #include #include <../scripts/mysql_fix_privilege_tables_sql.c> -#include /* ORACLE_WELCOME_COPYRIGHT_NOTICE */ - #define VER "2.0" +#include /* ORACLE_WELCOME_COPYRIGHT_NOTICE */ #ifdef HAVE_SYS_WAIT_H #include @@ -296,8 +295,7 @@ get_one_option(const struct my_option *opt, const char *argument, switch (opt->id) { case '?': - printf("%s Ver %s Distrib %s, for %s (%s)\n", - my_progname, VER, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE); + print_version(); puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000")); puts("MariaDB utility for upgrading databases to new MariaDB versions."); print_defaults("my", load_default_groups); diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index 38b3be837bc..1b99b5ce085 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -17,6 +17,7 @@ /* maintenance of mysql databases */ +#define VER "9.1" #include "client_priv.h" #include #include /* because of signal() */ @@ -28,7 +29,6 @@ #include #include -#define ADMIN_VERSION "9.1" #define MAX_MYSQL_VAR 512 #define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */ #define MAX_TRUNC_LENGTH 3 @@ -1389,13 +1389,6 @@ static char **mask_password(int argc, char ***argv) return(temp_argv); } -static void print_version(void) -{ - printf("%s Ver %s Distrib %s, for %s on %s\n",my_progname,ADMIN_VERSION, - MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE); -} - - static void usage(void) { print_version(); diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 82b9ff20731..1dc96958ba5 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -29,6 +29,7 @@ Format_desc_of_slave, Rotate_of_master, Format_desc_of_master. */ +#define VER "3.5" #define MYSQL_CLIENT #undef MYSQL_SERVER #define TABLE TABLE_CLIENT @@ -2154,12 +2155,6 @@ static void die() } -static void print_version() -{ - printf("%s Ver 3.5 for %s at %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE); -} - - static void usage() { print_version(); diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 12804b3c667..0a5a4e1a446 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -18,7 +18,7 @@ /* By Jani Tolonen, 2001-04-20, MySQL Development Team */ -#define CHECK_VERSION "2.7.4-MariaDB" +#define VER "2.8" #include "client_priv.h" #include @@ -228,7 +228,6 @@ static const char *load_default_groups[]= 0 }; -static void print_version(void); static void usage(void); static int get_options(int *argc, char ***argv); static int process_all_databases(); @@ -248,13 +247,6 @@ static char *fix_table_name(char *dest, char *src); int what_to_do = 0; -static void print_version(void) -{ - printf("%s Ver %s Distrib %s, for %s (%s)\n", my_progname, CHECK_VERSION, - MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE); -} /* print_version */ - - static void usage(void) { DBUG_ENTER("usage"); diff --git a/client/mysqldump.c b/client/mysqldump.c index 842b13e8997..b28bc32897e 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -40,7 +40,7 @@ */ /* on merge conflict, bump to a higher version again */ -#define DUMP_VERSION "10.19" +#define VER "10.19" /** First mysql version supporting sequences. @@ -696,13 +696,6 @@ void check_io(FILE *file) die(EX_EOF, "Got errno %d on write", errno); } -static void print_version(void) -{ - printf("%s Ver %s Distrib %s, for %s (%s)\n",my_progname_short,DUMP_VERSION, - MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE); -} /* print_version */ - - static void short_usage_sub(FILE *f) { fprintf(f, "Usage: %s [OPTIONS] database [tables]\n", my_progname_short); @@ -775,8 +768,8 @@ static void write_header(FILE *sql_file, const char *db_name) else if (!opt_compact) { print_comment(sql_file, 0, - "-- MariaDB dump %s Distrib %s, for %s (%s)\n--\n", - DUMP_VERSION, MYSQL_SERVER_VERSION, SYSTEM_TYPE, + "-- MariaDB dump %s-%s, for %s (%s)\n--\n", + VER, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE); print_comment(sql_file, 0, "-- Host: %s ", fix_for_comment(current_host ? current_host : "localhost")); diff --git a/client/mysqlimport.c b/client/mysqlimport.c index 82dbd682bd6..6307cd0c46e 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -27,7 +27,7 @@ ** * * ** ************************* */ -#define IMPORT_VERSION "3.7" +#define VER "3.7" #include "client_priv.h" #include @@ -194,13 +194,6 @@ static const char *load_default_groups[]= 0 }; -static void print_version(void) -{ - printf("%s Ver %s Distrib %s, for %s (%s)\n" ,my_progname, - IMPORT_VERSION, MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE); -} - - static void usage(void) { puts("Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc."); diff --git a/client/mysqlshow.c b/client/mysqlshow.c index 6bc4e3978bb..236fa1e25fd 100644 --- a/client/mysqlshow.c +++ b/client/mysqlshow.c @@ -18,7 +18,7 @@ /* Show databases, tables or columns */ -#define SHOW_VERSION "9.10" +#define VER "9.10" #include "client_priv.h" #include @@ -276,13 +276,6 @@ static struct my_option my_long_options[] = }; -static void print_version(void) -{ - printf("%s Ver %s Distrib %s, for %s (%s)\n",my_progname,SHOW_VERSION, - MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE); -} - - static void usage(void) { print_version(); diff --git a/client/mysqlslap.c b/client/mysqlslap.c index 54df0124063..4ca69c9ed0a 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -67,7 +67,7 @@ TODO: */ -#define SLAP_VERSION "1.0" +#define VER "1.0" #define HUGE_STRING_LENGTH 8196 #define RAND_STRING_SIZE 126 @@ -720,13 +720,6 @@ static struct my_option my_long_options[] = }; -static void print_version(void) -{ - printf("%s Ver %s Distrib %s, for %s (%s)\n",my_progname, SLAP_VERSION, - MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE); -} - - static void usage(void) { print_version(); diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 3930a325d09..9682f346253 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -33,7 +33,7 @@ And many others */ -#define MTEST_VERSION "3.5" +#define VER "3.5" #include "client_priv.h" #include @@ -7192,12 +7192,6 @@ static struct my_option my_long_options[] = }; -void print_version(void) -{ - printf("%s Ver %s Distrib %s, for %s (%s)\n",my_progname,MTEST_VERSION, - MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE); -} - void usage() { print_version(); diff --git a/extra/innochecksum.cc b/extra/innochecksum.cc index fc616f1aa14..1f7f341e397 100644 --- a/extra/innochecksum.cc +++ b/extra/innochecksum.cc @@ -26,6 +26,8 @@ Published with a permission. */ +#define VER "1.0" + #include #include #include @@ -1209,20 +1211,6 @@ static struct my_option innochecksum_options[] = { {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; -/** Print out the version and build information. */ -static void print_version() -{ -#ifdef DBUG_OFF - printf("%s Ver %s, for %s (%s)\n", - my_progname, PACKAGE_VERSION, - SYSTEM_TYPE, MACHINE_TYPE); -#else - printf("%s-debug Ver %s, for %s (%s)\n", - my_progname, PACKAGE_VERSION, - SYSTEM_TYPE, MACHINE_TYPE); -#endif /* DBUG_OFF */ -} - static void usage(void) { print_version(); diff --git a/extra/mariabackup/xbstream.cc b/extra/mariabackup/xbstream.cc index 6306806b867..3a3ba55b8b2 100644 --- a/extra/mariabackup/xbstream.cc +++ b/extra/mariabackup/xbstream.cc @@ -18,6 +18,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA *******************************************************/ +#define VER "1.0" #include #include #include @@ -26,8 +27,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA #include "common.h" #include "xbstream.h" #include "datasink.h" +#include -#define XBSTREAM_VERSION "1.0" #define XBSTREAM_BUFFER_SIZE (10 * 1024 * 1024UL) #define START_FILE_HASH_SIZE 16 @@ -146,14 +147,6 @@ get_options(int *argc, char ***argv) return 0; } -static -void -print_version(void) -{ - printf("%s Ver %s for %s (%s)\n", my_progname, XBSTREAM_VERSION, - SYSTEM_TYPE, MACHINE_TYPE); -} - static void usage(void) diff --git a/extra/my_print_defaults.c b/extra/my_print_defaults.c index ef2f483556a..6aa60aa8ce8 100644 --- a/extra/my_print_defaults.c +++ b/extra/my_print_defaults.c @@ -21,13 +21,14 @@ ** ** Written by Monty */ - +#define VER "1.7" #include #include #include #include #include #include +#include #define load_default_groups mysqld_groups #include @@ -68,16 +69,10 @@ static void cleanup_and_exit(int exit_code) exit(exit_code); } -static void version() -{ - printf("%s Ver 1.7 for %s at %s\n",my_progname,SYSTEM_TYPE, MACHINE_TYPE); -} - - static void usage() __attribute__ ((noreturn)); static void usage() { - version(); + print_version(); puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license\n"); puts("Displays the options from option groups of option files, which is useful to see which options a particular tool will use"); printf("Usage: %s [OPTIONS] [groups]\n", my_progname); @@ -104,7 +99,7 @@ get_one_option(const struct my_option *opt __attribute__((unused)), verbose++; break; case 'V': - version(); + print_version(); /* fall through */ case '#': DBUG_PUSH(argument ? argument : default_dbug_option); diff --git a/extra/perror.c b/extra/perror.c index ee6e362e06b..c9e9ae6e334 100644 --- a/extra/perror.c +++ b/extra/perror.c @@ -16,7 +16,7 @@ /* Return error-text for system error messages and handler messages */ -#define PERROR_VERSION "2.11" +#define VER "2.11" #include #include @@ -76,13 +76,6 @@ static HA_ERRORS ha_errlist[]= }; -static void print_version(void) -{ - printf("%s Ver %s, for %s (%s)\n",my_progname,PERROR_VERSION, - SYSTEM_TYPE,MACHINE_TYPE); -} - - static void usage(void) { print_version(); diff --git a/extra/replace.c b/extra/replace.c index 8b20f812be0..81c7f484bdf 100644 --- a/extra/replace.c +++ b/extra/replace.c @@ -41,12 +41,13 @@ Written by Monty. fill_buffer_retaining() is taken from gnu-grep and modified. */ - +#define VER "1.4" #include #include #include #include #include +#include #define PC_MALLOC 256 /* Bytes for pointers */ #define PS_MALLOC 512 /* Bytes for data */ @@ -176,8 +177,7 @@ static int static_get_options(int *argc, char***argv) case 'I': case '?': help=1; /* Help text written */ - printf("%s Ver 1.4 for %s at %s\n",my_progname,SYSTEM_TYPE, - MACHINE_TYPE); + print_version(); if (version) break; puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license\n"); diff --git a/extra/resolve_stack_dump.c b/extra/resolve_stack_dump.c index fe2f297fd33..2b09f5bf1fb 100644 --- a/extra/resolve_stack_dump.c +++ b/extra/resolve_stack_dump.c @@ -18,6 +18,7 @@ versions into symbolic names. By Sasha Pachev */ +#define VER "1.4" #include #include #include @@ -25,11 +26,11 @@ #include #include #include +#include #define INIT_SYM_TABLE 4096 #define INC_SYM_TABLE 4096 #define MAX_SYM_SIZE 128 -#define DUMP_VERSION "1.4" #define HEX_INVALID (uchar)255 typedef ulong my_long_addr_t ; /* at some point, we need to fix configure @@ -65,13 +66,6 @@ static struct my_option my_long_options[] = static void verify_sort(); static void clean_up(); -static void print_version(void) -{ - printf("%s Ver %s Distrib %s, for %s (%s)\n",my_progname,DUMP_VERSION, - MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE); -} - - static void usage() { print_version(); diff --git a/extra/resolveip.c b/extra/resolveip.c index 890912d9850..d964802d3b3 100644 --- a/extra/resolveip.c +++ b/extra/resolveip.c @@ -16,7 +16,7 @@ /* Resolves IP's to hostname and hostnames to IP's */ -#define RESOLVE_VERSION "2.3" +#define VER "2.3" #include #include @@ -31,6 +31,7 @@ #endif #include #include +#include #if !defined(_AIX) && !defined(h_errno) extern int h_errno; @@ -52,13 +53,6 @@ static struct my_option my_long_options[] = }; -static void print_version(void) -{ - printf("%s Ver %s, for %s (%s)\n",my_progname,RESOLVE_VERSION, - SYSTEM_TYPE,MACHINE_TYPE); -} - - static void usage(void) { print_version(); diff --git a/include/welcome_copyright_notice.h b/include/welcome_copyright_notice.h index 22d8d204268..7993cd1dc3a 100644 --- a/include/welcome_copyright_notice.h +++ b/include/welcome_copyright_notice.h @@ -27,4 +27,12 @@ "Copyright (c) " first_year ", " COPYRIGHT_NOTICE_CURRENT_YEAR \ ", Oracle, MariaDB Corporation Ab and others.\n" +#ifdef VER +static inline void print_version() +{ + /* NOTE mysql.cc is not using this function! */ + printf("%s Ver %s Distrib %s for %s (%s)\n", + my_progname, VER, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE); +} +#endif #endif /* _welcome_copyright_notice_h_ */ diff --git a/mysql-test/main/mysqlbinlog.result b/mysql-test/main/mysqlbinlog.result index f7c7b2c677e..101d4940a48 100644 --- a/mysql-test/main/mysqlbinlog.result +++ b/mysql-test/main/mysqlbinlog.result @@ -1269,7 +1269,7 @@ DELIMITER ; ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; -mariadb-binlog Ver VER for OS at ARCH +mariadb-binlog Ver VER Distrib DISTRIB for OS (ARCH) # # Test --rewrite-db # diff --git a/mysql-test/main/mysqlbinlog.test b/mysql-test/main/mysqlbinlog.test index b12709583e4..cccf9657973 100644 --- a/mysql-test/main/mysqlbinlog.test +++ b/mysql-test/main/mysqlbinlog.test @@ -608,7 +608,7 @@ eval SET GLOBAL SERVER_ID = $old_server_id; # # MDEV-12372 mysqlbinlog --version output is the same on 10.x as on 5.5.x, and contains not only version # -replace_regex /.*mariadb-binlog(\.exe)? Ver .* for .* at [-_a-zA-Z0-9]+/mariadb-binlog Ver VER for OS at ARCH/; +replace_regex /.*mariadb-binlog(\.exe)? Ver .* Distrib .* for .* \([-_a-zA-Z0-9]+\)/mariadb-binlog Ver VER Distrib DISTRIB for OS (ARCH)/; exec $MYSQL_BINLOG --version; --echo # diff --git a/sql/tztime.cc b/sql/tztime.cc index 2e39a20fc91..57f1ab872ee 100644 --- a/sql/tztime.cc +++ b/sql/tztime.cc @@ -29,6 +29,7 @@ #pragma implementation // gcc: Class implementation #endif +#define VER "1.1" #include "mariadb.h" #if !defined(TZINFO2SQL) && !defined(TESTTIME) #include "sql_priv.h" @@ -43,6 +44,7 @@ #include #endif +#include #include "tztime.h" #include "tzfile.h" #include @@ -64,8 +66,6 @@ #endif /* !defined(DBUG_OFF) */ #endif /* defined(TZINFO2SQL) || defined(TESTTIME) */ -#define PROGRAM_VERSION "1.1" - /* Structure describing local time type (e.g. Moscow summer time (MSD)) */ typedef struct ttinfo { @@ -2666,12 +2666,6 @@ static my_bool get_one_option(const struct my_option *, const char *, const char *); C_MODE_END -static void print_version(void) -{ - printf("%s Ver %s Distrib %s, for %s (%s)\n",my_progname, PROGRAM_VERSION, - MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE); -} - static const char *default_timezone_dir= "/usr/share/zoneinfo/"; diff --git a/storage/archive/archive_reader.c b/storage/archive/archive_reader.c index 0e02127ea32..85637a04391 100644 --- a/storage/archive/archive_reader.c +++ b/storage/archive/archive_reader.c @@ -26,7 +26,7 @@ #define BUFFER_LEN 1024 #define ARCHIVE_ROW_HEADER_SIZE 4 -#define SHOW_VERSION "0.1" +#define VER "0.1" static void get_options(int *argc,char * * *argv); static void print_version(void); @@ -400,12 +400,6 @@ static void usage(void) my_print_help(my_long_options); } -static void print_version(void) -{ - printf("%s Ver %s Distrib %s, for %s (%s)\n", my_progname, SHOW_VERSION, - MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE); -} - static void get_options(int *argc, char ***argv) { load_defaults_or_exit("my", load_default_groups, argc, argv); diff --git a/storage/maria/aria_chk.c b/storage/maria/aria_chk.c index 7d5598f06b5..92a9945e3ba 100644 --- a/storage/maria/aria_chk.c +++ b/storage/maria/aria_chk.c @@ -15,6 +15,7 @@ /* Describe, check and repair of MARIA tables */ +#define VER "1.3" #include "ma_fulltext.h" #include #include @@ -25,6 +26,7 @@ /* Remove next line if you want aria_chk to produce a stack trace */ #undef HAVE_BACKTRACE #include +#include static uint decode_bits; static char **default_argv; @@ -79,7 +81,6 @@ static char default_open_errmsg[]= "%d when opening Aria table '%s'"; static char default_close_errmsg[]= "%d when closing Aria table '%s'"; static void get_options(int *argc,char * * *argv); -static void print_version(void); static void usage(void); static int maria_chk(HA_CHECK *param, char *filename); static void descript(HA_CHECK *param, register MARIA_HA *info, char *name); @@ -471,13 +472,6 @@ static struct my_option my_long_options[] = }; -static void print_version(void) -{ - printf("%s Ver 1.3 for %s on %s\n", my_progname, SYSTEM_TYPE, - MACHINE_TYPE); -} - - static void usage(void) { print_version(); diff --git a/storage/maria/aria_dump_log.c b/storage/maria/aria_dump_log.c index e64c97fcda3..4317e1b6f3b 100644 --- a/storage/maria/aria_dump_log.c +++ b/storage/maria/aria_dump_log.c @@ -13,8 +13,11 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ +#define VER "1.1" #include "maria_def.h" #include +#include + extern void translog_example_table_init(); static const char *load_default_groups[]= { "aria_dump_log",0 }; static void get_options(int *argc,char * * *argv); @@ -64,13 +67,6 @@ static struct my_option my_long_options[] = }; -static void print_version(void) -{ - printf("%s Ver 1.1 for %s on %s\n", - my_progname_short, SYSTEM_TYPE, MACHINE_TYPE); -} - - static void usage(void) { print_version(); diff --git a/storage/maria/aria_pack.c b/storage/maria/aria_pack.c index 40e7e399613..eab4d512e8b 100644 --- a/storage/maria/aria_pack.c +++ b/storage/maria/aria_pack.c @@ -19,6 +19,7 @@ #define USE_MY_FUNC /* We need at least my_malloc */ #endif +#define VER "1.0" #include "maria_def.h" #include "trnman_public.h" #include "trnman.h" @@ -33,6 +34,7 @@ #endif #include #include +#include #if SIZEOF_LONG_LONG > 4 #define BITS_SAVED 64 @@ -353,12 +355,6 @@ static struct my_option my_long_options[] = }; -static void print_version(void) -{ - printf("%s Ver 1.0 for %s on %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE); -} - - static void usage(void) { print_version(); diff --git a/storage/maria/aria_s3_copy.cc b/storage/maria/aria_s3_copy.cc index 77c41ba4572..5c8c2abc7db 100644 --- a/storage/maria/aria_s3_copy.cc +++ b/storage/maria/aria_s3_copy.cc @@ -17,6 +17,7 @@ Allow copying of Aria tables to and from S3 and also delete them from S3 */ +#define VER "1.0" #include #include #include "maria_def.h" @@ -28,6 +29,7 @@ #include #include #include "s3_func.h" +#include static const char *op_types[]= {"to_s3", "from_s3", "delete_from_s3", NullS}; static TYPELIB op_typelib= {array_elements(op_types)-1,"", op_types, NULL}; @@ -109,12 +111,6 @@ static struct my_option my_long_options[] = static bool get_database_from_path(char *to, size_t to_length, const char *path); -static void print_version(void) -{ - printf("%s Ver 1.0 for %s on %s\n", my_progname, SYSTEM_TYPE, - MACHINE_TYPE); -} - static void usage(void) { print_version(); diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c index a5777527e54..17d2eef898a 100644 --- a/storage/myisam/myisamchk.c +++ b/storage/myisam/myisamchk.c @@ -15,12 +15,14 @@ /* Describe, check and repair of MyISAM tables */ +#define VER "2.7" #include "fulltext.h" #include "my_default.h" #include #include #include #include +#include static uint decode_bits; static char **default_argv; @@ -53,7 +55,6 @@ static const char *field_pack[]= static const char *myisam_stats_method_str="nulls_unequal"; static void get_options(int *argc,char * * *argv); -static void print_version(void); static void usage(void); static int myisamchk(HA_CHECK *param, char *filename); static void descript(HA_CHECK *param, register MI_INFO *info, char * name); @@ -331,13 +332,6 @@ static struct my_option my_long_options[] = }; -static void print_version(void) -{ - printf("%s Ver 2.7 for %s at %s\n", my_progname, SYSTEM_TYPE, - MACHINE_TYPE); -} - - static void usage(void) { print_version(); diff --git a/storage/myisam/myisamlog.c b/storage/myisam/myisamlog.c index 40d473dc532..4e51af4ac3d 100644 --- a/storage/myisam/myisamlog.c +++ b/storage/myisam/myisamlog.c @@ -20,12 +20,14 @@ #define USE_MY_FUNC #endif +#define VER "1.4" #include "myisamdef.h" #include #include #ifdef HAVE_GETRUSAGE #include #endif +#include #define FILENAME(A) (A ? A->show_name : "Unknown") @@ -249,8 +251,7 @@ static void get_options(register int *argc, register char ***argv) /* Fall through */ case 'I': case '?': - printf("%s Ver 1.4 for %s at %s\n",my_progname,SYSTEM_TYPE, - MACHINE_TYPE); + print_version(); puts("By Monty, for your professional use\n"); if (version) break; diff --git a/storage/myisam/myisampack.c b/storage/myisam/myisampack.c index d6cd9334a55..709530d915c 100644 --- a/storage/myisam/myisampack.c +++ b/storage/myisam/myisampack.c @@ -20,6 +20,7 @@ #define USE_MY_FUNC /* We need at least my_malloc */ #endif +#define VER "1.23" #include "myisamdef.h" #include "my_default.h" #include @@ -30,6 +31,7 @@ #endif #include #include +#include #if SIZEOF_LONG_LONG > 4 #define BITS_SAVED 64 @@ -289,13 +291,6 @@ static struct my_option my_long_options[] = }; -static void print_version(void) -{ - printf("%s Ver 1.23 for %s on %s\n", - my_progname, SYSTEM_TYPE, MACHINE_TYPE); -} - - static void usage(void) { print_version(); diff --git a/tests/mysql_client_fw.c b/tests/mysql_client_fw.c index bfa7f296300..6cfe960fb04 100644 --- a/tests/mysql_client_fw.c +++ b/tests/mysql_client_fw.c @@ -13,6 +13,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ +#define VER "2.1" #include #include #include @@ -24,6 +25,7 @@ #include #include #include +#include /* If non_blocking_api_enabled is true, we will re-define all the blocking @@ -37,7 +39,6 @@ static my_bool non_blocking_api_enabled= 0; #include "nonblock-wrappers.h" #endif -#define VER "2.1" #define MAX_TEST_QUERY_LENGTH 300 /* MAX QUERY BUFFER LENGTH */ #define MAX_KEY MAX_INDEXES #define MAX_SERVER_ARGS 64 @@ -1256,8 +1257,7 @@ static void usage(void) { /* show the usage string when the user asks for this */ putc('\n', stdout); - printf("%s Ver %s Distrib %s, for %s (%s)\n", - my_progname, VER, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE); + print_version(); puts("By Monty, Venu, Kent and others\n"); printf("\ Copyright (C) 2002-2004 MySQL AB\n\