--- zzzz-none-000/linux-2.6.19.2/lib/vsprintf.c 2007-01-10 19:10:37.000000000 +0000 +++ davinci-8020-5505/linux-2.6.19.2/lib/vsprintf.c 2008-02-01 10:05:05.000000000 +0000 @@ -142,6 +142,7 @@ #define LEFT 16 /* left justified */ #define SPECIAL 32 /* 0x */ #define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */ +#define DOPPELPUNKT 128 /* nur bei %:B */ static char * number(char * buf, char * end, unsigned long long num, int base, int size, int precision, int type) { @@ -309,6 +310,7 @@ case ' ': flags |= SPACE; goto repeat; case '#': flags |= SPECIAL; goto repeat; case '0': flags |= ZEROPAD; goto repeat; + case ':': flags |= DOPPELPUNKT; goto repeat; } /* get field width */ @@ -356,7 +358,69 @@ base = 10; switch (*fmt) { - case 'c': + case 'B': /*--- format %[-+#:].B ---*/ + { + unsigned char *ptr = va_arg(args, unsigned char *); + unsigned int once = 1; + if(field_width <= 0) + field_width = 0; + if(precision <= 0) + precision = 1; + + if(flags & LEFT) { + if(field_width > precision) { + ptr += field_width - precision; + } else { + field_width = 0; + } + } + while(field_width) { + if((str + 7) >= end) { + if((str + 3) >= end) { + break; + } + *str++ = '.'; + *str++ = '.'; + *str++ = '.'; + *str++ = '.'; + break; + } + if(once == 1) { + once = 0; + } else { + if(flags & DOPPELPUNKT) { + *str++ = ':'; + } else if(flags & SPACE) { + *str++ = ' '; + } + } + if(flags & SPECIAL) { + *str++ = '0'; + *str++ = 'x'; + } + if(flags & PLUS) { + signed int i; + for(i = 0 ; (i < precision) && (field_width) && ((str + 7) < end) ; i++, field_width--) { + *str++ = ((ptr[i] >> 4) & 0x0F) > 9 ? ((ptr[i] >> 4) & 0x0F) + 'A' - 10 : ((ptr[i] >> 4) & 0x0F) + '0'; + *str++ = ((ptr[i] >> 0) & 0x0F) > 9 ? ((ptr[i] >> 0) & 0x0F) + 'A' - 10 : ((ptr[i] >> 0) & 0x0F) + '0'; + } + } else { + signed int i; + for(i = precision - 1 ; (i >= 0) && (field_width) && ((str + 7) < end) ; i--, field_width--) { + *str++ = ((ptr[i] >> 4) & 0x0F) > 9 ? ((ptr[i] >> 4) & 0x0F) + 'A' - 10 : ((ptr[i] >> 4) & 0x0F) + '0'; + *str++ = ((ptr[i] >> 0) & 0x0F) > 9 ? ((ptr[i] >> 0) & 0x0F) + 'A' - 10 : ((ptr[i] >> 0) & 0x0F) + '0'; + } + } + if(flags & LEFT) { + ptr -= precision; + } else { + ptr += precision; + } + } + } + continue; + + case 'c': if (!(flags & LEFT)) { while (--field_width > 0) { if (str < end)