Commit 591bb4b8 authored by unknown's avatar unknown

* Fixed a bug in my_getopt

* Fixed some spelling/language errors in mysqlcheck
* Added some more information in mysql -client internal help.


Docs/manual.texi:
  Added a note about bug fix in my_getopt to changelog section.
client/mysql.cc:
  Added some information in mysql -client internal help.
client/mysqlcheck.c:
  Fixed some spelling / language errors.
mysys/my_getopt.c:
  Fixed a bug in my_getopt:
  --skip-external-locking didn't work and the same bug affected some
  other similar options. 
  
  After fix it is now possible to use the following:
  
  --external-locking                -> enable
  --external-locking=0              -> disable
  --external-locking=1              -> enable
  --skip-external-locking           -> disable
  --skip-external-locking=0         -> enable
  --skip-external-locking=1         -> disable
  --enable-external-locking         -> enable
  --enable-external-locking=0       -> disable
  --enable-external-locking=1       -> enable
  --skip-external-locking=garbage   -> disable
  --enable-external-locking=garbage -> enable
  
  This works now with all options that are boolean type and which
  name doesn't start with --skip- or --enable-.
parent fbb46332
......@@ -50344,6 +50344,10 @@ each individual 4.0.x release.
@itemize @bullet
@item
Fixed a bug in my_getopt in handling of special prefixes (--skip-, --enable-).
--skip-external-locking didn't work and the bug may have affected other
similar options.
@item
Fixed bug in checking for output file name of the @code{tee} option.
@end itemize
......@@ -40,7 +40,7 @@
#include <signal.h>
#include <violite.h>
const char *VER= "12.12";
const char *VER= "12.13";
/* Don't try to make a nice table if the data is too big */
#define MAX_COLUMN_LENGTH 1024
......@@ -1318,11 +1318,13 @@ com_help (String *buffer __attribute__((unused)),
{
reg1 int i;
put_info("\nFull documentation of MySQL is available at\nhttp://www.mysql.com/documentation/mysql/bychapter/\n", INFO_INFO);
put_info("For technical support contracts, visit https://order.mysql.com/\n", INFO_INFO);
put_info("MySQL commands:",INFO_INFO);
put_info("\nFor the complete MySQL Manual online visit:\n http://www.mysql.com/documentation\n", INFO_INFO);
put_info("For info on technical support from MySQL developers visit:\n http://www.mysql.com/support\n", INFO_INFO);
put_info("For info on MySQL books, utilities, consultants, etc. visit:\n http://www.mysql.com/portal\n", INFO_INFO);
put_info("List of all MySQL commands:", INFO_INFO);
if (!named_cmds)
put_info("Note that all text commands must be first on line and end with ';'",INFO_INFO);
put_info(" (Commands must appear first on line and end with ';')\n",
INFO_INFO);
for (i = 0; commands[i].name; i++)
{
if (commands[i].func)
......
......@@ -16,7 +16,7 @@
/* By Jani Tolonen, 2001-04-20, MySQL Development Team */
#define CHECK_VERSION "2.4"
#define CHECK_VERSION "2.4.1"
#include "client_priv.h"
#include <m_ctype.h>
......@@ -53,7 +53,7 @@ static struct my_option my_long_options[] =
{"analyze", 'a', "Analyze given tables.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0,
0, 0, 0, 0},
{"all-in-1", '1',
"Instead of making one query for each table, execute all queries in 1 query separately for each database. Table names will be in a comma separeted list.",
"Instead of issuing one query for each table, use one query per database, naming all tables in the database in a comma-separated list.",
(gptr*) &opt_all_in_1, (gptr*) &opt_all_in_1, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"auto-repair", OPT_AUTO_REPAIR,
......@@ -80,7 +80,7 @@ static struct my_option my_long_options[] =
{"default-character-set", OPT_DEFAULT_CHARSET,
"Set the default character set", (gptr*) &default_charset,
(gptr*) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"fast",'F', "Check only tables that hasn't been closed properly",
{"fast",'F', "Check only tables that haven't been closed properly",
(gptr*) &opt_fast, (gptr*) &opt_fast, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
0},
{"force", 'f', "Continue even if we get an sql-error.",
......@@ -169,7 +169,7 @@ static void usage(void)
puts("and you are welcome to modify and redistribute it under the GPL license.\n");
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 same time. It works on MyISAM and in some cases on BDB tables.");
puts("used at the same time. It works on MyISAM and in some cases on BDB tables.");
puts("Please consult the MySQL manual for latest information about the");
puts("above. The options -c,-r,-a and -o are exclusive to each other, which");
puts("means that the last option will be used, if several was specified.\n");
......
......@@ -210,10 +210,16 @@ int handle_options(int *argc, char ***argv,
switch (i) {
case OPT_SKIP:
case OPT_DISABLE: /* fall through */
optend= disabled_my_option;
/*
double negation is actually enable again,
for example: --skip-option=0 -> option = TRUE
*/
optend= (optend && *optend == '0' && !(*(optend + 1))) ?
(char*) "1" : disabled_my_option;
break;
case OPT_ENABLE:
optend= (char*) "1";
optend= (optend && *optend == '0' && !(*(optend + 1))) ?
disabled_my_option : (char*) "1";
break;
case OPT_MAXIMUM:
set_maximum_value= 1;
......@@ -278,7 +284,8 @@ int handle_options(int *argc, char ***argv,
}
if (optp->arg_type == NO_ARG)
{
if (optend && special_used)
// if (optend && special_used)
if (optend && optp->var_type != GET_BOOL)
{
if (my_getopt_print_errors)
fprintf(stderr, "%s: option '--%s' cannot take an argument\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment