summaryrefslogtreecommitdiff
path: root/mysys/my_getopt.c
diff options
context:
space:
mode:
authorjani@rhols221.adsl.netsonic.fi <>2002-08-28 13:14:11 +0300
committerjani@rhols221.adsl.netsonic.fi <>2002-08-28 13:14:11 +0300
commitc7d7d8abe304a7f43b149a6480882633727b9907 (patch)
tree59289dd43f08e74bda577cb43a483086756b7d68 /mysys/my_getopt.c
parent7d4de76907a4046623af406a19e41212e8d8150d (diff)
downloadmariadb-git-c7d7d8abe304a7f43b149a6480882633727b9907.tar.gz
* Fixed a bug in my_getopt
* Fixed some spelling/language errors in mysqlcheck * Added some more information in mysql -client internal help.
Diffstat (limited to 'mysys/my_getopt.c')
-rw-r--r--mysys/my_getopt.c13
1 files changed, 10 insertions, 3 deletions
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",