diff options
author | unknown <jani@rhols221.adsl.netsonic.fi> | 2002-08-28 13:14:11 +0300 |
---|---|---|
committer | unknown <jani@rhols221.adsl.netsonic.fi> | 2002-08-28 13:14:11 +0300 |
commit | 591bb4b872548573fb01baa860e8a4e7aeb0f83b (patch) | |
tree | 59289dd43f08e74bda577cb43a483086756b7d68 /mysys/my_getopt.c | |
parent | fbb46332fe16eaf1ed649d74008243f1c310a9f6 (diff) | |
download | mariadb-git-591bb4b872548573fb01baa860e8a4e7aeb0f83b.tar.gz |
* 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-.
Diffstat (limited to 'mysys/my_getopt.c')
-rw-r--r-- | mysys/my_getopt.c | 13 |
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", |