From c7d7d8abe304a7f43b149a6480882633727b9907 Mon Sep 17 00:00:00 2001 From: "jani@rhols221.adsl.netsonic.fi" <> Date: Wed, 28 Aug 2002 13:14:11 +0300 Subject: * Fixed a bug in my_getopt * Fixed some spelling/language errors in mysqlcheck * Added some more information in mysql -client internal help. --- mysys/my_getopt.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'mysys') diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index 5b86fddbbdb..466b6dd7a30 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -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", -- cgit v1.2.1