Skip to content

Commit

Permalink
Windows, mysqltest : cleanup, remove dead code USE_CYGWIN
Browse files Browse the repository at this point in the history
  • Loading branch information
vaintroub committed Sep 24, 2021
1 parent ca7046d commit 8221708
Showing 1 changed file with 0 additions and 54 deletions.
54 changes: 0 additions & 54 deletions client/mysqltest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ static my_bool non_blocking_api_enabled= 0;
#include "../tests/nonblock-wrappers.h"
#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_COLUMNS 256
Expand Down Expand Up @@ -618,11 +614,6 @@ void fix_win_paths(char *val, size_t len);
const char *get_errname_from_code (uint error_code);
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 */
static char *replace_column[MAX_COLUMNS];
Expand Down Expand Up @@ -1471,10 +1462,6 @@ void free_used_memory()
free_root(&require_file_root, MYF(0));
free_re();
my_free(read_command_buf);
#ifdef _WIN32
free_tmp_sh_file();
free_win_path_patterns();
#endif
DBUG_VOID_RETURN;
}

Expand Down Expand Up @@ -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)
{
#ifdef _WIN32
Expand Down Expand Up @@ -3346,14 +3306,12 @@ void do_exec(struct st_command *command)
}

#ifdef _WIN32
#ifndef USE_CYGWIN
/* Replace /dev/null with NUL */
while(replace(&ds_cmd, "/dev/null", 9, "NUL", 3) == 0)
;
/* Replace "closed stdout" with non existing output fd */
while(replace(&ds_cmd, ">&-", 3, ">&4", 3) == 0)
;
#endif
#endif

if (disable_result_log)
Expand Down Expand Up @@ -3512,13 +3470,7 @@ int do_modify_var(struct st_command *command,

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);
#endif
}


Expand Down Expand Up @@ -3552,12 +3504,10 @@ void do_system(struct st_command *command)
do_eval(&ds_cmd, command->first_argument, command->end, !is_windows);

#ifdef _WIN32
#ifndef USE_CYGWIN
/* Replace /dev/null with NUL */
while(replace(&ds_cmd, "/dev/null", 9, "NUL", 3) == 0)
;
#endif
#endif


DBUG_PRINT("info", ("running system command '%s' as '%s'",
Expand Down Expand Up @@ -9221,12 +9171,8 @@ int main(int argc, char **argv)

init_builtin_echo();
#ifdef _WIN32
#ifndef USE_CYGWIN
is_windows= 1;
#endif
init_tmp_sh_file();
init_win_path_patterns();
#endif

read_command_buf= (char*)my_malloc(read_command_buflen= 65536, MYF(MY_FAE));

Expand Down

0 comments on commit 8221708

Please sign in to comment.