summaryrefslogtreecommitdiff
path: root/i/marvin/src
diff options
context:
space:
mode:
Diffstat (limited to 'i/marvin/src')
-rw-r--r--i/marvin/src/proto/test_proto.cc10
1 files changed, 6 insertions, 4 deletions
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;
}
};