summaryrefslogtreecommitdiff
path: root/client/mysqltest.cc
diff options
context:
space:
mode:
authorBjorn Munch <Bjorn.Munch@sun.com>2009-09-02 18:58:17 +0200
committerBjorn Munch <Bjorn.Munch@sun.com>2009-09-02 18:58:17 +0200
commit588e9930b4067bd712ca30c063ccb09dbcfc6c40 (patch)
tree5558803a46329d136748a32e38c66c6ff19b5b09 /client/mysqltest.cc
parentd65168fddab05ed08d95eb5fead7cb1aad38edd5 (diff)
parentc4fa4f31ae7389a51d33e871951a236e57f1e19c (diff)
downloadmariadb-git-588e9930b4067bd712ca30c063ccb09dbcfc6c40.tar.gz
first merge from main
Diffstat (limited to 'client/mysqltest.cc')
-rw-r--r--client/mysqltest.cc38
1 files changed, 21 insertions, 17 deletions
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index 7965dafb863..5eb79aecc23 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -1463,34 +1463,38 @@ static int run_tool(const char *tool_path, DYNAMIC_STRING *ds_res, ...)
Test if diff is present. This is needed on Windows systems
as the OS returns 1 whether diff is successful or if it is
not present.
- Takes name of diff program as argument
-
+
We run diff -v and look for output in stdout.
We don't redirect stderr to stdout to make for a simplified check
Windows will output '"diff"' is not recognized... to stderr if it is
not present.
*/
-int diff_check (const char *diff_name)
+#ifdef __WIN__
+
+static int diff_check(const char *diff_name)
{
- char buf[512]= {0};
- FILE *res_file;
- char cmd[128];
- my_snprintf (cmd, sizeof(cmd), "%s -v", diff_name);
- int have_diff = 0;
+ FILE *res_file;
+ char buf[128];
+ int have_diff= 0;
- if (!(res_file= popen(cmd, "r")))
- die("popen(\"%s\", \"r\") failed", cmd);
+ my_snprintf(buf, sizeof(buf), "%s -v", diff_name);
- /* if diff is not present, nothing will be in stdout to increment have_diff */
- if (fgets(buf, sizeof(buf), res_file))
- {
- have_diff += 1;
- }
- pclose(res_file);
- return have_diff;
+ if (!(res_file= popen(buf, "r")))
+ die("popen(\"%s\", \"r\") failed", buf);
+
+ /* if diff is not present, nothing will be in stdout to increment have_diff */
+ if (fgets(buf, sizeof(buf), res_file))
+ have_diff= 1;
+
+ pclose(res_file);
+
+ return have_diff;
}
+#endif
+
+
/*
Show the diff of two files using the systems builtin diff
command. If no such diff command exist, just dump the content