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.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c
index ce9006e03c0..9583b5a72c3 100644
--- a/mysys/my_getopt.c
+++ b/mysys/my_getopt.c
@@ -75,7 +75,7 @@ int handle_options(int *argc, char ***argv,
uint opt_found, argvpos= 0, length, i;
my_bool end_of_options= 0, must_be_var, set_maximum_value, special_used,
option_is_loose;
- char *progname= *(*argv), **pos, *optend, *prev_found;
+ char *progname= *(*argv), **pos, **pos_end, *optend, *prev_found;
const struct my_option *optp;
int error;
@@ -84,7 +84,7 @@ int handle_options(int *argc, char ***argv,
(*argv)++; /* --- || ---- */
init_variables(longopts);
- for (pos= *argv; *pos; pos++)
+ for (pos= *argv, pos_end=pos+ *argc; pos != pos_end ; pos++)
{
char *cur_arg= *pos;
if (cur_arg[0] == '-' && cur_arg[1] && !end_of_options) /* must be opt */