summaryrefslogtreecommitdiff
path: root/mysys/my_getopt.c
diff options
context:
space:
mode:
authorunknown <serg@janus.mylan>2007-04-13 19:23:02 +0200
committerunknown <serg@janus.mylan>2007-04-13 19:23:02 +0200
commitbf2aaad97d0ff65a4a79f9012b4443d4d6dbd6e8 (patch)
treec318326d7c94a04b34753308fce3a0bb1b38f53e /mysys/my_getopt.c
parent1e6bd48ccbd725c298453cf6c7645b430529fe43 (diff)
downloadmariadb-git-bf2aaad97d0ff65a4a79f9012b4443d4d6dbd6e8.tar.gz
wl#2936 - fixing problems
include/mysql/plugin.h: warning. no int/realsize mysys/my_getopt.c: combination of prefixes (e.g. --loose-skip-) didn't work sql/event_queue.cc: warning sql/handler.cc: assert sql/handler.h: comment sql/item_create.cc: warnings sql/log.cc: warnings sql/mysqld.cc: wl#2936 - fixing problems (memory leak in load_defaults, garbage in opt_[slow_]logname sql/partition_element.h: warnings sql/rpl_utility.h: warnings sql/set_var.cc: comment sql/set_var.h: warnings sql/sql_class.cc: warnings sql/sql_parse.cc: warnings sql/sql_plugin.cc: wl#2936 - fixing problems: portability, coding style, reporting of spurious errors, crashes, incorrect help output storage/example/ha_example.cc: comment storage/innobase/handler/ha_innodb.cc: wl#2936 - fixing problems (crash)
Diffstat (limited to 'mysys/my_getopt.c')
-rw-r--r--mysys/my_getopt.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c
index f893cf89b5c..4573d27555a 100644
--- a/mysys/my_getopt.c
+++ b/mysys/my_getopt.c
@@ -97,18 +97,18 @@ void my_getopt_register_get_addr(gptr* (*func_addr)(const char *, uint,
getopt_get_addr= func_addr;
}
-int handle_options(int *argc, char ***argv,
+int handle_options(int *argc, char ***argv,
const struct my_option *longopts,
my_get_one_option get_one_option)
{
- uint opt_found, argvpos= 0, length, i;
+ uint opt_found, argvpos= 0, length;
my_bool end_of_options= 0, must_be_var, set_maximum_value,
option_is_loose;
char **pos, **pos_end, *optend, *prev_found,
*opt_str, key_name[FN_REFLEN];
const struct my_option *optp;
gptr *value;
- int error;
+ int error, i;
LINT_INIT(opt_found);
(*argc)--; /* Skip the program name */
@@ -224,12 +224,11 @@ int handle_options(int *argc, char ***argv,
/*
We were called with a special prefix, we can reuse opt_found
*/
- opt_str+= (special_opt_prefix_lengths[i] + 1);
+ opt_str+= special_opt_prefix_lengths[i] + 1;
+ length-= special_opt_prefix_lengths[i] + 1;
if (i == OPT_LOOSE)
option_is_loose= 1;
- if ((opt_found= findopt(opt_str, length -
- (special_opt_prefix_lengths[i] + 1),
- &optp, &prev_found)))
+ if ((opt_found= findopt(opt_str, length, &optp, &prev_found)))
{
if (opt_found > 1)
{
@@ -253,7 +252,7 @@ int handle_options(int *argc, char ***argv,
break;
case OPT_ENABLE:
optend= (optend && *optend == '0' && !(*(optend + 1))) ?
- disabled_my_option : (char*) "1";
+ disabled_my_option : (char*) "1";
break;
case OPT_MAXIMUM:
set_maximum_value= 1;
@@ -262,6 +261,7 @@ int handle_options(int *argc, char ***argv,
}
break; /* break from the inner loop, main loop continues */
}
+ i= -1; /* restart the loop */
}
}
}