From bca9a29eac01d29f6e4c04aeee0aac445d37e959 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 20 Nov 2006 21:03:40 +0100 Subject: Fix mysqltest to automatically replace \ with / also in $MYSQLTEST_VARDIR, for usage of vardir=e:/var on windows client/mysqltest.c: Add auto replace for $MYSQLTEST_VARDIR Only add strings with strlen > to patterns array - avoids lot of strlen calls --- client/mysqltest.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'client') diff --git a/client/mysqltest.c b/client/mysqltest.c index 9ad2f3df5de..ca36abb8f67 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -4138,8 +4138,9 @@ void init_win_path_patterns() /* List of string patterns to match in order to find paths */ const char* paths[] = { "$MYSQL_TEST_DIR", "$MYSQL_TMP_DIR", - "./test/", 0 }; - int num_paths= 3; + "$MYSQLTEST_VARDIR", + "./test/" }; + int num_paths= sizeof(paths)/sizeof(char*), int i; char* p; @@ -4159,6 +4160,13 @@ void init_win_path_patterns() else p= my_strdup(paths[i], MYF(MY_FAE)); + /* Don't insert zero length strings in patterns array */ + if (strlen(p) == 0) + { + my_free(p, MYF(0)); + continue; + } + if (insert_dynamic(&patterns, (gptr) &p)) die(NullS); @@ -4208,7 +4216,7 @@ void fix_win_paths(const char *val, int len) { const char** pattern= dynamic_element(&patterns, i, const char**); DBUG_PRINT("info", ("pattern: %s", *pattern)); - if (strlen(*pattern) == 0) continue; + /* Search for the path in string */ while ((p= strstr(val, *pattern))) { -- cgit v1.2.1 From 4cd2aa73dda449dfc972b95ab2418d30cb9f97eb Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 21 Nov 2006 00:46:13 +0100 Subject: Port mysql_upgrade to be tested on windows client/mysql_upgrade.c: Send error messages to stderr Add new define EXTRA_CLIENT_PATHS containing additional paths where to look for the client binaries --- client/mysql_upgrade.c | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) (limited to 'client') diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index 849cef2287c..37cbeb81e1d 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -31,10 +31,12 @@ const char *mysqlcheck_name= "mysqlcheck.exe"; const char *mysql_name= "mysql.exe"; const char *mysqld_name= "mysqld.exe"; +#define EXTRA_CLIENT_PATHS "client/release", "client/debug" #else const char *mysqlcheck_name= "mysqlcheck"; const char *mysql_name= "mysql"; const char *mysqld_name= "mysqld"; +#define EXTRA_CLIENT_PATHS "client" #endif /*__WIN__*/ extern TYPELIB sql_protocol_typelib; @@ -497,8 +499,9 @@ int main(int argc, char **argv) "mysql", NullS)) { ret= 1; - puts("Can't find data directory. Please restart with" - " --datadir=path-to-writable-data-dir"); + fprintf(stderr, + "Can't find data directory. Please restart with" + " --datadir=path-to-writable-data-dir"); goto error; } @@ -541,11 +544,13 @@ int main(int argc, char **argv) } if (find_file(mysqlcheck_name, basedir, MYF(0), path, sizeof(path), - "bin", "client", NullS)) + "bin", EXTRA_CLIENT_PATHS, NullS)) { ret= 1; - printf("Can't find program '%s'\n", mysqlcheck_name); - puts("Please restart with --basedir=mysql-install-directory"); + fprintf(stderr, + "Can't find program '%s'\n" + "Please restart with --basedir=mysql-install-directory", + mysqlcheck_name); goto error; } else @@ -567,7 +572,7 @@ int main(int argc, char **argv) ret= system(cmdline.str); if (ret) { - printf("Error executing '%s'\n", cmdline.str); + fprintf(stderr, "Error executing '%s'\n", cmdline.str); goto error; } @@ -578,12 +583,13 @@ int main(int argc, char **argv) fix_priv_tables: if (find_file(mysql_name, basedir, MYF(0), path, sizeof(path), - "bin", "client", NullS)) + "bin", EXTRA_CLIENT_PATHS, NullS)) { ret= 1; - puts("Could not find MySQL command-line client (mysql).\n" - "Please use --basedir to specify the directory" - " where MySQL is installed."); + fprintf(stderr, + "Could not find MySQL command-line client (mysql).\n" + "Please use --basedir to specify the directory" + " where MySQL is installed."); goto error; } else @@ -598,9 +604,10 @@ fix_priv_tables: "share/mysql", NullS)) { ret= 1; - puts("Could not find file " MYSQL_FIX_PRIV_TABLES_NAME "\n" - "Please use --basedir to specify the directory" - " where MySQL is installed"); + fprintf(stderr, + "Could not find file " MYSQL_FIX_PRIV_TABLES_NAME "\n" + "Please use --basedir to specify the directory" + " where MySQL is installed"); goto error; } else @@ -621,7 +628,7 @@ fix_priv_tables: ret= system(cmdline.str); if (ret) - printf("Error executing '%s'\n", cmdline.str); + fprintf(stderr, "Error executing '%s'\n", cmdline.str); error: dynstr_free(&cmdline); -- cgit v1.2.1 From fba971f585f22079dae2dbd3044047de8f122b36 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 21 Nov 2006 09:36:29 +0100 Subject: Add missing semicolon --- client/mysqltest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'client') diff --git a/client/mysqltest.c b/client/mysqltest.c index ca36abb8f67..241e0dc4738 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -4140,7 +4140,7 @@ void init_win_path_patterns() "$MYSQL_TMP_DIR", "$MYSQLTEST_VARDIR", "./test/" }; - int num_paths= sizeof(paths)/sizeof(char*), + int num_paths= sizeof(paths)/sizeof(char*); int i; char* p; -- cgit v1.2.1 From a599cea10a09a420b82f6877eb7ef5c5732b157e Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 21 Nov 2006 16:34:10 +0100 Subject: Remove unused variable --- client/mysqltest.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'client') diff --git a/client/mysqltest.c b/client/mysqltest.c index 9ad2f3df5de..d233497a960 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -6448,7 +6448,7 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern, { my_regex_t r; my_regmatch_t *subs; - char *buf_end, *replace_end; + char *replace_end; char *buf= *buf_p; int len; int buf_len, need_buf_len; @@ -6468,8 +6468,6 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern, SECURE_REG_BUF - buf_end= buf + buf_len; - if (icase) cflags|= REG_ICASE; -- cgit v1.2.1