--- zzzz-none-000/linux-2.6.28.10/lib/vsprintf.c 2009-05-02 18:54:43.000000000 +0000 +++ fusiv-7390-686/linux-2.6.28.10/lib/vsprintf.c 2009-12-18 17:01:19.000000000 +0000 @@ -391,6 +391,7 @@ #define LEFT 16 /* left justified */ #define SMALL 32 /* Must be 32 == 0x20 */ #define SPECIAL 64 /* 0x */ +#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) { @@ -692,6 +693,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 */ @@ -739,7 +741,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)