summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
Diffstat (limited to 'mysys')
-rw-r--r--mysys/my_getopt.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c
index 5576c8b5d5d..9747ee4214e 100644
--- a/mysys/my_getopt.c
+++ b/mysys/my_getopt.c
@@ -1,6 +1,6 @@
/*
Copyright (c) 2002, 2013, Oracle and/or its affiliates
- Copyright (c) 2009, 2015, MariaDB
+ Copyright (c) 2009, 2020, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -79,6 +79,12 @@ my_bool my_getopt_skip_unknown= 0;
*/
my_bool my_getopt_prefix_matching= 1;
+/*
+ This is a flag that can be set in client programs. 1 means that
+ handle_options() will not initialize options to default values.
+*/
+my_bool my_handle_options_init_variables = 1;
+
my_getopt_value my_getopt_get_addr= 0;
static void default_reporter(enum loglevel level, const char *format, ...)
@@ -205,7 +211,8 @@ int handle_options(int *argc, char ***argv, const struct my_option *longopts,
DBUG_ASSERT(*argv);
(*argc)--; /* Skip the program name */
(*argv)++; /* --- || ---- */
- init_variables(longopts, init_one_value);
+ if (my_handle_options_init_variables)
+ init_variables(longopts, init_one_value);
is_cmdline_arg= !is_file_marker(**argv);