summaryrefslogtreecommitdiff
path: root/src/muniacli.cc
diff options
context:
space:
mode:
authorJonas Suhr Christensen <jsc@umbraculum.org>2012-06-15 14:25:45 +0200
committerJonas Suhr Christensen <jsc@umbraculum.org>2012-06-15 14:25:45 +0200
commita6b100c6f62b8b37a499da96150973db969b03ca (patch)
tree8e196eda807485680696c7e8a987a2e1d5742557 /src/muniacli.cc
parentedba01f5030a04ca6f56cb5865464c400ec7069d (diff)
Perhaps fix of tokenizer and whitespaces.
Diffstat (limited to 'src/muniacli.cc')
-rw-r--r--src/muniacli.cc13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/muniacli.cc b/src/muniacli.cc
index 11b4829..5c6b207 100644
--- a/src/muniacli.cc
+++ b/src/muniacli.cc
@@ -71,6 +71,7 @@ static void rec_pretty_print(int node) {
printf("%s%d - %s\n", indent.c_str(), node, titlemap[node].c_str());
std::list<int> childlist = structuremap[node];
+ childlist.unique();
if(!childlist.empty()) {
for(std::list<int>::iterator it = childlist.begin();
it != childlist.end(); it++) {
@@ -99,7 +100,9 @@ static void pretty_print(std::string msgs) {
case cmd::create:
// printf("Parent %d, id %d\n", msg.create.parentid, msg.create.id);
childlist = structuremap[msg.create.parentid];
- childlist.push_back(msg.create.id);
+// if(childlist.find(msg.create.id) == childlist.end()) {
+ childlist.push_back(msg.create.id);
+// }
structuremap[msg.create.parentid] = childlist;
// printf("Childlist size of %d = %d\n", msg.create.parentid, childlist.size());
break;
@@ -339,8 +342,8 @@ int main(int argc, char** argv)
switch(cmd) {
case CREATE:
- msgs = "create " + taskbyid + ";";
- msgs += "observe " + taskbyid + ";";
+ msgs = "observe " + taskbyid + ";";
+ msgs += "create " + taskbyid + ";";
break;
case LIST:
msgs = "observe " + taskbyid + ";"; //+
@@ -350,8 +353,8 @@ int main(int argc, char** argv)
msgs = "remove " + taskbyid + ";";
break;
case UPDATE:
- msgs = "update " + taskbyid + " \"" + cmd_opts + "\"; ";
- msgs += "observe " + taskbyid + ";";
+ msgs = "observe " + taskbyid + ";";
+ msgs += "update " + taskbyid + " \"" + cmd_opts + "\"; ";
break;
case DEFAULT:
break;