概述
本文通过配置busybox来实现arm终端(debug serial)对中文的支持,无需修内核,无需修改busybox源码。
1. ls函数调用过程
main->lbb_main->parse_config_file->find_applet_by_name->applet_main->ls_main->showdirs->list_dir->showfiles->list_single->print_name->printable_string->unicode_conv_to_printable->unicode_conv_to_printable2
由以上过程的分析可知,对中文的支持是通过unicode_conv_to_printable2。
2. unicode_conv_to_printable2
static char* FAST_FUNC unicode_conv_to_printable2(uni_stat_t *stats,const char *src, unsigned width, int flags)
{
char *dst;
unsigned dst_len;
unsigned uni_count;
unsigned uni_width;
if(unicode_status != UNICODE_ON) {
char *d;
if (flags &UNI_FLAG_PAD) {
d = dst= xmalloc(width + 1);
while((int)--width >= 0) {
unsignedchar c = *src;
if(c == '