Commit debef2bf authored by David Anderson's avatar David Anderson

- boinccmd: make --get_messages output more readable

svn path=/trunk/boinc/; revision=17407
parent 35a09b01
......@@ -2328,3 +2328,9 @@ David 26 Feb 2009
graphics2_win.cpp
clientscr/
ss_app.cpp
David 26 Feb 2009
- boinccmd: make --get_messages output more readable
client/
boinc_cmd.cpp
......@@ -66,7 +66,7 @@ Commands:\n\
--get_project_status show status of all attached projects\n\
--get_disk_usage show disk usage\n\
--get_proxy_settings\n\
--get_messages seqno show messages > seqno\n\
--get_messages [ seqno ] show messages > seqno\n\
--get_host_info\n\
--version, -V show core client version\n\
--result url result_name op job operation\n\
......@@ -122,6 +122,15 @@ char* next_arg(int argc, char** argv, int& i) {
return argv[i++];
}
char* prio_name(int prio) {
switch (prio) {
case 1: return "low";
case 2: return "medium";
case 3: return "high";
}
return "unknown";
}
int main(int argc, char** argv) {
RPC_CLIENT rpc;
int i, retval, port=0;
......@@ -352,15 +361,24 @@ int main(int argc, char** argv) {
if (pi.socks_server_name.size()) pi.use_socks_proxy = true;
retval = rpc.set_proxy_settings(pi);
} else if (!strcmp(cmd, "--get_messages")) {
int seqno = atoi(next_arg(argc, argv, i));
int seqno;
if (i == argc) {
seqno = 0;
} else {
seqno = atoi(next_arg(argc, argv, i));
}
retval = rpc.get_messages(seqno, messages);
if (!retval) {
unsigned int j;
for (j=0; j<messages.messages.size(); j++) {
MESSAGE& md = *messages.messages[j];
printf("%s %d %d %s\n",
md.project.c_str(), md.priority,
md.timestamp, md.body.c_str()
strip_whitespace(md.body);
printf("%d: %s (%s) [%s] %s\n",
md.seqno,
time_to_string(md.timestamp),
prio_name(md.priority),
md.project.c_str(),
md.body.c_str()
);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment