summaryrefslogtreecommitdiff
path: root/mysys/my_getopt.c
diff options
context:
space:
mode:
authorunknown <jani@rhols221.arenanet.fi>2002-05-24 14:06:58 +0300
committerunknown <jani@rhols221.arenanet.fi>2002-05-24 14:06:58 +0300
commit072e605cdc5f8803d90f88877c7abe1b4efaa551 (patch)
treedde3a16d80cc4857063e077d484ded67a7697cb5 /mysys/my_getopt.c
parent701d369d1844f19853223860c8610e40b802f428 (diff)
downloadmariadb-git-072e605cdc5f8803d90f88877c7abe1b4efaa551.tar.gz
Changed ft_dump, ft_eval, ft_test1, mi_test1, myisampack, gen_lex_hash,
mysqlmanager from using GNU getopt to use my_getopt. Changed some files that just included old getopt.h to include my_getopt.h now. Fixed a bug in my_print_help() in my_getopt.c. Made better documentation for option -G in mysql client. client/mysql.cc: Documented --named-commands better. myisam/ft_dump.c: Changed getopt to my_getopt. myisam/ft_eval.c: Changed getopt to my_getopt. myisam/ft_test1.c: Changed getopt to my_getopt. myisam/mi_check.c: getopt.h -> my_getopt.h myisam/mi_test1.c: Changed getopt to my_getopt. myisam/myisampack.c: Changed getopt to my_getopt. mysys/my_getopt.c: Fixed a bug when printing help for option that didn't have a description. sql/gen_lex_hash.cc: Changed getopt to my_getopt. tools/mysqlmanager.c: Changed getopt to my_getopt. vio/test-ssl.c: getopt.h -> my_getopt.h vio/test-sslclient.c: getopt.h -> my_getopt.h vio/test-sslserver.c: getopt.h -> my_getopt.h vio/viotest-ssl.c: getopt.h -> my_getopt.h BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
Diffstat (limited to 'mysys/my_getopt.c')
-rw-r--r--mysys/my_getopt.c49
1 files changed, 26 insertions, 23 deletions
diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c
index 11b60c8da36..80904fb46f6 100644
--- a/mysys/my_getopt.c
+++ b/mysys/my_getopt.c
@@ -650,7 +650,7 @@ void my_print_help(const struct my_option *options)
{
if (optp->id < 256)
{
- printf(" -%c, ", optp->id);
+ printf(" -%c%s", optp->id, strlen(optp->name) ? ", " : " ");
col= 6;
}
else
@@ -658,29 +658,32 @@ void my_print_help(const struct my_option *options)
printf(" ");
col= 2;
}
- printf("--%s", optp->name);
- col+= 2 + strlen(optp->name);
- if (optp->var_type == GET_STR || optp->var_type == GET_STR_ALLOC)
+ if (strlen(optp->name))
{
- printf("%s=name%s ", optp->arg_type == OPT_ARG ? "[" : "",
- optp->arg_type == OPT_ARG ? "]" : "");
- col+= (optp->arg_type == OPT_ARG) ? 8 : 6;
- }
- else if (optp->var_type == GET_NO_ARG || optp->var_type == GET_BOOL)
- {
- putchar(' ');
- col++;
- }
- else
- {
- printf("%s=#%s ", optp->arg_type == OPT_ARG ? "[" : "",
- optp->arg_type == OPT_ARG ? "]" : "");
- col+= (optp->arg_type == OPT_ARG) ? 5 : 3;
- }
- if (col > name_space && optp->comment && *optp->comment)
- {
- putchar('\n');
- col= 0;
+ printf("--%s", optp->name);
+ col+= 2 + strlen(optp->name);
+ if (optp->var_type == GET_STR || optp->var_type == GET_STR_ALLOC)
+ {
+ printf("%s=name%s ", optp->arg_type == OPT_ARG ? "[" : "",
+ optp->arg_type == OPT_ARG ? "]" : "");
+ col+= (optp->arg_type == OPT_ARG) ? 8 : 6;
+ }
+ else if (optp->var_type == GET_NO_ARG || optp->var_type == GET_BOOL)
+ {
+ putchar(' ');
+ col++;
+ }
+ else
+ {
+ printf("%s=#%s ", optp->arg_type == OPT_ARG ? "[" : "",
+ optp->arg_type == OPT_ARG ? "]" : "");
+ col+= (optp->arg_type == OPT_ARG) ? 5 : 3;
+ }
+ if (col > name_space && optp->comment && *optp->comment)
+ {
+ putchar('\n');
+ col= 0;
+ }
}
for (; col < name_space; col++)
putchar(' ');