diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/messageparser.cc | 13 | ||||
-rw-r--r-- | src/muniacli.cc | 13 |
2 files changed, 14 insertions, 12 deletions
diff --git a/src/messageparser.cc b/src/messageparser.cc index 5714c88..8f4cc16 100644 --- a/src/messageparser.cc +++ b/src/messageparser.cc @@ -69,9 +69,7 @@ inline static void parse_into_msg_tokens(std::string& data, token += ch; } else { - if(!token.empty()) { - tokenVector.push_back(token); - } + tokenVector.push_back(token); msgTokensList.push_back(tokenVector); tokenVector.clear(); token.clear(); @@ -84,10 +82,10 @@ inline static void parse_into_msg_tokens(std::string& data, prev_ch = ch; } - if(!token.empty()) { +// if(!token.empty()) { tokenVector.push_back(token); token.clear(); - } +// } if(!tokenVector.empty()) { msgTokensList.push_back(tokenVector); @@ -112,7 +110,7 @@ inline static void create_msg_list(MsgTokensList& msgTokensList, message_t m; -// printf("t[%d] : %s, running in clientmode: %d\n", origin, t[origin].c_str(), clientmode); + printf("t[%d] : %s, running in clientmode: %d\n", origin, t[origin].c_str(), clientmode); // printf("%d\n", t.size()); @@ -195,7 +193,7 @@ inline static void create_msg_list(MsgTokensList& msgTokensList, } MessageList parse_msg(std::string data) { -// printf("Parsing: %s\n", data.c_str()); + printf("Parsing: %s\n", data.c_str()); MsgTokensList msgTokensList; parse_into_msg_tokens(data, msgTokensList); @@ -207,6 +205,7 @@ MessageList parse_msg(std::string data) { } MessageList parse_msg_client(std::string data) { + printf("Parsing: \n%s\n", data.c_str()); MsgTokensList msgTokensList; parse_into_msg_tokens(data, msgTokensList); 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; |