diff options
| author | Alexander Gavrilov | 2012-03-15 11:07:43 +0400 |
|---|---|---|
| committer | Alexander Gavrilov | 2012-03-15 11:07:43 +0400 |
| commit | e7851f5abdd1a84d29020f2789efc0f932284bf0 (patch) | |
| tree | d5912bf9ba41cb9fcc018540f4cad1972fb3a975 /library/dfhack-run.cpp | |
| parent | 560e977f0589ac1c0feb6ea825d20d351e325826 (diff) | |
| download | dfhack-e7851f5abdd1a84d29020f2789efc0f932284bf0.tar.gz dfhack-e7851f5abdd1a84d29020f2789efc0f932284bf0.tar.bz2 dfhack-e7851f5abdd1a84d29020f2789efc0f932284bf0.tar.xz | |
Improve support for void RPC functions, dfhack-run, etc.
Diffstat (limited to 'library/dfhack-run.cpp')
| -rw-r--r-- | library/dfhack-run.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/library/dfhack-run.cpp b/library/dfhack-run.cpp index 941ce8d0..eab03901 100644 --- a/library/dfhack-run.cpp +++ b/library/dfhack-run.cpp @@ -71,19 +71,19 @@ int main (int argc, char *argv[]) if (!client.connect()) return 2; - // Bind to RunCommand - RemoteFunction<CoreRunCommandRequest,CoreVoidReply> command; + // Call the command + std::vector<std::string> args; + for (int i = 2; i < argc; i++) + args.push_back(argv[i]); - if (!command.bind(out, &client, "RunCommand")) - return 2; + command_result rv = client.run_command(out, argv[1], args); - // Execute it - command.in()->set_command(argv[1]); - for (int i = 2; i < argc; i++) - command.in()->add_arguments(argv[i]); + if (rv != CR_OK) { + if (rv == CR_NOT_IMPLEMENTED) + out.printerr("%s is not a recognized command.\n", argv[1]); - if (command.execute(out) != CR_OK) return 1; + } out.flush(); return 0; |
