Set a default value for 'send' commands without arguments

This commit is contained in:
adamdunkels 2010-09-13 19:15:21 +00:00
parent 3bca8cfe3d
commit 6794154aa5

View file

@ -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 <string.h>
#define DEFAULT_COLLECT_REXMITS 4
#define COLLECT_MSG_HDRSIZE 4
struct collect_msg {
@ -250,10 +252,17 @@ 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);