git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3635 35acf78f-673a-0410-8e92-d51de3d6d3f4

This commit is contained in:
gdisirio 2011-12-18 08:27:30 +00:00
parent d1f54cbe5a
commit 39f9216bbc
1 changed files with 3 additions and 9 deletions

View File

@ -26,7 +26,6 @@
* @{ * @{
*/ */
#include <stdio.h>
#include <string.h> #include <string.h>
#include "ch.h" #include "ch.h"
@ -39,11 +38,7 @@
*/ */
EventSource shell_terminated; EventSource shell_terminated;
#if defined(WIN32) static char *_strtok(char *str, const char *delim, char **saveptr) {
/*
* MinGW does not seem to have this function...
*/
static char *strtok_r(char *str, const char *delim, char **saveptr) {
char *token; char *token;
if (str) if (str)
*saveptr = str; *saveptr = str;
@ -59,7 +54,6 @@ static char *strtok_r(char *str, const char *delim, char **saveptr) {
return *token ? token : NULL; return *token ? token : NULL;
} }
#endif
static void usage(BaseChannel *chp, char *p) { static void usage(BaseChannel *chp, char *p) {
@ -162,10 +156,10 @@ static msg_t shell_thread(void *p) {
chprintf(chp, "\r\nlogout"); chprintf(chp, "\r\nlogout");
break; break;
} }
lp = strtok_r(line, " \009", &tokp); lp = _strtok(line, " \009", &tokp);
cmd = lp; cmd = lp;
n = 0; n = 0;
while ((lp = strtok_r(NULL, " \009", &tokp)) != NULL) { while ((lp = _strtok(NULL, " \009", &tokp)) != NULL) {
if (n >= SHELL_MAX_ARGUMENTS) { if (n >= SHELL_MAX_ARGUMENTS) {
chprintf(chp, "too many arguments\r\n"); chprintf(chp, "too many arguments\r\n");
cmd = NULL; cmd = NULL;