summaryrefslogtreecommitdiff
path: root/mysys/my_getopt.c
diff options
context:
space:
mode:
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(' ');