Added netsim output

This commit is contained in:
adamdunkels 2008-03-03 16:10:09 +00:00
parent c4250420ce
commit 7d06f1bfe0

View File

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: shell-sendtest.c,v 1.1 2008/02/04 23:42:17 adamdunkels Exp $ * $Id: shell-sendtest.c,v 1.2 2008/03/03 16:10:09 adamdunkels Exp $
*/ */
/** /**
@ -45,6 +45,13 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#if NETSIM
#include "ether.h"
#endif /* NETSIM */
#ifndef HAVE_SNPRINTF
int snprintf(char *str, size_t size, const char *format, ...);
#endif /* HAVE_SNPRINTF */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
PROCESS(shell_sendtest_process, "sendtest"); PROCESS(shell_sendtest_process, "sendtest");
SHELL_COMMAND(sendtest_command, SHELL_COMMAND(sendtest_command,
@ -63,7 +70,7 @@ write_chunk(struct rucb_conn *c, int offset, int flag,
{ {
char buf[100]; char buf[100];
printf("received %d; %d\n", offset, datalen); printf("received %d; %d\n", offset, datalen);
sprintf(buf, "%d%%", (100 * (offset + datalen)) / filesize); sprintf(buf, "%lu%%", (100 * (offset + datalen)) / filesize);
ether_set_text(buf); ether_set_text(buf);
} }
#endif /* NETSIM */ #endif /* NETSIM */