summaryrefslogtreecommitdiff
path: root/mysys/my_getopt.c
diff options
context:
space:
mode:
authorunknown <jani@hynda.(none)>2002-05-22 00:05:05 +0300
committerunknown <jani@hynda.(none)>2002-05-22 00:05:05 +0300
commitbb07d5c0432ceb64b27ff682faa9863051695615 (patch)
tree9eb125f10c2d91711ede0b6149a87d36b5b93b84 /mysys/my_getopt.c
parent3181a6af1b782ccbd23cd12b8e39e8e282b482e7 (diff)
downloadmariadb-git-bb07d5c0432ceb64b27ff682faa9863051695615.tar.gz
Changed mysqlbinlog, mysqlmanager-pwgen, mysqlmanagerc, mysqltest,
thread_test and isamchk to use my_getopt. Fixed a bug in my_getopt. client/mysqlbinlog.cc: Changed mysqlbinlog.cc to use my_getopt. client/mysqlmanager-pwgen.c: Changed mysqlmanager-pwgen to use my_getopt. client/mysqlmanagerc.c: Changed mysqlmanagerc to use my_getopt. client/mysqltest.c: Changed mysqltest to use my_getopt. client/thread_test.c: Changed thread_test to use my_getopt. isam/isamchk.c: Changed isamchk to use my_getopt. mysys/my_getopt.c: Fixed a bug in printing options when option didn't have a comment. Added startup initializing and printing for 'GET_BOOL' type variables. sql/mysql_priv.h: Changed type. sql/mysqld.cc: Fixed a bug in --local-infile option. BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
Diffstat (limited to 'mysys/my_getopt.c')
-rw-r--r--mysys/my_getopt.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c
index 2a981b20501..b5b98a8ba9a 100644
--- a/mysys/my_getopt.c
+++ b/mysys/my_getopt.c
@@ -593,6 +593,9 @@ static void init_variables(const struct my_option *options)
else if (options->var_type == GET_UINT)
*((uint*) options->u_max_value)= *((uint*) options->value)=
(uint) options->def_value;
+ else if (options->var_type == GET_BOOL)
+ *((my_bool*) options->u_max_value)= *((my_bool*) options->value)=
+ (my_bool) options->def_value;
else if (options->var_type == GET_LONG)
*((long*) options->u_max_value)= *((long*) options->value)=
(long) options->def_value;
@@ -653,7 +656,7 @@ void my_print_help(const struct my_option *options)
optp->arg_type == OPT_ARG ? "]" : "");
col+= (optp->arg_type == OPT_ARG) ? 5 : 3;
}
- if (col > name_space)
+ if (col > name_space && optp->comment && *optp->comment)
{
putchar('\n');
col= 0;
@@ -697,7 +700,7 @@ void my_print_variables(const struct my_option *options)
printf("--------------------------------- -------------\n");
for (optp= options; optp->id; optp++)
{
- if (optp->value && optp->var_type != GET_BOOL)
+ if (optp->value)
{
printf("%s", optp->name);
length= strlen(optp->name);
@@ -710,6 +713,13 @@ void my_print_variables(const struct my_option *options)
else
printf("(No default value)\n");
}
+ else if (optp->var_type == GET_BOOL)
+ {
+ if (!optp->def_value && !*((my_bool*) optp->value))
+ printf("(No default value)\n");
+ else
+ printf("%d\n", *((my_bool*) optp->value));
+ }
else if (optp->var_type == GET_INT)
{
if (!optp->def_value && !*((int*) optp->value))