summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authoruser <user@lubuntu.(none)>2013-04-04 14:12:35 -0400
committeruser <user@lubuntu.(none)>2013-04-04 14:12:35 -0400
commit06c6630bbfbf7a0b82ebf22d63bc2fc9aca3bdb9 (patch)
tree7ec482d541d79d9a7a2e0c01fccb7d26f59af8d4 /components
parent009eccf640a96762b6d8610c0f63497a9bf90c33 (diff)
fix compiling warning in finsh shell
Diffstat (limited to 'components')
-rw-r--r--components/finsh/finsh.h3
-rw-r--r--components/finsh/finsh_token.c9
-rw-r--r--components/finsh/shell.c31
-rw-r--r--components/libc/newlib/libc.c7
4 files changed, 13 insertions, 37 deletions
diff --git a/components/finsh/finsh.h b/components/finsh/finsh.h
index 85e32b9fb8..adb2f09625 100644
--- a/components/finsh/finsh.h
+++ b/components/finsh/finsh.h
@@ -86,9 +86,6 @@ typedef unsigned int size_t;
int strcmp (const char *s1, const char *s2);
char *strdup(const char *s);
-
-int isalpha( int ch );
-int atoi(const char* s);
#else
/* use libc of armcc */
#include <ctype.h>
diff --git a/components/finsh/finsh_token.c b/components/finsh/finsh_token.c
index d4b1b70d79..2486988a47 100644
--- a/components/finsh/finsh_token.c
+++ b/components/finsh/finsh_token.c
@@ -28,10 +28,12 @@
* 2013-04-03 Bernard strip more characters.
*/
#include <finsh.h>
+#include <stdlib.h>
#include "finsh_token.h"
#include "finsh_error.h"
+#define is_alpha(ch) ((ch | 0x20) - 'a') < 26u
#define is_digit(ch) ((ch) >= '0' && (ch) <= '9')
#define is_separator(ch) !(((ch) >= 'a' && (ch) <= 'z') \
|| ((ch) >= 'A' && (ch) <= 'Z') || ((ch) >= '0' && (ch) <= '9') || ((ch) == '_'))
@@ -329,10 +331,15 @@ static int token_match_name(struct finsh_token* self, const char* str)
static void token_trim_space(struct finsh_token* self)
{
char ch;
+#if 0
while ( (ch = token_next_char(self)) ==' ' ||
ch == '\t' ||
ch == '\r' ||
ch == '\n');
+#else
+ while ( (ch = token_next_char(self)) ==' ' ||
+ ch == '\t');
+#endif
token_prev_char(self);
}
@@ -489,7 +496,7 @@ static void token_proc_number(struct finsh_token* self)
{
b = 16;
ch = token_next_char(self);
- while ( is_digit(ch) || isalpha(ch) )
+ while ( is_digit(ch) || is_alpha(ch) )
{
*p++ = ch;
ch = token_next_char(self);
diff --git a/components/finsh/shell.c b/components/finsh/shell.c
index 53932aa5a0..de6132c1ab 100644
--- a/components/finsh/shell.c
+++ b/components/finsh/shell.c
@@ -76,37 +76,6 @@ char *strdup(const char *s)
}
#endif
-#if !defined(__CC_ARM) && !defined(__IAR_SYSTEMS_ICC__) && !defined(__ADSPBLACKFIN__) && !defined(_MSC_VER)
-int isalpha( int ch )
-{
- return (unsigned int)((ch | 0x20) - 'a') < 26u;
-}
-
-int atoi(const char* s)
-{
- long int v=0;
- int sign=1;
- while ( *s == ' ' || (unsigned int)(*s - 9) < 5u) s++;
-
- switch (*s)
- {
- case '-': sign=-1;
- case '+': ++s;
- }
-
- while ((unsigned int) (*s - '0') < 10u)
- {
- v=v*10+*s-'0'; ++s;
- }
-
- return sign==-1?-v:v;
-}
-
-int isprint(unsigned char ch)
-{
- return (unsigned int)(ch - ' ') < 127u - ' ';
-}
-#endif
#endif
#if defined(RT_USING_DFS) && defined(DFS_USING_WORKDIR)
diff --git a/components/libc/newlib/libc.c b/components/libc/newlib/libc.c
index 797c393db8..f7bb8e3f9b 100644
--- a/components/libc/newlib/libc.c
+++ b/components/libc/newlib/libc.c
@@ -5,12 +5,15 @@
#include <sys/time.h>
#include "libc.h"
+#ifdef RT_USING_PTHREADS
+#include <pthread.h>
+#endif
+
void libc_system_init(const char* tty_name)
{
+#ifdef RT_USING_DFS
int fd;
- extern int pthread_system_init(void);
-#ifdef RT_USING_DFS
#ifndef RT_USING_DFS_DEVFS
#error Please enable devfs by defining RT_USING_DFS_DEVFS in rtconfig.h
#endif