summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosé Fonseca <jose.r.fonseca@gmail.com>2011-11-29 11:01:05 +0000
committerJosé Fonseca <jose.r.fonseca@gmail.com>2011-11-29 11:01:05 +0000
commitfc73ca1d4a8f177ccd84aa0c9a841c9e86c81fdc (patch)
treefa39ea78794bf4d3eef77ca5d80305a088a35a86
parent5c8e4325f0d02339d322939ea2cf78e8f13620c5 (diff)
Support 'apitrace diff-images' on Windows.
-rw-r--r--cli/cli_diff_images.cpp37
-rw-r--r--common/trace_resource.cpp2
2 files changed, 17 insertions, 22 deletions
diff --git a/cli/cli_diff_images.cpp b/cli/cli_diff_images.cpp
index 3b5507a..42aaaff 100644
--- a/cli/cli_diff_images.cpp
+++ b/cli/cli_diff_images.cpp
@@ -30,6 +30,7 @@
#include "cli.hpp"
#include "os_string.hpp"
+#include "os_process.hpp"
#include "trace_resource.hpp"
static const char *synopsis = "Identify differences between two image dumps.";
@@ -43,48 +44,42 @@ find_command(void)
static void
usage(void)
{
- char *args[3];
-
os::String command = find_command();
+ if (!command.length()) {
+ exit(1);
+ }
+ char *args[3];
args[0] = (char *) command.str();
args[1] = (char *) "--help";
args[2] = NULL;
-#ifdef _WIN32
- std::cerr << "The 'apitrace diff-images' command is not yet supported on this O/S.\n";
-#else
- execv(command.str(), args);
-#endif
-
- std::cerr << "Error: Failed to execute " << args[0] << "\n";
+ os::execute(args);
}
static int
command(int argc, char *argv[])
{
int i;
- char **args = new char* [argc+2];
+ int ret;
os::String command = find_command();
+ if (!command.length()) {
+ return 1;
+ }
+ char **args = new char* [argc + 2];
args[0] = (char *) command.str();
-
for (i = 0; i < argc; i++) {
- args[i+1] = argv[i];
+ args[i + 1] = argv[i];
}
+ args[i + 1] = NULL;
- args[i+1] = NULL;
-
-#ifdef _WIN32
- std::cerr << "The 'apitrace diff-images' command is not yet supported on this O/S.\n";
-#else
- execv(command.str(), args);
-#endif
+ ret = os::execute(args);
- std::cerr << "Error: Failed to execute " << args[0] << "\n";
+ delete [] args;
- return 1;
+ return ret;
}
const Command diff_images_command = {
diff --git a/common/trace_resource.cpp b/common/trace_resource.cpp
index 659fc05..85c8bee 100644
--- a/common/trace_resource.cpp
+++ b/common/trace_resource.cpp
@@ -105,7 +105,7 @@ findScript(const char *name)
}
#endif
- std::cerr << "error: cannot find " << name << "script\n";
+ std::cerr << "error: cannot find " << name << " script\n";
return "";
}