diff options
author | jani@hynda.mysql.fi <> | 2002-04-02 20:29:53 +0300 |
---|---|---|
committer | jani@hynda.mysql.fi <> | 2002-04-02 20:29:53 +0300 |
commit | c143f01dd104e69712d32f14febb9a0a1a8ce815 (patch) | |
tree | 1646f32146d233c71f082b8d74b469e6a1c1e70f /include | |
parent | 697978b5bf6365a4d8c3b8e571f4c2b19d4cd8b2 (diff) | |
download | mariadb-git-c143f01dd104e69712d32f14febb9a0a1a8ce815.tar.gz |
Changed mysql, mysqladmin, mysqlshow, mysqldump, mysqlimport,
mysqlcheck and myisamchk to use new my_getopt struct.
Diffstat (limited to 'include')
-rw-r--r-- | include/my_getopt.h | 17 | ||||
-rw-r--r-- | include/sslopt-case.h | 4 | ||||
-rw-r--r-- | include/sslopt-longopts.h | 33 |
3 files changed, 30 insertions, 24 deletions
diff --git a/include/my_getopt.h b/include/my_getopt.h index 2e40fb8ffaa..b3b3ee2f785 100644 --- a/include/my_getopt.h +++ b/include/my_getopt.h @@ -14,28 +14,21 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -struct my_optarg -{ - char *arg; /* option argument */ - int pos; /* next element in ARGV */ - int verbose; /* 0 = inhibit warnings of unrecognized options */ - int unrecognized; /* position of the unrecognized option */ -}; +C_MODE_START - -enum get_opt_var_type { GET_NO_ARG, GET_LONG, GET_LL, GET_STR }; +enum get_opt_var_type { GET_NO_ARG, GET_BOOL, GET_LONG, GET_LL, GET_STR }; enum get_opt_arg_type { NO_ARG, OPT_ARG, REQUIRED_ARG }; struct my_option { const char *name; /* Name of the option */ + int id; /* unique id or short option */ const char *comment; /* option comment, for autom. --help */ gptr *value; /* The variable value */ gptr *u_max_value; /* The user def. max variable value */ const char **str_values; /* Pointer to possible values */ enum get_opt_var_type var_type; enum get_opt_arg_type arg_type; - int id; /* unique id or short option */ longlong def_value; /* Default value */ longlong min_value; /* Min allowed value */ longlong max_value; /* Max allowed value */ @@ -44,6 +37,8 @@ struct my_option int app_type; /* To be used by an application */ }; +extern char *disabled_my_option; + extern int handle_options (int *argc, char ***argv, const struct my_option *longopts, my_bool (*get_one_option)(int, @@ -51,3 +46,5 @@ extern int handle_options (int *argc, char ***argv, char *)); extern void my_print_help(const struct my_option *options); extern void my_print_variables(const struct my_option *options); + +C_MODE_END diff --git a/include/sslopt-case.h b/include/sslopt-case.h index ae6026f9136..e6e3a416bb0 100644 --- a/include/sslopt-case.h +++ b/include/sslopt-case.h @@ -20,8 +20,8 @@ break; case OPT_SSL_KEY: opt_use_ssl = 1; /* true */ - my_free(opt_ssl_key, MYF(MY_ALLOW_ZERO_PTR)); - opt_ssl_key = my_strdup(optarg, MYF(0)); +//QQ to be removed??? my_free(opt_ssl_key, MYF(MY_ALLOW_ZERO_PTR)); +//QQ to be removed??? opt_ssl_key = my_strdup(optarg, MYF(0)); break; case OPT_SSL_CERT: opt_use_ssl = 1; /* true */ diff --git a/include/sslopt-longopts.h b/include/sslopt-longopts.h index 2a0f27f3235..d82c833c439 100644 --- a/include/sslopt-longopts.h +++ b/include/sslopt-longopts.h @@ -16,17 +16,26 @@ #ifdef HAVE_OPENSSL -#define OPT_SSL_SSL 200 -#define OPT_SSL_KEY 201 -#define OPT_SSL_CERT 202 -#define OPT_SSL_CA 203 -#define OPT_SSL_CAPATH 204 -#define OPT_SSL_CIPHER 205 - {"ssl", no_argument, 0, OPT_SSL_SSL}, - {"ssl-key", required_argument, 0, OPT_SSL_KEY}, - {"ssl-cert", required_argument, 0, OPT_SSL_CERT}, - {"ssl-ca", required_argument, 0, OPT_SSL_CA}, - {"ssl-capath", required_argument, 0, OPT_SSL_CAPATH}, - {"ssl-cipher", required_argument, 0, OPT_SSL_CIPHER}, + {"ssl", OPT_SSL_SSL, + "Use SSL for connection (automatically set with other flags)", + (gptr*) &opt_use_ssl, (gptr*) &opt_use_ssl, 0, GET_BOOL, NO_ARG, 0, 0, 0, + 0, 0, 0}, + {"ssl-key", OPT_SSL_KEY, "X509 key in PEM format (implies --ssl)", + (gptr*) &opt_ssl_key, (gptr*) &opt_ssl_key, 0, GET_STR, REQUIRED_ARG, + 0, 0, 0, 0, 0, 0}, + {"ssl-cert", OPT_SSL_CERT, "X509 cert in PEM format (implies --ssl)", + (gptr*) &opt_ssl_cert, (gptr*) &opt_ssl_cert, 0, GET_STR, REQUIRED_ARG, + 0, 0, 0, 0, 0, 0}, + {"ssl-ca", OPT_SSL_CA, + "CA file in PEM format (check OpenSSL docs, implies --ssl)", + (gptr*) &opt_ssl_ca, (gptr*) &opt_ssl_ca, 0, GET_STR, REQUIRED_ARG, + 0, 0, 0, 0, 0, 0}, + {"ssl-capath", OPT_SSL_CAPATH, + "CA directory (check OpenSSL docs, implies --ssl)", + (gptr*) &opt_ssl_capath, (gptr*) &opt_ssl_capath, 0, GET_STR, REQUIRED_ARG, + 0, 0, 0, 0, 0, 0}, + {"ssl-cipher", OPT_SSL_CAPATH, "SSL cipher to use (implies --ssl)", + (gptr*) &opt_ssl_cipher, (gptr*) &opt_ssl_cipher, 0, GET_STR, REQUIRED_ARG, + 0, 0, 0, 0, 0, 0}, #endif /* HAVE_OPENSSL */ |