|
23 | 23 | #include <stdio.h>
|
24 | 24 | #include <string.h>
|
25 | 25 |
|
| 26 | +#ifdef _WIN32 |
| 27 | +#define popen _popen |
| 28 | +#define pclose _pclose |
| 29 | +#endif |
26 | 30 |
|
27 | 31 | #define SHOW_VERSION "1.0.0"
|
28 | 32 | #define PRINT_VERSION do { printf("%s Ver %s Distrib %s\n", \
|
@@ -187,7 +191,7 @@ static char *get_value(char *line, const char *item)
|
187 | 191 | int item_len= (int)strlen(item);
|
188 | 192 | int line_len = (int)strlen(line);
|
189 | 193 |
|
190 |
| - if ((strncasecmp(line, item, item_len) == 0)) |
| 194 | + if ((native_strncasecmp(line, item, item_len) == 0)) |
191 | 195 | {
|
192 | 196 | int start= 0;
|
193 | 197 | char *s= 0;
|
@@ -290,11 +294,11 @@ static char *add_quotes(const char *path)
|
290 | 294 | char windows_cmd_friendly[FN_REFLEN];
|
291 | 295 |
|
292 | 296 | if (has_spaces(path))
|
293 |
| - snprintf(windows_cmd_friendly, sizeof(windows_cmd_friendly), |
294 |
| - "\"%s\"", path); |
| 297 | + my_snprintf(windows_cmd_friendly, sizeof(windows_cmd_friendly), |
| 298 | + "\"%s\"", path); |
295 | 299 | else
|
296 |
| - snprintf(windows_cmd_friendly, sizeof(windows_cmd_friendly), |
297 |
| - "%s", path); |
| 300 | + my_snprintf(windows_cmd_friendly, sizeof(windows_cmd_friendly), |
| 301 | + "%s", path); |
298 | 302 | return my_strdup(PSI_NOT_INSTRUMENTED,
|
299 | 303 | windows_cmd_friendly, MYF(MY_FAE));
|
300 | 304 | }
|
@@ -343,16 +347,16 @@ static int get_default_values()
|
343 | 347 | else
|
344 | 348 | format_str = "%s mysqld > %s";
|
345 | 349 |
|
346 |
| - snprintf(defaults_cmd, sizeof(defaults_cmd), format_str, |
347 |
| - add_quotes(tool_path), add_quotes(defaults_file)); |
| 350 | + my_snprintf(defaults_cmd, sizeof(defaults_cmd), format_str, |
| 351 | + add_quotes(tool_path), add_quotes(defaults_file)); |
348 | 352 | if (opt_verbose)
|
349 | 353 | {
|
350 | 354 | printf("# my_print_defaults found: %s\n", tool_path);
|
351 | 355 | }
|
352 | 356 | }
|
353 | 357 | #else
|
354 |
| - snprintf(defaults_cmd, sizeof(defaults_cmd), |
355 |
| - "%s mysqld > %s", tool_path, defaults_file); |
| 358 | + my_snprintf(defaults_cmd, sizeof(defaults_cmd), |
| 359 | + "%s mysqld > %s", tool_path, defaults_file); |
356 | 360 | #endif
|
357 | 361 |
|
358 | 362 | /* Execute the command */
|
@@ -780,29 +784,29 @@ static int check_options(int argc, char **argv, char *operation)
|
780 | 784 | {
|
781 | 785 | continue;
|
782 | 786 | }
|
783 |
| - if ((strcasecmp(argv[i], "ENABLE") == 0) || |
784 |
| - (strcasecmp(argv[i], "DISABLE") == 0)) |
| 787 | + if ((native_strcasecmp(argv[i], "ENABLE") == 0) || |
| 788 | + (native_strcasecmp(argv[i], "DISABLE") == 0)) |
785 | 789 | {
|
786 | 790 | strcpy(operation, argv[i]);
|
787 | 791 | num_found++;
|
788 | 792 | }
|
789 |
| - else if ((strncasecmp(argv[i], basedir_prefix, basedir_len) == 0) && |
| 793 | + else if ((native_strncasecmp(argv[i], basedir_prefix, basedir_len) == 0) && |
790 | 794 | !opt_basedir)
|
791 | 795 | {
|
792 | 796 | opt_basedir= my_strndup(PSI_NOT_INSTRUMENTED,
|
793 | 797 | argv[i]+basedir_len,
|
794 | 798 | strlen(argv[i])-basedir_len, MYF(MY_FAE));
|
795 | 799 | num_found++;
|
796 | 800 | }
|
797 |
| - else if ((strncasecmp(argv[i], datadir_prefix, datadir_len) == 0) && |
| 801 | + else if ((native_strncasecmp(argv[i], datadir_prefix, datadir_len) == 0) && |
798 | 802 | !opt_datadir)
|
799 | 803 | {
|
800 | 804 | opt_datadir= my_strndup(PSI_NOT_INSTRUMENTED,
|
801 | 805 | argv[i]+datadir_len,
|
802 | 806 | strlen(argv[i])-datadir_len, MYF(MY_FAE));
|
803 | 807 | num_found++;
|
804 | 808 | }
|
805 |
| - else if ((strncasecmp(argv[i], plugin_dir_prefix, plugin_dir_len) == 0) && |
| 809 | + else if ((native_strncasecmp(argv[i], plugin_dir_prefix, plugin_dir_len) == 0) && |
806 | 810 | !opt_plugin_dir)
|
807 | 811 | {
|
808 | 812 | opt_plugin_dir= my_strndup(PSI_NOT_INSTRUMENTED,
|
@@ -843,7 +847,7 @@ static int check_options(int argc, char **argv, char *operation)
|
843 | 847 | {
|
844 | 848 | return 1;
|
845 | 849 | }
|
846 |
| - if (strcasecmp(plugin_data.name, plugin_name) != 0) |
| 850 | + if (native_strcasecmp(plugin_data.name, plugin_name) != 0) |
847 | 851 | {
|
848 | 852 | fprintf(stderr, "ERROR: plugin name requested does not match config "
|
849 | 853 | "file data.\n");
|
@@ -1117,7 +1121,7 @@ static int build_bootstrap_file(char *operation, char *bootstrap)
|
1117 | 1121 | error= 1;
|
1118 | 1122 | goto exit;
|
1119 | 1123 | }
|
1120 |
| - if (strcasecmp(operation, "enable") == 0) |
| 1124 | + if (native_strcasecmp(operation, "enable") == 0) |
1121 | 1125 | {
|
1122 | 1126 | int i= 0;
|
1123 | 1127 | fprintf(file, "REPLACE INTO mysql.plugin VALUES ");
|
@@ -1239,14 +1243,14 @@ static int bootstrap_server(char *server_path, char *bootstrap_file)
|
1239 | 1243 | else
|
1240 | 1244 | format_str= "%s %s --bootstrap --datadir=%s --basedir=%s < %s";
|
1241 | 1245 |
|
1242 |
| - snprintf(bootstrap_cmd, sizeof(bootstrap_cmd), format_str, |
1243 |
| - add_quotes(convert_path(server_path)), verbose_str, |
1244 |
| - add_quotes(opt_datadir), add_quotes(opt_basedir), |
1245 |
| - add_quotes(bootstrap_file)); |
| 1246 | + my_snprintf(bootstrap_cmd, sizeof(bootstrap_cmd), format_str, |
| 1247 | + add_quotes(convert_path(server_path)), verbose_str, |
| 1248 | + add_quotes(opt_datadir), add_quotes(opt_basedir), |
| 1249 | + add_quotes(bootstrap_file)); |
1246 | 1250 | #else
|
1247 |
| - snprintf(bootstrap_cmd, sizeof(bootstrap_cmd), |
1248 |
| - "%s --no-defaults --bootstrap --datadir=%s --basedir=%s" |
1249 |
| - " < %s", server_path, opt_datadir, opt_basedir, bootstrap_file); |
| 1251 | + my_snprintf(bootstrap_cmd, sizeof(bootstrap_cmd), |
| 1252 | + "%s --no-defaults --bootstrap --datadir=%s --basedir=%s" |
| 1253 | + " < %s", server_path, opt_datadir, opt_basedir, bootstrap_file); |
1250 | 1254 | #endif
|
1251 | 1255 |
|
1252 | 1256 | /* Execute the command */
|
|
0 commit comments