From ce658857d03b0242c04031dff4d615a1e7d98b48 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 11 May 2002 14:36:34 +0300 Subject: - Fixed some option types in my_getopt struct in all clients. - Added special option/variable prefix '--loose-' to my_getopt.c client/mysql.cc: Fixed some variable types. client/mysqladmin.c: Fixed some variable types. client/mysqlcheck.c: Fixed some variable types. client/mysqldump.c: Fixed some variable types. client/mysqlimport.c: Fixed some variable types. client/mysqlshow.c: Fixed some variable types. myisam/myisamchk.c: Fixed some variable types. mysys/my_getopt.c: Fixed a bug in noticing whether argument was allowed to option (variable). Added support for prefix --loose-option-name This will work with options and variables, but not with --set-variable (!) --set-variable is depricated and --variable-name=value should be used instead. When used, my_getopt will not return error if option/variable was not found, but print a warning, do a no-op and continue. BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- client/mysqladmin.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'client/mysqladmin.c') diff --git a/client/mysqladmin.c b/client/mysqladmin.c index 7f6d1d1a85d..08ff9546111 100644 --- a/client/mysqladmin.c +++ b/client/mysqladmin.c @@ -24,7 +24,7 @@ #include /* because of signal() */ #endif -#define ADMIN_VERSION "8.30" +#define ADMIN_VERSION "8.31" #define MAX_MYSQL_VAR 64 #define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */ #define MAX_TRUNC_LENGTH 3 @@ -124,8 +124,8 @@ static struct my_option my_long_options[] = {"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"port", 'P', "Port number to use for connection.", 0, 0, 0, - GET_LONG, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"port", 'P', "Port number to use for connection.", (gptr*) &tcp_port, + (gptr*) &tcp_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"relative", 'r', "Show difference between current and previous values when used with -i. Currently works only with extended-status.", (gptr*) &opt_relative, (gptr*) &opt_relative, 0, GET_BOOL, NO_ARG, 0, 0, 0, @@ -138,7 +138,8 @@ static struct my_option my_long_options[] = {"socket", 'S', "Socket file to use for connection.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"sleep", 'i', "Execute commands again and again with a sleep between.", - 0, 0, 0, GET_LONG, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + (gptr*) &interval, (gptr*) &interval, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, + 0, 0}, #include "sslopt-longopts.h" #ifndef DONT_ALLOW_USER_CHANGE {"user", 'u', "User for login if not current user.", (gptr*) &user, @@ -155,10 +156,10 @@ static struct my_option my_long_options[] = {"wait", 'w', "Wait and retry if connection is down", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"connect_timeout", OPT_CONNECT_TIMEOUT, "", (gptr*) &opt_connect_timeout, - (gptr*) &opt_connect_timeout, 0, GET_LONG, REQUIRED_ARG, 3600*12, 0, + (gptr*) &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG, 3600*12, 0, 3600*12, 0, 1, 0}, {"shutdown_timeout", OPT_SHUTDOWN_TIMEOUT, "", (gptr*) &opt_shutdown_timeout, - (gptr*) &opt_shutdown_timeout, 0, GET_LONG, REQUIRED_ARG, + (gptr*) &opt_shutdown_timeout, 0, GET_ULONG, REQUIRED_ARG, SHUTDOWN_DEF_TIMEOUT, 0, 3600*12, 0, 1, 0}, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; -- cgit v1.2.1 From b14726de6b27196debc0f99b5a49dca47656173a Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 14 May 2002 21:41:55 +0300 Subject: - Added new type GET_STRALC to my_getopt. - Fixed some bugs, wrongly freed pointers, in some clients. - Removed unneccessary code. - Fixed some other minor bugs and added some options into variables category, which had accidently been left out earlier. client/mysql.cc: Fixed some wrong freed pointers. Removed unneccessary code. Changed some types from GET_STR to GET_STRALC. client/mysqladmin.c: Fixed some wrong freed pointers. Removed unneccessary code. Changed some types from GET_STR to GET_STRALC. client/mysqlcheck.c: Fixed some wrong freed pointers. Removed unneccessary code. Changed some types from GET_STR to GET_STRALC. client/mysqldump.c: Fixed some wrong freed pointers. Removed unneccessary code. Changed some types from GET_STR to GET_STRALC. client/mysqlimport.c: Removed unneccessary code. Fixed a bug in option --ignore-lines client/mysqlshow.c: Removed unneccessary code. include/my_getopt.h: Added new type, GET_STRALC. The name stands for GET STRING ALLOC, which means that the struct member value and u_max_value are strings that must be alloced and freed when used. The normal GET_STR works similarly otherwise, except that it's arguments are just pointers to strings, not alloced ones. mysys/my_getopt.c: Added support for GET_STRALC --- client/mysqladmin.c | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) (limited to 'client/mysqladmin.c') diff --git a/client/mysqladmin.c b/client/mysqladmin.c index 08ff9546111..6bab465b488 100644 --- a/client/mysqladmin.c +++ b/client/mysqladmin.c @@ -24,7 +24,7 @@ #include /* because of signal() */ #endif -#define ADMIN_VERSION "8.31" +#define ADMIN_VERSION "8.32" #define MAX_MYSQL_VAR 64 #define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */ #define MAX_TRUNC_LENGTH 3 @@ -136,14 +136,15 @@ static struct my_option my_long_options[] = {"silent", 's', "Silently exit if one can't connect to server", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"socket", 'S', "Socket file to use for connection.", - 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + (gptr*) &unix_port, (gptr*) &unix_port, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, + 0, 0, 0}, {"sleep", 'i', "Execute commands again and again with a sleep between.", (gptr*) &interval, (gptr*) &interval, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #include "sslopt-longopts.h" #ifndef DONT_ALLOW_USER_CHANGE {"user", 'u', "User for login if not current user.", (gptr*) &user, - (gptr*) &user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + (gptr*) &user, 0, GET_STRALC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #endif {"verbose", 'v', "Write more information.", (gptr*) &opt_verbose, (gptr*) &opt_verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -174,10 +175,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), int error = 0; switch(optid) { - case 'h': - host = argument; - break; - case 'q': /* Allow old 'q' option */ case 'p': if (argument) { @@ -191,23 +188,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), else tty_password=1; break; -#ifndef DONT_ALLOW_USER_CHANGE - case 'u': - user= my_strdup(argument,MYF(0)); - break; -#endif - case 'i': - interval=atoi(argument); - break; - case 'P': - tcp_port= (unsigned int) atoi(argument); - break; case 's': option_silent++; break; - case 'S': - unix_port= argument; - break; case 'W': #ifdef __WIN__ unix_port=MYSQL_NAMEDPIPE; -- cgit v1.2.1 From a4c1ba532545390058102d6eb5a2443927e8a7c2 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 15 May 2002 20:24:00 +0300 Subject: Changed GET_STRALC to GET_STR_ALLOC mysys/my_getopt.c: Changed GET_STRALC to GET_STR_ALLOC Added error checking for my_strdup() --- client/mysqladmin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'client/mysqladmin.c') diff --git a/client/mysqladmin.c b/client/mysqladmin.c index 6bab465b488..2359c7c54c5 100644 --- a/client/mysqladmin.c +++ b/client/mysqladmin.c @@ -144,7 +144,7 @@ static struct my_option my_long_options[] = #include "sslopt-longopts.h" #ifndef DONT_ALLOW_USER_CHANGE {"user", 'u', "User for login if not current user.", (gptr*) &user, - (gptr*) &user, 0, GET_STRALC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + (gptr*) &user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #endif {"verbose", 'v', "Write more information.", (gptr*) &opt_verbose, (gptr*) &opt_verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, -- cgit v1.2.1 From 8a12d34eb8b160de6f36a619654dfc1c81bc3fa6 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 22 May 2002 23:54:24 +0300 Subject: moved my_getopt.h under client_priv.h Changed my_print_defaults, mysql_install, perror, resolve_stack_dump, resolveip and pack_isam to use my_getopt. client/client_priv.h: getopt -> my_getopt client/mysql.cc: moved my_getopt.h under client_priv.h client/mysqladmin.c: moved my_getopt.h under client_priv.h client/mysqlbinlog.cc: moved my_getopt.h under client_priv.h client/mysqlcheck.c: moved my_getopt.h under client_priv.h client/mysqldump.c: moved my_getopt.h under client_priv.h client/mysqlimport.c: moved my_getopt.h under client_priv.h client/mysqlshow.c: moved my_getopt.h under client_priv.h extra/my_print_defaults.c: Changed from getopt to use my_getopt extra/mysql_install.c: Changed from getopt to use my_getopt extra/perror.c: Changed from getopt to use my_getopt extra/resolve_stack_dump.c: Changed from getopt to use my_getopt extra/resolveip.c: Changed from getopt to use my_getopt fs/mysqlcorbafs.c: Left reminder about my_getopt when this program is ready. Currently it's not being compiled. isam/pack_isam.c: Changed from getopt to use my_getopt --- client/mysqladmin.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'client/mysqladmin.c') diff --git a/client/mysqladmin.c b/client/mysqladmin.c index 2359c7c54c5..6fa8e8220f4 100644 --- a/client/mysqladmin.c +++ b/client/mysqladmin.c @@ -19,12 +19,11 @@ #include "client_priv.h" #include -#include #ifdef THREAD #include /* because of signal() */ #endif -#define ADMIN_VERSION "8.32" +#define ADMIN_VERSION "8.34" #define MAX_MYSQL_VAR 64 #define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */ #define MAX_TRUNC_LENGTH 3 -- cgit v1.2.1 From 4f725190efb6c0523ce3a898043b00d9078db03c Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 29 May 2002 15:07:30 +0300 Subject: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. Changed some exit code names and corresponding numbers. Fixed a bug in mysqld.cc, in replication related options. Added a global flag in my_getopt, which can be set by any program that is using my_getopt, which tells whether the client should print the error message itself, or whether my_getopt should do it. The default is that my_getopt will print the error messages. client/mysql.cc: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. client/mysqladmin.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. client/mysqlbinlog.cc: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. client/mysqlcheck.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. client/mysqldump.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. client/mysqlimport.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. client/mysqlmanager-pwgen.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. client/mysqlmanagerc.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. client/mysqlshow.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. client/mysqltest.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. client/thread_test.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. extra/my_print_defaults.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. extra/mysql_install.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. extra/perror.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. extra/resolve_stack_dump.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. extra/resolveip.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. include/my_getopt.h: Added global (flag) variable which tells my_getopt whether to print errors or just silently exit with proper error code. include/mysys_err.h: Changed exit code names and corresponding numbers. isam/isamchk.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. isam/pack_isam.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. myisam/ft_dump.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. myisam/ft_eval.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. myisam/ft_test1.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. myisam/mi_test1.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. myisam/myisamchk.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. myisam/myisampack.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. mysys/my_getopt.c: Changed exit code names and corresponding numbers. Added a flag for checking whether my_getopt should print the error message, or whether it should be printed by the client itself. sql/gen_lex_hash.cc: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. sql/mysqld.cc: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. Fixed a bug when compiling in non-debug mode, some replication related options were not enabled while they should be. This made 'make test' to fail in rpl000010 when --with-debug was not used. tools/mysqlmanager.c: Added useful exit error code for programs using my_getopt in case of an error in option handling. This can sometimes be useful in scripts. --- client/mysqladmin.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'client/mysqladmin.c') diff --git a/client/mysqladmin.c b/client/mysqladmin.c index 6fa8e8220f4..54103c010b3 100644 --- a/client/mysqladmin.c +++ b/client/mysqladmin.c @@ -23,7 +23,7 @@ #include /* because of signal() */ #endif -#define ADMIN_VERSION "8.34" +#define ADMIN_VERSION "8.35" #define MAX_MYSQL_VAR 64 #define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */ #define MAX_TRUNC_LENGTH 3 @@ -247,11 +247,8 @@ int main(int argc,char *argv[]) free_defaults() */ if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) - { - printf("%s: handle_options() failed with error %d\n", my_progname, - ho_error); - exit(1); - } + exit(ho_error); + if (argc == 0) { usage(); -- cgit v1.2.1 From aeac3b3e976e0f74e35ac4ed86b96ef2f52f710e Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 1 Jun 2002 11:46:06 +0300 Subject: Fixed some spelling errors. --- client/mysqladmin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'client/mysqladmin.c') diff --git a/client/mysqladmin.c b/client/mysqladmin.c index 54103c010b3..fd2a17eee31 100644 --- a/client/mysqladmin.c +++ b/client/mysqladmin.c @@ -130,7 +130,7 @@ static struct my_option my_long_options[] = (gptr*) &opt_relative, (gptr*) &opt_relative, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"set-variable", 'O', - "Change the value of a variable. Please note that this option is depricated; you can set variables directly with --variable-name=value.", + "Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"silent", 's', "Silently exit if one can't connect to server", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -- cgit v1.2.1