[finsh] fix the '\0' issue when use shell in linux telnet

This commit is contained in:
Bernard Xiong 2015-09-24 03:06:26 +00:00
parent be9b3d1df6
commit 353f511cb0

View File

@ -424,7 +424,10 @@ void finsh_thread_entry(void* parameter)
char next;
if (rt_device_read(shell->device, 0, &next, 1) == 1)
ch = next;
{
if (next == '\0') ch = 'r'; /* linux telnet will issue '\0' */
else ch = next;
}
else ch = '\r';
}
/* handle tab key */
@ -631,10 +634,12 @@ int finsh_system_init(void)
#elif defined(_MSC_VER)
unsigned int *ptr_begin, *ptr_end;
ptr_begin = (unsigned int*)&__fsym_begin; ptr_begin += (sizeof(struct finsh_syscall)/sizeof(unsigned int));
ptr_begin = (unsigned int *)&__fsym_begin;
ptr_begin += (sizeof(struct finsh_syscall) / sizeof(unsigned int));
while (*ptr_begin == 0) ptr_begin ++;
ptr_end = (unsigned int*) &__fsym_end; ptr_end --;
ptr_end = (unsigned int *) &__fsym_end;
ptr_end --;
while (*ptr_end == 0) ptr_end --;
finsh_system_function_init(ptr_begin, ptr_end);