finsh模块源代码,反馈2处bug,源文件位置finsh_token.c:
static uint8_t* token_proc_string(struct finsh_token* self)
{
uint8_t* p;
for ( p = &self->string[0]; p - &(self->string[0]) < FINSH_STRING_MAX; )
{
char ch = token_next_char(self);
if ( is_eof(self) )
{
finsh_error_set(FINSH_ERROR_UNEXPECT_END);
return NULL;;
}
static void token_proc_number(struct finsh_token*
{
char ch;
char *p, buf[128];
long value;
value = 0;
p = buf;
ch = token_next_char(self);
if ( ch == '0' )
{
int b;
ch = token_next_char(self);
if ( ch == 'x' || ch == 'X' )/*it's a hex number*/
{
b = 16;
ch = token_next_char(self);
while ( is_digit(ch) || is_alpha(ch) )
{
*p++ = ch;
ch = token_next_char(self);
}
*p = '\0';
}
1、源码中多一个“;”符号不会影响最终结果,但严格要求,必须改;
2、判断16进制数值准确判断是包含0-9的数字和a-f的大小写才准确。