From b03ba3b9588962971a15b38b4c9cbaef864decfa Mon Sep 17 00:00:00 2001 From: haller Date: Sat, 20 May 2006 18:18:48 +0000 Subject: * test_proto qui marche comme une version beta --- i/marvin/src/proto/test_proto.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'i/marvin') diff --git a/i/marvin/src/proto/test_proto.cc b/i/marvin/src/proto/test_proto.cc index 08b3b42..a9f1fa8 100644 --- a/i/marvin/src/proto/test_proto.cc +++ b/i/marvin/src/proto/test_proto.cc @@ -57,8 +57,11 @@ class TestProto : public Tester, Proto::Receiver } void send (std::string str) { + // command avr char command = str[0]; + // format des arguments char *format; + // arguments envoyé à la fonctions Proto::send int arg[6]; int nbArg = 0; char *temp; @@ -68,20 +71,19 @@ class TestProto : public Tester, Proto::Receiver strtok(string, " "); // On récupère le format format = strtok(0, " "); - if(!format) - throw std::runtime_error("La commande n'a pas de format"); // On récupère les arguments for(; nbArg < 6; nbArg++) { - if((temp = strtok(0, " "))) + if(!(temp = strtok(0, " "))) break; else arg[nbArg] = atoi(temp); } for(;nbArg < 6; nbArg++) arg[nbArg] = 0; - proto_.send(command, format, arg[0], arg[1], arg[2], arg[3], arg[4], + proto_.send(command, !format?"":format, arg[0], arg[1], arg[2], arg[3], arg[4], arg[5]); + delete [] string; } }; -- cgit v1.2.3