提交 06c6630b 编写于 作者: U user

fix compiling warning in finsh shell

上级 009eccf6
......@@ -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>
......
......@@ -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);
......
......@@ -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)
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册