X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Fdebug.c;h=4b3aeb77518f47700c99c7123ad5e990dbd4eee0;hb=0e9730abc6c9ba710a3f71356720a70d79e407ab;hp=12adc22a7b53852f966e421b2fb11aa7bb26aba4;hpb=54746c855c6e2fe42fde9f93b0ce3f41aeefc2e5;p=tpg%2Facess2.git diff --git a/Kernel/debug.c b/Kernel/debug.c index 12adc22a..4b3aeb77 100644 --- a/Kernel/debug.c +++ b/Kernel/debug.c @@ -90,6 +90,7 @@ void Debug_Fmt(const char *format, va_list *args) char *p = NULL; int isLongLong = 0; Uint64 arg; + int bPadLeft = 0; while((c = *format++) != 0) { @@ -119,6 +120,12 @@ void Debug_Fmt(const char *format, va_list *args) // Get Argument arg = va_arg(*args, Uint); + // - Padding Side Flag + if(c == '+') { + bPadLeft = 1; + c = *format++; + } + // Padding if(c == '0') { pad = '0'; @@ -175,6 +182,11 @@ void Debug_Fmt(const char *format, va_list *args) itoa(p, arg, 2, minSize, pad); goto printString; + printString: + if(!p) p = "(null)"; + while(*p) Debug_Putchar(*p++); + break; + case 'B': //Boolean if(arg) Debug_Puts("True"); else Debug_Puts("False"); @@ -184,10 +196,9 @@ void Debug_Fmt(const char *format, va_list *args) p = (char*)(Uint)arg; if(!p) p = "(null)"; len = strlen(p); - while(len++ < minSize) Debug_Putchar(pad); - printString: - if(!p) p = "(null)"; + if( !bPadLeft ) while(len++ < minSize) Debug_Putchar(pad); while(*p) Debug_Putchar(*p++); + if( bPadLeft ) while(len++ < minSize) Debug_Putchar(pad); break; // Single Character / Array