Windows, mysqltest : cleanup, remove dead code USE_CYGWIN
This commit is contained in:
parent
ca7046dc19
commit
8221708e38
@ -71,10 +71,6 @@ static my_bool non_blocking_api_enabled= 0;
|
|||||||
#include "../tests/nonblock-wrappers.h"
|
#include "../tests/nonblock-wrappers.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Use cygwin for --exec and --system before 5.0 */
|
|
||||||
#if MYSQL_VERSION_ID < 50000
|
|
||||||
#define USE_CYGWIN
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define MAX_VAR_NAME_LENGTH 256
|
#define MAX_VAR_NAME_LENGTH 256
|
||||||
#define MAX_COLUMNS 256
|
#define MAX_COLUMNS 256
|
||||||
@ -618,11 +614,6 @@ void fix_win_paths(char *val, size_t len);
|
|||||||
const char *get_errname_from_code (uint error_code);
|
const char *get_errname_from_code (uint error_code);
|
||||||
int multi_reg_replace(struct st_replace_regex* r,char* val);
|
int multi_reg_replace(struct st_replace_regex* r,char* val);
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
void free_tmp_sh_file();
|
|
||||||
void free_win_path_patterns();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* For replace_column */
|
/* For replace_column */
|
||||||
static char *replace_column[MAX_COLUMNS];
|
static char *replace_column[MAX_COLUMNS];
|
||||||
@ -1471,10 +1462,6 @@ void free_used_memory()
|
|||||||
free_root(&require_file_root, MYF(0));
|
free_root(&require_file_root, MYF(0));
|
||||||
free_re();
|
free_re();
|
||||||
my_free(read_command_buf);
|
my_free(read_command_buf);
|
||||||
#ifdef _WIN32
|
|
||||||
free_tmp_sh_file();
|
|
||||||
free_win_path_patterns();
|
|
||||||
#endif
|
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3204,33 +3191,6 @@ void do_source(struct st_command *command)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if defined _WIN32
|
|
||||||
|
|
||||||
#ifdef USE_CYGWIN
|
|
||||||
/* Variables used for temporary sh files used for emulating Unix on Windows */
|
|
||||||
char tmp_sh_name[64], tmp_sh_cmd[70];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void init_tmp_sh_file()
|
|
||||||
{
|
|
||||||
#ifdef USE_CYGWIN
|
|
||||||
/* Format a name for the tmp sh file that is unique for this process */
|
|
||||||
my_snprintf(tmp_sh_name, sizeof(tmp_sh_name), "tmp_%d.sh", getpid());
|
|
||||||
/* Format the command to execute in order to run the script */
|
|
||||||
my_snprintf(tmp_sh_cmd, sizeof(tmp_sh_cmd), "sh %s", tmp_sh_name);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void free_tmp_sh_file()
|
|
||||||
{
|
|
||||||
#ifdef USE_CYGWIN
|
|
||||||
my_delete(tmp_sh_name, MYF(0));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
static void init_builtin_echo(void)
|
static void init_builtin_echo(void)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@ -3346,14 +3306,12 @@ void do_exec(struct st_command *command)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#ifndef USE_CYGWIN
|
|
||||||
/* Replace /dev/null with NUL */
|
/* Replace /dev/null with NUL */
|
||||||
while(replace(&ds_cmd, "/dev/null", 9, "NUL", 3) == 0)
|
while(replace(&ds_cmd, "/dev/null", 9, "NUL", 3) == 0)
|
||||||
;
|
;
|
||||||
/* Replace "closed stdout" with non existing output fd */
|
/* Replace "closed stdout" with non existing output fd */
|
||||||
while(replace(&ds_cmd, ">&-", 3, ">&4", 3) == 0)
|
while(replace(&ds_cmd, ">&-", 3, ">&4", 3) == 0)
|
||||||
;
|
;
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (disable_result_log)
|
if (disable_result_log)
|
||||||
@ -3512,13 +3470,7 @@ int do_modify_var(struct st_command *command,
|
|||||||
|
|
||||||
int my_system(DYNAMIC_STRING* ds_cmd)
|
int my_system(DYNAMIC_STRING* ds_cmd)
|
||||||
{
|
{
|
||||||
#if defined _WIN32 && defined USE_CYGWIN
|
|
||||||
/* Dump the command into a sh script file and execute with system */
|
|
||||||
str_to_file(tmp_sh_name, ds_cmd->str, ds_cmd->length);
|
|
||||||
return system(tmp_sh_cmd);
|
|
||||||
#else
|
|
||||||
return system(ds_cmd->str);
|
return system(ds_cmd->str);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3552,12 +3504,10 @@ void do_system(struct st_command *command)
|
|||||||
do_eval(&ds_cmd, command->first_argument, command->end, !is_windows);
|
do_eval(&ds_cmd, command->first_argument, command->end, !is_windows);
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#ifndef USE_CYGWIN
|
|
||||||
/* Replace /dev/null with NUL */
|
/* Replace /dev/null with NUL */
|
||||||
while(replace(&ds_cmd, "/dev/null", 9, "NUL", 3) == 0)
|
while(replace(&ds_cmd, "/dev/null", 9, "NUL", 3) == 0)
|
||||||
;
|
;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
DBUG_PRINT("info", ("running system command '%s' as '%s'",
|
DBUG_PRINT("info", ("running system command '%s' as '%s'",
|
||||||
@ -9221,12 +9171,8 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
init_builtin_echo();
|
init_builtin_echo();
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#ifndef USE_CYGWIN
|
|
||||||
is_windows= 1;
|
is_windows= 1;
|
||||||
#endif
|
#endif
|
||||||
init_tmp_sh_file();
|
|
||||||
init_win_path_patterns();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
read_command_buf= (char*)my_malloc(read_command_buflen= 65536, MYF(MY_FAE));
|
read_command_buf= (char*)my_malloc(read_command_buflen= 65536, MYF(MY_FAE));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user