diff options
Diffstat (limited to 'client')
-rw-r--r-- | client/mysql.cc | 29 | ||||
-rw-r--r-- | client/mysql_upgrade.c | 7 | ||||
-rw-r--r-- | client/mysqladmin.cc | 12 | ||||
-rw-r--r-- | client/mysqlbinlog.cc | 20 | ||||
-rw-r--r-- | client/mysqlcheck.c | 15 | ||||
-rw-r--r-- | client/mysqldump.c | 4 | ||||
-rw-r--r-- | client/mysqlimport.c | 5 | ||||
-rw-r--r-- | client/mysqlshow.c | 5 | ||||
-rw-r--r-- | client/mysqlslap.c | 4 | ||||
-rw-r--r-- | client/mysqltest.cc | 5 | ||||
-rw-r--r-- | client/sql_string.h.dontuse | 11 |
11 files changed, 64 insertions, 53 deletions
diff --git a/client/mysql.cc b/client/mysql.cc index 5aab3e1098f..67878b36227 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1,6 +1,6 @@ -/* Copyright (C) 2000-2009 MySQL AB - Copyright 2000, 2010-2011, Oracle and/or its affiliates. - Copyright 2000-2010 Monty Program Ab +/* + Copyright (c) 2000, 2012, Oracle and/or its affiliates. + Copyright (c) 2009, 2012, Monty Program Ab. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,10 +15,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#define COPYRIGHT_NOTICE "\ -This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n\ -and you are welcome to modify and redistribute it under the GPL v2 license\n" - /* mysql command tool * Commands compatible with mSQL by David J. Hughes * @@ -111,6 +107,7 @@ extern "C" { #endif #include "completion_hash.h" +#include <welcome_copyright_notice.h> // ORACLE_WELCOME_COPYRIGHT_NOTICE #define PROMPT_CHAR '\\' #define DEFAULT_DELIMITER ";" @@ -1193,7 +1190,7 @@ int main(int argc,char *argv[]) mysql_thread_id(&mysql), server_version_string(&mysql)); put_info((char*) glob_buffer.ptr(),INFO_INFO); - put_info(COPYRIGHT_NOTICE, INFO_INFO); + put_info(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"), INFO_INFO); #ifdef HAVE_READLINE initialize_readline((char*) my_progname); @@ -1624,7 +1621,7 @@ static void usage(int version) if (version) return; - printf("%s", COPYRIGHT_NOTICE); + puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000")); printf("Usage: %s [OPTIONS] [database]\n", my_progname); my_print_help(my_long_options); print_defaults("my", load_default_groups); @@ -2808,7 +2805,7 @@ static int com_server_help(String *buffer __attribute__((unused)), char *line __attribute__((unused)), char *help_arg) { MYSQL_ROW cur; - const char *server_cmd= buffer->ptr(); + const char *server_cmd; char cmd_buf[100 + 1]; MYSQL_RES *result; int error; @@ -2823,9 +2820,12 @@ static int com_server_help(String *buffer __attribute__((unused)), *++end_arg= '\0'; } (void) strxnmov(cmd_buf, sizeof(cmd_buf), "help '", help_arg, "'", NullS); - server_cmd= cmd_buf; } - + else + (void) strxnmov(cmd_buf, sizeof(cmd_buf), "help ", help_arg, NullS); + + server_cmd= cmd_buf; + if (!status.batch) { old_buffer= *buffer; @@ -2893,6 +2893,11 @@ static int com_server_help(String *buffer __attribute__((unused)), else { put_info("\nNothing found", INFO_INFO); + if (strncasecmp(server_cmd, "help 'contents'", 15) == 0) + { + put_info("\nPlease check if 'help tables' are loaded.\n", INFO_INFO); + goto err; + } put_info("Please try to run 'help contents' for a list of all accessible topics\n", INFO_INFO); } } diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index d7f311fcb69..71bc936cfe6 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -1,7 +1,6 @@ /* - Copyright (C) 2000 MySQL AB - Copyright (c) 2006, 2011, Oracle and/or its affiliates. - Copyright (C) 2010-2011 Monty Program Ab + Copyright (c) 2006, 2012, Oracle and/or its affiliates. + Copyright (C) 2010, 2012, Monty Program Ab. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -252,7 +251,7 @@ get_one_option(int optid, const struct my_option *opt, case '?': printf("%s Ver %s Distrib %s, for %s (%s)\n", my_progname, VER, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE); - puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2010")); + puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000")); puts("MariaDB utility for upgrading databases to new MariaDB versions.\n"); my_print_help(my_long_options); die(0); diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index c36c8a16881..e2ebb883f77 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -1,5 +1,6 @@ /* - Copyright (c) 2000, 2011, Oracle and/or its affiliates. + Copyright (c) 2000, 2012, Oracle and/or its affiliates. + Copyright (c) 2010, 2012, Monty Program Ab. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,6 +23,7 @@ #include <sys/stat.h> #include <mysql.h> #include <sql_common.h> +#include <welcome_copyright_notice.h> /* ORACLE_WELCOME_COPYRIGHT_NOTICE */ #define ADMIN_VERSION "9.0" #define MAX_MYSQL_VAR 512 @@ -702,9 +704,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) case ADMIN_VER: new_line=1; print_version(); - puts("Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc,\n" - "2009 Monty Program Ab"); - 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(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000")); printf("Server version\t\t%s\n", mysql_get_server_info(mysql)); printf("Protocol version\t%d\n", mysql_get_proto_info(mysql)); printf("Connection\t\t%s\n",mysql_get_host_info(mysql)); @@ -1176,9 +1176,7 @@ static void print_version(void) static void usage(void) { print_version(); - puts("Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc,\n" - "2009 Monty Program Ab"); - 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(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000")); puts("Administration program for the mysqld daemon."); printf("Usage: %s [OPTIONS] command command....\n", my_progname); my_print_help(my_long_options); diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 2c1687c6c90..777e68902dd 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -38,6 +38,9 @@ #include "sql_priv.h" #include "log_event.h" #include "sql_common.h" +#include "my_dir.h" +#include <welcome_copyright_notice.h> // ORACLE_WELCOME_COPYRIGHT_NOTICE + #include "sql_string.h" // needed for Rpl_filter #include "sql_list.h" // needed for Rpl_filter @@ -1501,10 +1504,7 @@ static void print_version() static void usage() { print_version(); - puts("By Monty and Sasha, for your professional use\n\ -This software comes with NO WARRANTY: This is free software,\n\ -and you are welcome to modify and redistribute it under the GPL license.\n"); - + puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000")); printf("\ Dumps a MySQL binary log in a format usable for viewing or for piping to\n\ the mysql command line client.\n\n"); @@ -2073,6 +2073,7 @@ static Exit_status check_header(IO_CACHE* file, uchar header[BIN_LOG_HEADER_SIZE]; uchar buf[PROBE_HEADER_LEN]; my_off_t tmp_pos, pos; + MY_STAT my_file_stat; delete glob_description_event; if (!(glob_description_event= new Format_description_log_event(3))) @@ -2082,7 +2083,16 @@ static Exit_status check_header(IO_CACHE* file, } pos= my_b_tell(file); - my_b_seek(file, (my_off_t)0); + + /* fstat the file to check if the file is a regular file. */ + if (my_fstat(file->file, &my_file_stat, MYF(0)) == -1) + { + error("Unable to stat the file."); + return ERROR_STOP; + } + if ((my_file_stat.st_mode & S_IFMT) == S_IFREG) + my_b_seek(file, (my_off_t)0); + if (my_b_read(file, header, sizeof(header))) { error("Failed reading header; probably an empty file."); diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 39ceb423968..4218f2da62c 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -1,6 +1,6 @@ -/* Copyright (C) 2000 MySQL AB & Jani Tolonen - Copyright (c) 2001, 2011, Oracle and/or its affiliates. - Copyright (C) 2010-2011 Monty Program Ab +/* + Copyright (c) 2001, 2012, Oracle and/or its affiliates. + Copyright (c) 2010, 2011, Monty Program Ab. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -25,6 +25,7 @@ #include <mysql_version.h> #include <mysqld_error.h> #include <sslopt-vars.h> +#include <welcome_copyright_notice.h> /* ORACLE_WELCOME_COPYRIGHT_NOTICE */ /* Exit codes */ @@ -229,13 +230,7 @@ static void usage(void) { DBUG_ENTER("usage"); print_version(); - puts("By Jani Tolonen, 2001-04-20, MySQL Development Team.\n"); - puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,"); - puts("and you are welcome to modify and redistribute it under the GPL license.\n"); - printf("Usage: %s [OPTIONS] database [tables]\n", my_progname); - printf("OR %s [OPTIONS] --databases DB1 [DB2 DB3...]\n", - my_progname); - printf("OR %s [OPTIONS] --all-databases\n\n", my_progname); + puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000")); puts("This program can be used to CHECK (-c, -m, -C), REPAIR (-r), ANALYZE (-a),"); puts("or OPTIMIZE (-o) tables. Some of the options (like -e or -q) can be"); puts("used at the same time. Not all options are supported by all storage engines."); diff --git a/client/mysqldump.c b/client/mysqldump.c index e9a7a66298e..284ea1e760a 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -1,5 +1,6 @@ /* Copyright (c) 2000, 2012, Oracle and/or its affiliates. + Copyright (c) 2010, 2012, Monty Program Ab. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -616,8 +617,7 @@ static void short_usage_sub(void) static void usage(void) { print_version(); - puts("By Igor Romanenko, Monty, Jani & Sinisa and others."); - 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(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000")); puts("Dumping structure and contents of MySQL databases and tables."); short_usage_sub(); print_defaults("my",load_default_groups); diff --git a/client/mysqlimport.c b/client/mysqlimport.c index e4e34f786d7..77d0cd0a7d3 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2011, Oracle and/or its affiliates. + Copyright (c) 2000, 2012, Oracle and/or its affiliates. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -208,7 +208,8 @@ static void usage(void) puts("Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc."); puts("Copyright 2008-2011 Oracle and Monty Program Ab."); print_version(); - printf("\n\ + puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000")); + printf("\ Loads tables from text files in various formats. The base name of the\n\ text file must be the name of the table that should be used.\n\ If one uses sockets to connect to the MySQL server, the server will open and\n\ diff --git a/client/mysqlshow.c b/client/mysqlshow.c index d0db2020998..5cf2be1160c 100644 --- a/client/mysqlshow.c +++ b/client/mysqlshow.c @@ -27,6 +27,7 @@ #include <signal.h> #include <stdarg.h> #include <sslopt-vars.h> +#include <welcome_copyright_notice.h> /* ORACLE_WELCOME_COPYRIGHT_NOTICE */ static char * host=0, *opt_password=0, *user=0; static my_bool opt_show_keys= 0, opt_compress= 0, opt_count=0, opt_status= 0; @@ -266,9 +267,7 @@ static void print_version(void) static void usage(void) { print_version(); - puts("Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc."); - puts("Copyright 2008-2011 Oracle and Monty Program Ab."); - 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(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000")); puts("Shows the structure of a MySQL database (databases, tables, and columns).\n"); printf("Usage: %s [OPTIONS] [database [table [column]]]\n",my_progname); puts("\n\ diff --git a/client/mysqlslap.c b/client/mysqlslap.c index e3da44e2fc5..8e70a2609c3 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2011, Oracle and/or its affiliates. + Copyright (c) 2005, 2012, Oracle and/or its affiliates. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -722,7 +722,7 @@ static void print_version(void) static void usage(void) { print_version(); - puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2005, 2010")); + puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2005")); puts("Run a query multiple times against the server.\n"); printf("Usage: %s [OPTIONS]\n",my_progname); print_defaults("my",load_default_groups); diff --git a/client/mysqltest.cc b/client/mysqltest.cc index bb89db4b231..5415b653615 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -54,6 +54,8 @@ #include <signal.h> #include <my_stacktrace.h> +#include <welcome_copyright_notice.h> // ORACLE_WELCOME_COPYRIGHT_NOTICE + #ifdef __WIN__ #include <crtdbg.h> #define SIGNAL_FMT "exception 0x%x" @@ -6961,8 +6963,7 @@ void print_version(void) void usage() { print_version(); - printf("MySQL AB, by Sasha, Matt, Monty & Jani and others\n"); - printf("This software comes with ABSOLUTELY NO WARRANTY\n\n"); + puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000")); printf("Runs a test against the mysql server and compares output with a results file.\n\n"); printf("Usage: %s [OPTIONS] [database] < test_file\n", my_progname); my_print_help(my_long_options); diff --git a/client/sql_string.h.dontuse b/client/sql_string.h.dontuse index fc302110513..67155ebcee7 100644 --- a/client/sql_string.h.dontuse +++ b/client/sql_string.h.dontuse @@ -1,8 +1,7 @@ #ifndef SQL_STRING_INCLUDED #define SQL_STRING_INCLUDED -/* - Copyright (c) 2000, 2010, Oracle and/or its affiliates +/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -194,8 +193,12 @@ public: } bool real_alloc(uint32 arg_length); // Empties old string bool realloc(uint32 arg_length); - inline void shrink(uint32 arg_length) // Shrink buffer + + // Shrink the buffer, but only if it is allocated on the heap. + inline void shrink(uint32 arg_length) { + if (!is_alloced()) + return; if (arg_length < Alloced_length) { char *new_ptr; @@ -211,7 +214,7 @@ public: } } } - bool is_alloced() { return alloced; } + bool is_alloced() const { return alloced; } inline String& operator = (const String &s) { if (&s != this) |