--- zzzz-none-000/linux-2.6.13.1/lib/vsprintf.c 2005-09-10 02:42:58.000000000 +0000 +++ ohio-7170-487/linux-2.6.13.1/lib/vsprintf.c 2006-09-01 08:32:10.000000000 +0000 @@ -141,6 +141,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) { @@ -306,6 +307,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 */ @@ -353,6 +355,68 @@ base = 10; switch (*fmt) { + 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) { @@ -435,6 +499,10 @@ base = 8; break; + case 'b': + base = 2; + break; + case 'X': flags |= LARGE; case 'x':