diff options
author | unknown <jani@hynda.mysql.fi> | 2002-04-03 15:44:20 +0300 |
---|---|---|
committer | unknown <jani@hynda.mysql.fi> | 2002-04-03 15:44:20 +0300 |
commit | 02f0a2f2eb7b00c4f33258150c143c78694adf81 (patch) | |
tree | aedb4bb20a5270b79f50b9f0125c0e601a1f1cd8 /mysys/my_getopt.c | |
parent | c9d04284c8e1b8ab179289534c6e8b2134883d25 (diff) | |
download | mariadb-git-02f0a2f2eb7b00c4f33258150c143c78694adf81.tar.gz |
Merge and two bug fixes in my_getopt.c
client/mysql.cc:
merge
client/mysqldump.c:
merge
myisam/myisamchk.c:
merge
mysys/my_getopt.c:
Fixed a bug with short options when type was GET_BOOL.
Fixed a bug in my_print_help() function.
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 0816303372b..0b24e77bca3 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -300,7 +300,14 @@ int handle_options(int *argc, char ***argv, { /* Option recognized. Find next what to do with it */ opt_found= 1; - if (optp->arg_type == REQUIRED_ARG || optp->arg_type == OPT_ARG) + if (optp->var_type == GET_BOOL && optp->arg_type == NO_ARG) + { + *((my_bool*) optp->value)= (my_bool) 1; + (*argc)--; + continue; + } + else if (optp->arg_type == REQUIRED_ARG || + optp->arg_type == OPT_ARG) { if (*(optend + 1)) { @@ -520,7 +527,7 @@ void my_print_help(const struct my_option *options) { printf("%s=name%s ", optp->arg_type == OPT_ARG ? "[" : "", optp->arg_type == OPT_ARG ? "]" : ""); - col+= 6; + col+= (optp->arg_type == OPT_ARG) ? 8 : 6; } else if (optp->var_type == GET_NO_ARG || optp->var_type == GET_BOOL) { @@ -531,7 +538,7 @@ void my_print_help(const struct my_option *options) { printf("%s=#%s ", optp->arg_type == OPT_ARG ? "[" : "", optp->arg_type == OPT_ARG ? "]" : ""); - col+= 3; + col+= (optp->arg_type == OPT_ARG) ? 5 : 3; } if (col > name_space) { |