// === CODE ===
// - Import userland stroi.c file
#define _LIB_H_
+#define _SysDebug(f,v...) Log_Debug("libc", f ,## v)
#include "../../Usermode/Libraries/libc.so_src/strtoi.c"
int ParseInt(const char *string, int *Val)
break;
}
p = va_arg(args, char*); // Get Argument
- if( !p || !CheckString(p) ) p = "(inval)"; // Avoid #PFs
+ if( p && !CheckString(p) ) goto invalString; // Avoid #PFs
printString:
if(!p) p = "(null)";
len = strlen(p);
while(*p && precision--) { PUTCH(*p); p++;}
if( bPadLeft ) while(len++ < minSize) PUTCH(pad);
break;
+ invalString:
+ PUTCH('(');PUTCH('i');PUTCH('n');PUTCH('v');PUTCH('a'); PUTCH('l');PUTCH(':');
+ PUTCH('*');PUTCH('0');PUTCH('x');
+ val = (tVAddr)p;
+ for( len = BITS/4; len -- && ((val>>(len*4))&15) == 0; )
+ ;
+ len ++;
+ if( len == 0 )
+ PUTCH( '0' );
+ else
+ while( len -- )
+ PUTCH( cUCDIGITS[ (val>>(len*4))&15 ] );
+ PUTCH(')');
+ break;
case 'C': // Non-Null Terminated Character Array
p = va_arg(args, char*);
- if( !CheckMem(p, minSize) ) continue; // No #PFs please
+ if( !CheckMem(p, minSize) ) {
+ p = "(inval)";
+ goto printString;
+ }
if(!p) goto printString;
while(minSize--) {
if(*p == '\0') {
PUTCH('\\');
PUTCH('0');
}
+ else if(*p == '\\') {
+ PUTCH('\\');
+ PUTCH('\\');
+ }
else {
PUTCH(*p);
}