From a6b100c6f62b8b37a499da96150973db969b03ca Mon Sep 17 00:00:00 2001 From: Jonas Suhr Christensen Date: Fri, 15 Jun 2012 14:25:45 +0200 Subject: Perhaps fix of tokenizer and whitespaces. --- src/muniacli.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/muniacli.cc') 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 childlist = structuremap[node]; + childlist.unique(); if(!childlist.empty()) { for(std::list::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; -- cgit v1.2.3