From 6794154aa5cdba600726b1c4c032e972b42c0649 Mon Sep 17 00:00:00 2001 From: adamdunkels Date: Mon, 13 Sep 2010 19:15:21 +0000 Subject: [PATCH] Set a default value for 'send' commands without arguments --- apps/shell/shell-rime.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/apps/shell/shell-rime.c b/apps/shell/shell-rime.c index c0f3ff396..0fa37cbaf 100644 --- a/apps/shell/shell-rime.c +++ b/apps/shell/shell-rime.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: shell-rime.c,v 1.22 2010/09/13 13:29:29 adamdunkels Exp $ + * $Id: shell-rime.c,v 1.23 2010/09/13 19:15:21 adamdunkels Exp $ */ /** @@ -64,6 +64,8 @@ int snprintf(char *str, size_t size, const char *format, ...); #include +#define DEFAULT_COLLECT_REXMITS 4 + #define COLLECT_MSG_HDRSIZE 4 struct collect_msg { @@ -250,11 +252,18 @@ PROCESS_THREAD(shell_send_process, ev, data) int len; struct collect_msg *msg; static int num_rexmits; + char *next; PROCESS_BEGIN(); - num_rexmits = shell_strtolong((char *)data, NULL); - + num_rexmits = shell_strtolong((char *)data, &next); + + if(next == data) { + /* If no argument was given, we send packets with a default number + of retransmissions. */ + num_rexmits = DEFAULT_COLLECT_REXMITS; + } + while(1) { PROCESS_WAIT_EVENT_UNTIL(ev == shell_event_input); input = data;